[Sciviews-commits] r369 - in komodo/SciViews-K-dev: content content/js content/js/tools defaults
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Mar 27 23:16:31 CEST 2011
Author: prezez
Date: 2011-03-27 23:16:30 +0200 (Sun, 27 Mar 2011)
New Revision: 369
Modified:
komodo/SciViews-K-dev/content/RObjectsOverlay.xul
komodo/SciViews-K-dev/content/js/commands.js
komodo/SciViews-K-dev/content/js/pref-R.js
komodo/SciViews-K-dev/content/js/prefs.js
komodo/SciViews-K-dev/content/js/r.js
komodo/SciViews-K-dev/content/js/robjects.js
komodo/SciViews-K-dev/content/js/tools/file.js
komodo/SciViews-K-dev/content/overlayMain.xul
komodo/SciViews-K-dev/content/pref-R.xul
komodo/SciViews-K-dev/content/sessions.xul
komodo/SciViews-K-dev/defaults/svStart.R
Log:
Preferences: small fixes and modifications (empty values handling, connection settings are initially hidden)
sv.checkAllPref - better checking for invalid values
sv.r.setSession - bug fixed
sessions.xul - checkbox whether to save old workspace
Modified: komodo/SciViews-K-dev/content/RObjectsOverlay.xul
===================================================================
--- komodo/SciViews-K-dev/content/RObjectsOverlay.xul 2011-03-16 21:09:09 UTC (rev 368)
+++ komodo/SciViews-K-dev/content/RObjectsOverlay.xul 2011-03-27 21:16:30 UTC (rev 369)
@@ -41,7 +41,7 @@
]>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
-<?xml-stylesheet href="chrome://komodo/skin/global/global.p.css" type="text/css"?>
+<?xml-stylesheet href="chrome://komodo/skin/global/global.css" type="text/css"?>
<?xml-stylesheet href="chrome://komodo/skin/bindings/buttons.css" type="text/css"?>
<?xml-stylesheet href="chrome://sciviewsk/skin/sciviewsk.css" type="text/css"?>
@@ -182,6 +182,17 @@
<tabpanels id="project_toolbox_tabpanels">
<tabpanel flex="1" id="sciviews_robjects_tabpanel"
insertafter="projectviewbox,codebrowserviewbox">
+
+
+<!-- <hbox flex="1" align="center"><vbox align="center" flex="1">
+ <button label="Start "
+ class="r-run-command-icon"
+ observes="cmd_svStartR"
+ dir="reverse"
+ orient="horizontal" />
+ </vbox></hbox>-->
+
+
<vbox flex="1" id="sciviews_robjects_vbox">
<hbox align="center" id="sciviews_robjects_hbox">
<toolbarbutton id="sciviews_robjects_refresh_button"
Modified: komodo/SciViews-K-dev/content/js/commands.js
===================================================================
--- komodo/SciViews-K-dev/content/js/commands.js 2011-03-16 21:09:09 UTC (rev 368)
+++ komodo/SciViews-K-dev/content/js/commands.js 2011-03-27 21:16:30 UTC (rev 369)
@@ -132,7 +132,6 @@
}
// Start R
-
this.startR = function () {
var exitCode;
if (_this.RProcess && _this.RProcess.uuid) try {
@@ -569,27 +568,42 @@
return proc;
}
-//addEventListener("load", function() {
- //TODO: check connection with R, then find running R processes
- // report if R is running but not responding
- //_this.getRProc().
-//}, false);
+this.places = {
+ sourceSelection: function sv_sourcePlacesSelection() {
+ var files = ko.places.manager.getSelectedItems()
+ .filter(function(x)(x.name.search(/\.[Rr]$/) != -1))
+ .map(function(x) x.file.path);
+ if (!files.length) return;
+ var cmd = files.map(function(x) "source('" + sv.tools.string.addslashes(x) +"')" ).join("\n");
+ sv.rconn.eval(cmd, null, false);
+ },
-this.sourcePlacesSelection = function sv_sourcePlacesSelection() {
- var files = ko.places.manager.getSelectedItems()
- .filter(function(x)(x.name.search(/\.[Rr]$/) != -1))
- .map(function(x) x.file.path);
- if (!files.length) return;
- var cmd = files.map(function(x) "source('" + sv.tools.string.addslashes(x) +"')" ).join("\n");
- sv.rconn.eval(cmd, null, false);
+ get anyRFilesSelected()
+ ko.places.manager.getSelectedItems()
+ .some(function(x) /\.[Rr]$/.test(x.name))
}
+//}
-addEventListener("load", function() setTimeout(_setControllers, 600), false);
-addEventListener("load", _setKeybindings, false);
+// TODO: move this to sv.onLoad:
+this.onLoad = function(event) {
+ setTimeout(function() {
+ _setControllers();
+ _this.updateRStatus(false); // XXX: workaround for some items in
+ //'cmdset_rApp' commandset being grayed out
+ //at startup...
+ _this.updateRStatus(sv.rconn.testRAvailability(false));
+ }, 600);
+ _setKeybindings();
+
+ sv.rconn.startSocketServer();
+}
+
+addEventListener("load", _this.onLoad, false);
+
}).apply(sv.command);
-
+// XXX: for DEBUG only
sv.getScimoz = function sv_getScimoz ()
ko.views.manager.currentView? ko.views.manager.currentView.scimoz : null;
Modified: komodo/SciViews-K-dev/content/js/pref-R.js
===================================================================
--- komodo/SciViews-K-dev/content/js/pref-R.js 2011-03-16 21:09:09 UTC (rev 368)
+++ komodo/SciViews-K-dev/content/js/pref-R.js 2011-03-27 21:16:30 UTC (rev 369)
@@ -43,6 +43,7 @@
el = ml[i];
if (el.hasAttribute(attribute)) {
values = el.getAttribute(attribute).split(/\s+/);
+ el.removeAllItems(); /// XXX
for (var k in values) {
v = unescape(values[k]);
el.appendItem(v, v, null);
@@ -58,7 +59,7 @@
var el, values;
for (var i = 0; i < ml.length; i++) {
el = ml[i];
- if (el.hasAttribute(attribute)) {
+ if (el.editable && el.hasAttribute(attribute)) {
values = [];
for (var k = 0; k < el.itemCount; k++) {
values.push(escape(el.getItemAtIndex(k).value));
@@ -85,37 +86,29 @@
}
// List of R applications
+// Constructor
+function _App(id, name, path, app, required, platform) {
+ this.id = id;
+ this.name = name;
+ this.path = path;
+ this.app = app;
+ this.required = required? required.split(/\s*,\s*/) : [];
+ this.platform = platform? platform.split(/\s*,\s*/): [];
+}
+
var apps = [
-{ id:"r-terminal", label:"in default terminal", path:"\"%Path%\" %args%",
- app:"R", required:"R", platform:"Lin,Mac"},
-{id:"r-terminal", label:"in console window", path:"\"%Path%\" %args%",
- app:"R.exe", required:"R", platform:"Win"},
-{id:"r-gnome-term", label:"in Gnome terminal",
- path:"gnome-terminal --hide-menubar --working-directory='%cwd%' -t '%title%' -x '%Path%' %args%",
- app:"R", required:"gnome-terminal,R", platform:"Lin"},
-{id:"r-kde-term", label:"in Konsole", app:"R",
- path:"konsole --workdir '%cwd%' --title %title% -e \"%Path%\" %args%",
- required:"konsole,R", platform:"Lin"},
-{id:"r-xfce4-term", label:"in XFCE terminal", app:"R",
- path:"xfce4-terminal --title \"%title%\" -x \"%Path%\" %args%",
- required:"xfce4-terminal,R", platform:"Lin"},
-{id:"r-app", label:"R app", path:"open -a \"%Path%\" \"%cwd%\"",
- app:"R.app",
- required:"/Applications/R.app", platform:"Mac"},
-{id:"r64-app", label:"R64 app", path:"open -a \"%Path%\" \"%cwd%\"",
- app:"R64.app",
- required:"/Applications/R64.app", platform:"Mac"},
-{id:"svr-app", label:"SciViews R app", path:"open -a \"%Path%\" \"%cwd%\"",
- app:"SciViews R.app",
- required:"/Applications/SciViews R.app", platform: "Mac"},
-{id:"svr64-app", label:"SciViews R64 app", path:"open -a \"%Path%\" \"%cwd%\"",
- app:"SciViews R64.app",
- required:"/Applications/SciViews R64.app", platform:"Mac"},
-{id:"r-gui", label:"R GUI", app:"Rgui.exe", path:"\"%Path%\" --sdi %args%",
- required:"Rgui",
- platform:"Win"},
-{id:"r-tk", label:"R Tk GUI", path:"\"%Path%\" --interactive --gui:Tk %args%",
- app:"R", required:"R", platform:"Lin,Mac"}
+new _App("", "Choose...", "", "", "", "Lin,Mac,Win"),
+new _App("r-terminal", "in default terminal", "\"%Path%\" %args%", "R", "R", "Lin,Mac"),
+new _App("r-terminal", "in console window", "\"%Path%\" %args%", "R.exe", "R", "Win"),
+new _App("r-gnome-term", "in Gnome terminal", "gnome-terminal --hide-menubar --working-directory='%cwd%' -t '%title%' -x '%Path%' %args%", "R", "gnome-terminal,R", "Lin"),
+new _App("r-kde-term", "in Konsole", "konsole --workdir '%cwd%' --title %title% -e \"%Path%\" %args%", "R", "konsole,R", "Lin"),
+new _App("r-xfce4-term", "in XFCE terminal", "xfce4-terminal --title \"%title%\" -x \"%Path%\" %args%", "R", "xfce4-terminal,R", "Lin"),
+new _App("r-app", "R app", "open -a \"%Path%\" \"%cwd%\"", "R.app", "/Applications/R.app", "Mac"),
+new _App("r64-app", "R64 app", "open -a \"%Path%\" \"%cwd%\"", "R64.app", "/Applications/R64.app", "Mac"),
+new _App("svr-app", "SciViews R app", "open -a \"%Path%\" \"%cwd%\"", "SciViews R.app", "/Applications/SciViews R.app", "Mac"),
+new _App("svr64-app", "SciViews R64 app", "open -a \"%Path%\" \"%cwd%\"", "SciViews R64.app", "/Applications/SciViews R64.app", "Mac"),
+new _App("r-gui", "R GUI", "Rgui.exe", "\"%Path%\" --sdi %args%", "Rgui", "Win"),
+new _App("r-tk", "R Tk GUI", "\"%Path%\" --interactive --gui:Tk %args%", "R", "R", "Lin,Mac")
];
@@ -129,32 +122,20 @@
var os = Components.classes['@activestate.com/koOs;1']
.getService(Components.interfaces.koIOs);
- //var prefExecutable;
- //var prefset = parent.hPrefWindow.prefset;
- //var prefName = 'svRDefaultInterpreter';
+ var platform = navigator.platform.substr(0,3);
+ apps = apps.filter(function(x) (x.platform.indexOf(platform) != -1)
+ && (!x.required.length
+ || x.required.every(
+ function(y) sv.tools.file.whereIs(y).length != 0)
+ )
+ );
+
var menu = document.getElementById("svRApplication");
menu.removeAllItems();
+ for (var i in apps) menu.appendItem(apps[i].label, i, null);
- var platform = navigator.platform.substr(0,3);
-
- var tmp = {}, required, res;
- for (var i in apps)
- if (apps[i].platform.split(',').indexOf(platform) != -1) {
- required = apps[i].required.split(',');
- res = true;
- for (var k in required)
- res = res && !!sv.tools.file.whereIs(required[k]);
- if (res)
- tmp[apps[i].id] = apps[i];
- }
- apps = tmp;
-
- for (var i in apps)
- menu.appendItem(apps[i].label, i, null);
-
// update cran mirror list (first local, then tries remote at CRAN)
- if (!PrefR_UpdateCranMirrors(true))
- PrefR_UpdateCranMirrors(false);
+ if (!PrefR_UpdateCranMirrors(true)) PrefR_UpdateCranMirrors(false);
menuListSetValues(); // Restores saved menu values
sv.checkAllPref(); // Check if all preference values are ok, if not, restore defaults
@@ -182,6 +163,7 @@
case "nt":
rs = rs.concat(sv.tools.file.whereIs("Rgui"));
rs = rs.concat(sv.tools.file.whereIs("R"));
+ rs.sort(); rs.reverse();
break;
case "mac":
//FIXME: as I understand there are only 2 options on Mac, is it right?:
@@ -272,7 +254,7 @@
function svRDefaultInterpreterOnSelect(event) {
var os = Components.classes['@activestate.com/koOs;1']
- .getService(Components.interfaces.koIOs);
+ .getService(Components.interfaces.koIOs);
var menuApplication = document.getElementById("svRApplication");
var menuInterpreters = document.getElementById("svRDefaultInterpreter");
@@ -284,15 +266,13 @@
var app = os.path.basename(menuInterpreters.value);
- if (apps[menuApplication.value].app != app) {
+ if (!(menuApplication.value in apps) || apps[menuApplication.value].app != app) {
var i;
for (i in apps)
- if (apps[i].app == app) break;
+ if (apps[i].app == app) break;
menuApplication.value = i;
}
-
-
PrefR_updateCommandLine(true);
}
@@ -300,11 +280,13 @@
function PrefR_svRApplicationOnSelect(event) {
var menuApplication = document.getElementById("svRApplication");
var menuInterpreters = document.getElementById("svRDefaultInterpreter");
+ if (!(menuApplication.value in apps)) return;
+
var app = apps[menuApplication.value].app;
var sel = menuApplication.selectedItem;
var os = Components.classes['@activestate.com/koOs;1']
- .getService(Components.interfaces.koIOs);
+ .getService(Components.interfaces.koIOs);
if (os.path.basename(menuInterpreters.value) != app) {
//TODO: modify to use with:
@@ -325,17 +307,20 @@
function PrefR_updateCommandLine(update) {
var appId = document.getElementById("svRApplication").value;
- var appPath = document.getElementById("svRDefaultInterpreter").value;
+ var appPath = document.getElementById("svRDefaultInterpreter").value;
+
+ if(!appId || !appPath) return '';
+
var cmdArgs = document.getElementById("svRArgs").value;
var args1 = "";
if(document.getElementById("sciviews.pkgs.sciviews").checked)
- args1 += " --svStartPkgs=SciViews,MASS,ellipse";
+ args1 += " --svStartPkgs=SciViews,MASS,ellipse";
var cwd = sv.tools.file.path("ProfD", "extensions",
"sciviewsk at sciviews.org", "defaults");
- cmdArgs = cmdArgs.replace(/\s*--mdi/, "");
+ cmdArgs = cmdArgs.replace(/\s*--[sm]di\b/, "");
var argsPos = cmdArgs.indexOf("--args");
if (argsPos != -1) {
@@ -349,15 +334,15 @@
var cmd = apps[appId].path;
cmd = cmd.replace("%Path%", appPath)
- .replace("%title%", "SciViews-R").replace("%cwd%", cwd)
- .replace("%args%", cmdArgs) + args1;
+ .replace("%title%", "SciViews-R").replace("%cwd%", cwd)
+ .replace("%args%", cmdArgs) + args1;
if (update) {
var cmdLabel = document.getElementById('R_command');
cmdLabel.value = cmd;
}
- return(cmd);
+ return cmd;
}
function PrefR_setExecutable(path) {
@@ -382,8 +367,6 @@
}
-
-
// Get CRAN mirrors list - independently of R
function PrefR_UpdateCranMirrors(localOnly) {
var svFile = sv.tools.file;
Modified: komodo/SciViews-K-dev/content/js/prefs.js
===================================================================
--- komodo/SciViews-K-dev/content/js/prefs.js 2011-03-16 21:09:09 UTC (rev 368)
+++ komodo/SciViews-K-dev/content/js/prefs.js 2011-03-27 21:16:30 UTC (rev 369)
@@ -19,10 +19,11 @@
// sv.prefs.defaults[preferenceName] = preferenceValue
sv.defaultPrefs = {
'sciviews.ko.port': 7052,
- 'sciviews.client.type': 'socket',
'sciviews.r.port': 8888,
+ 'sciviews.r.host': '127.0.0.1',
'sciviews.client.id': 'SciViewsK',
- 'sciviews.r.host': '127.0.0.1',
+ 'sciviews.client.type': 'socket',
+ 'sciviews.conn.type': 'socket',
svRDefaultInterpreter: '',
svRApplication: '',
svRArgs: '--quiet',
@@ -39,7 +40,13 @@
//// Set default preferences
sv.checkAllPref = function sv_checkAllPref(revert) {
- for (var i in sv.defaultPrefs) sv.pref.setPref(i, sv.defaultPrefs[i], revert);
+ var val, rev;
+ for (var i in sv.defaultPrefs) {
+ val = sv.pref.getPref(i);
+ rev = revert || (typeof(val) == "number" && isNaN(val)) || val == "None"
+ || (sv.defaultPrefs[i] != '' && val == '');
+ sv.pref.setPref(i, sv.defaultPrefs[i], rev);
+ }
};
Modified: komodo/SciViews-K-dev/content/js/r.js
===================================================================
--- komodo/SciViews-K-dev/content/js/r.js 2011-03-16 21:09:09 UTC (rev 368)
+++ komodo/SciViews-K-dev/content/js/r.js 2011-03-27 21:16:30 UTC (rev 369)
@@ -737,8 +737,8 @@
dir = sv.r.initSession(dir, datadir, scriptdir, reportdir);
// Switch to the new session directory in R
- cmd += 'setwd("' + dir.addslashes() + '")\noptions(R.initdir = "' +
- dir.addslashes() + '")\n';
+ cmd.push('setwd("' + dir.addslashes() + '")\noptions(R.initdir = "' +
+ dir.addslashes() + '")');
var svFile = sv.tools.file;
@@ -746,8 +746,8 @@
// TODO: loadhistory APPENDS a history. Make R clear the current history first.
// Note: there seems to be no way to clear history without restarting R!
if (loadNew) {
- cmd += 'if (file.exists(".RData")) load(".RData");\n' +
- 'if (file.exists(".Rhistory")) loadhistory();\n';
+ cmd.push('if (file.exists(".RData")) load(".RData")',
+ 'if (file.exists(".Rhistory")) loadhistory()');
// Look for .Rprofile, in current, then in user directory (where else R looks for it?)
// if exists, source the first one.
@@ -758,16 +758,15 @@
for(i in Rprofile) {
if(svFile.exists(Rprofile[i])) {
- cmd += 'source("' + (Rprofile[i]).addslashes() + '");\n';
+ cmd.push('source("' + (Rprofile[i]).addslashes() + '")');
break;
}
}
}
-TODO ///
// Execute the command in R (TODO: check for possible error here!)
// TODO: run first in R; make dirs in R; then change in Komodo!
- sv.r.evalCallback(cmd, function(data) {
+ sv.r.evalCallback(cmd.join(";\n"), function(data) {
sv.cmdout.append(data);
// Indicate everything is fine
@@ -778,7 +777,7 @@
// TODO: Breaking should be done *before* the last command
// TODO: report if we load something or not
sv.r.evalCallback('cat("Session directory is now", dQuote("' + dir.addslashes() +
- '"), "\\n", file = stderr())', null);
+ '"), "\\n", file = stderr())', null);
// Refresh object explorer, ...
sv.rconn.eval('koCmd("sv.rbrowser.smartRefresh()")', null, true);
});
Modified: komodo/SciViews-K-dev/content/js/robjects.js
===================================================================
--- komodo/SciViews-K-dev/content/js/robjects.js 2011-03-16 21:09:09 UTC (rev 368)
+++ komodo/SciViews-K-dev/content/js/robjects.js 2011-03-27 21:16:30 UTC (rev 369)
@@ -178,7 +178,8 @@
//}
function _createVisibleData () {
- if (!isInitialized) throw new Error("treeData not initialized");
+ //if (!isInitialized) throw new Error("treeData not initialized");
+ if (!isInitialized) return;
var rowsBefore;
//var visDataLen = _this.visibleData.length;
@@ -591,7 +592,7 @@
// origItem: null
//}
-this.sort = function sort (column, root) {
+this.sort = function sort (column, root) {
var columnName, currentElement, tree, sortDirection, realOrder, order,
sortDirs;
tree = document.getElementById("sciviews_robjects_objects_tree");
Modified: komodo/SciViews-K-dev/content/js/tools/file.js
===================================================================
--- komodo/SciViews-K-dev/content/js/tools/file.js 2011-03-16 21:09:09 UTC (rev 368)
+++ komodo/SciViews-K-dev/content/js/tools/file.js 2011-03-27 21:16:30 UTC (rev 369)
@@ -33,6 +33,7 @@
(function () {
// Default file encoding to use
+ var _this = this;
this.defaultEncoding = "latin1";
this.TYPE_DIRECTORY = 2;
this.TYPE_FILE = 1;
@@ -40,7 +41,7 @@
// Read a file with encoding
this.read = function (filename, encoding) {
- if (!encoding) encoding = this.defaultEncoding;
+ if (!encoding) encoding = _this.defaultEncoding;
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
@@ -75,7 +76,7 @@
// Write in a file with encoding
this.write = function (filename, content, encoding, append) {
- if (!encoding) encoding = this.defaultEncoding;
+ if (!encoding) encoding = _this.defaultEncoding;
append = append? 0x10 : 0x20;
@@ -110,26 +111,26 @@
try {
file.initWithPath(path);
} catch(e) {
- return(this.TYPE_NONE);
+ return(_this.TYPE_NONE);
}
if (file.exists()) {
if (file.isDirectory()) {
- return(this.TYPE_DIRECTORY);
+ return(_this.TYPE_DIRECTORY);
} else if (file.isFile()) {
- return(this.TYPE_FILE);
+ return(_this.TYPE_FILE);
}
}
- return(this.TYPE_NONE);
+ return(_this.TYPE_NONE);
}
this.exists2 = function (path) {
var sysutils = Components.classes['@activestate.com/koSysUtils;1']
.getService(Components.interfaces.koISysUtils);
- if(sysutils.IsDir(path)) return(this.TYPE_DIRECTORY);
- if(sysutils.IsFile(path)) return(this.TYPE_FILE);
- return(this.TYPE_NONE);
+ if(sysutils.IsDir(path)) return(_this.TYPE_DIRECTORY);
+ if(sysutils.IsFile(path)) return(_this.TYPE_FILE);
+ return(_this.TYPE_NONE);
}
@@ -178,7 +179,7 @@
// Create nsILocalFile object from path
// concatenates arguments if needed
this.getfile = function (path) {
- path = this.path.apply(this, Array.apply(null, arguments));
+ path = _this.path.apply(_this, Array.apply(null, arguments));
//return(path);
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
@@ -222,7 +223,7 @@
}
this.getURI = function(file) {
- if (typeof file == "string") file = this.getfile(file);
+ if (typeof file == "string") file = _this.getfile(file);
if (!file) return (null);
var ios = Components.classes["@mozilla.org/network/io-service;1"]
@@ -342,7 +343,7 @@
for (var i in ret) {
for (var j in binDir) {
app = ret[i] + binDir[j] + appName;
- if (this.exists(app)) ret2.push(app);
+ if (_this.exists(app)) ret2.push(app);
}
}
return (ret2);
@@ -397,14 +398,14 @@
this.zipUnpack = function(zipPath, targetDir) {
var zipReader = Components.classes["@mozilla.org/libjar/zip-reader;1"]
.createInstance(Components.interfaces.nsIZipReader);
- zipReader.open(this.getfile(zipPath));
+ zipReader.open(_this.getfile(zipPath));
var entries = zipReader.findEntries(null);
var entryName, outFile, isFile;
while (entries.hasMore()) {
entryName = entries.getNext();
- outFile = this.getfile(targetDir, entryName);
+ outFile = _this.getfile(targetDir, entryName);
isFile = !(zipReader.getEntry(entryName).isDirectory);
- this.getDir(outFile, isFile, false);
+ _this.getDir(outFile, isFile, false);
//sv.cmdout.append(outFile.path + " = " + outFile.exists());
if(isFile) {
try{ zipReader.extract(entryName, outFile);
Modified: komodo/SciViews-K-dev/content/overlayMain.xul
===================================================================
--- komodo/SciViews-K-dev/content/overlayMain.xul 2011-03-16 21:09:09 UTC (rev 368)
+++ komodo/SciViews-K-dev/content/overlayMain.xul 2011-03-27 21:16:30 UTC (rev 369)
@@ -213,7 +213,7 @@
class="menuitem-iconic r-source-function-icon"/>
<menuseparator/>
<menuitem id="r_install_toolboxes" class="menuitem-iconic-wide"
- oncommand="sv.checkToolbox();" label="(Re)install R toolboxes" />
+ oncommand="sv.checkToolbox()" label="(Re)install R toolboxes" />
</menupopup>
</menu>
</menubar>
@@ -309,15 +309,14 @@
<menupopup id="places-files-popup">
<menuseparator id="placesContextMenu_separatorR"
- testEval_HideIf="ko.places.manager.getSelectedItems().some(function(x) /\.[Rr]$/.test(x.name))"
+ testEval_HideIf="!sv.command.places.anyRFilesSelected"
/>
-<menuitem desc="General: Edit Properties"
- oncommand="sv.command.sourcePlacesSelection()"
+<menuitem oncommand="sv.command.places.sourceSelection()"
disableIf="folder"
class="menuitem-iconic"
id="placesContextMenu_Rsource"
label="Source into R"
- testEval_HideIf="ko.places.manager.getSelectedItems().some(function(x) /\.[Rr]$/.test(x.name))"
+ testEval_HideIf="!sv.command.places.anyRFilesSelected"
/>
</menupopup>
Modified: komodo/SciViews-K-dev/content/pref-R.xul
===================================================================
--- komodo/SciViews-K-dev/content/pref-R.xul 2011-03-16 21:09:09 UTC (rev 368)
+++ komodo/SciViews-K-dev/content/pref-R.xul 2011-03-27 21:16:30 UTC (rev 369)
@@ -113,38 +113,6 @@
</groupbox>
<groupbox orient="vertical">
- <caption label="Connection with R"/>
- <hbox align="center">
- <label value="Connection type:" control="sciviews.client.type"/>
- <menulist pref="true" id="sciviews.client.type"
- values="http socket" persist="values" editable="false" disabled="true">
- <menupopup />
- </menulist>
- </hbox>
- <grid>
- <columns>
- <column flex="1"/> <column flex="2"/> <column flex="1"/> <column
- flex="2"/>
- </columns>
- <rows>
- <row align="center">
- <label value="Server port #:" control="sciviews.r.port" />
- <textbox id="sciviews.r.port" pref="true" width="50" />
- <label value="Host to connect to:" control="sciviews.r.host" />
- <textbox id="sciviews.r.host" pref="true" width="150"
- disabled="true"/>
- </row>
- <row align="center">
- <label value="Client port #:" control="sciviews.ko.port" />
- <textbox id="sciviews.ko.port" pref="true" width="50" />
- <label value="Client Id:" control="sciviews.client.id" />
- <textbox id="sciviews.client.id" pref="true" width="150" />
- </row>
- </rows>
- </grid>
- </groupbox>
-
- <groupbox orient="vertical">
<caption label="Data input and output"/>
<grid>
<columns>
@@ -186,8 +154,6 @@
<groupbox orient="vertical" align="left">
<caption label="Miscellanous"/>
-
-
<label value="Startup packages"/>
<!-- KB: Some users (including me) might not want having lots of unnecessary packages loaded at startup -->
<vbox align="left">
@@ -204,7 +170,6 @@
</hbox>
</vbox>
<separator class="thin"/>
-
<hbox align="center" hidden="true">
<label value="Show R help in:" />
<radiogroup id="sciviews.rhelp.open_in" disabled="true"
@@ -221,6 +186,42 @@
</hbox>
</groupbox>
+ <hbox>
+ <button label="Show advanced settings (rarely need to be changed)"
+ oncommand="document.getElementById('pref-R-advanced').hidden=false; this.hidden=true;" hidden="false" />
+ </hbox>
+ <groupbox id="pref-R-advanced" orient="vertical" hidden="true" >
+ <caption label="Connection with R"/>
+ <hbox align="center">
+ <label value="Connection type:" control="sciviews.conn.type" />
+ <menulist pref="true" id="sciviews.conn.type"
+ values="socket http" persist="" editable="false" disabled="false">
+ <menupopup />
+ </menulist>
+ </hbox>
+ <grid>
+ <columns>
+ <column flex="1"/> <column flex="2"/> <column flex="1"/> <column
+ flex="2"/>
+ </columns>
+ <rows>
+ <row align="center">
+ <label value="Server port #:" control="sciviews.r.port" />
+ <textbox id="sciviews.r.port" pref="true" width="50" />
+ <label value="Host to connect to:" control="sciviews.r.host" />
+ <textbox id="sciviews.r.host" pref="true" width="150"
+ disabled="true"/>
+ </row>
+ <row align="center">
+ <label value="Client port #:" control="sciviews.ko.port" />
+ <textbox id="sciviews.ko.port" pref="true" width="50" />
+ <label value="Client Id:" control="sciviews.client.id" />
+ <textbox id="sciviews.client.id" pref="true" width="150" />
+ </row>
+ </rows>
+ </grid>
+ </groupbox>
+
<groupbox orient="vertical" align="center">
<caption label="About"/>
<separator class="thin"/>
Modified: komodo/SciViews-K-dev/content/sessions.xul
===================================================================
--- komodo/SciViews-K-dev/content/sessions.xul 2011-03-16 21:09:09 UTC (rev 368)
+++ komodo/SciViews-K-dev/content/sessions.xul 2011-03-27 21:16:30 UTC (rev 369)
@@ -46,7 +46,6 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="OnLoad(event)"
orient="vertical"
-flex="1"
buttons="accept,extra1,cancel"
buttonlabelextra1="Apply"
ondialoghelp="return false;"
@@ -56,6 +55,7 @@
title="R Session manager"
persist="screenX screenY"
>
+
<script type="text/javascript">
<![CDATA[
@@ -160,10 +160,12 @@
prefAll[el.id] = prefVal;
}
+ var saveOld = document.getElementById("sciviews.session.saveold").checked;
+
sv.r.setSession(prefAll["sciviews.session.dir"],
prefAll["sciviews.session.data"],
prefAll["sciviews.session.scripts"],
- prefAll["sciviews.session.reports"]);
+ prefAll["sciviews.session.reports"], saveOld);
for (i in prefAll) sv.pref.setPref(i, prefAll[i]);
@@ -377,6 +379,10 @@
<checkbox id="sciviews.session.placesroot" pref="true"
label="Set this directory as root in "Places""
/>
+
+ <checkbox label="Save old workspace"
+ id="sciviews.session.saveold" pref="true"
+ />
</hbox>
<separator class="thin"/>
<label id="info" value="" />
Modified: komodo/SciViews-K-dev/defaults/svStart.R
===================================================================
--- komodo/SciViews-K-dev/defaults/svStart.R 2011-03-16 21:09:09 UTC (rev 368)
+++ komodo/SciViews-K-dev/defaults/svStart.R 2011-03-27 21:16:30 UTC (rev 369)
@@ -610,6 +610,7 @@
invisible(koCmd(paste(
"sv.cmdout.append('R is started')",
sprintf("sv.pref.setPref('sciviews.r.port', %d)", port),
+ "sv.rbrowser.smartRefresh()",
sep = ";")))
}, error=function(e) warning(e))
More information about the Sciviews-commits
mailing list