[Sciviews-commits] r372 - in komodo/SciViews-K-dev: components content content/js defaults
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Mar 30 21:41:56 CEST 2011
Author: prezez
Date: 2011-03-30 21:41:55 +0200 (Wed, 30 Mar 2011)
New Revision: 372
Modified:
komodo/SciViews-K-dev/components/svIUtils.idl
komodo/SciViews-K-dev/components/svUtils.py
komodo/SciViews-K-dev/content/js/commands.js
komodo/SciViews-K-dev/content/js/pref-R.js
komodo/SciViews-K-dev/content/js/r.js
komodo/SciViews-K-dev/content/js/rconnection.js
komodo/SciViews-K-dev/content/js/robjects.js
komodo/SciViews-K-dev/content/js/sciviews.js
komodo/SciViews-K-dev/content/overlayMain.xul
komodo/SciViews-K-dev/content/pref-R.xul
komodo/SciViews-K-dev/defaults/.Rprofile
komodo/SciViews-K-dev/defaults/svMisc_0.9-61.tar.gz
komodo/SciViews-K-dev/defaults/svSocket_0.9-48.tar.gz
Log:
overlayMain.xul: added "R packages" submenu
svUtils,sv.rconn: added timeout for evalAtOnce method, replaced wstring with A*String in idl
source sv* packages repacked under linux (previously gave an error by installation)
Modified: komodo/SciViews-K-dev/components/svIUtils.idl
===================================================================
--- komodo/SciViews-K-dev/components/svIUtils.idl 2011-03-28 17:49:13 UTC (rev 371)
+++ komodo/SciViews-K-dev/components/svIUtils.idl 2011-03-30 19:41:55 UTC (rev 372)
@@ -38,34 +38,34 @@
// This is implemented in sv.rconn's JavaScript code.
[scriptable, uuid(CA1BCF00-394D-11E0-BD69-0002A5D5C51B)]
interface svIStuffListener: nsISupports {
- wstring onStuff(in wstring data);
+ AUTF8String onStuff(in AUTF8String data);
};
[scriptable, uuid(22D0115A-0BC6-609F-194A-6F79EEA56633)]
interface svICommandInfo: nsISupports {
- readonly attribute string commandId;
- readonly attribute wstring command;
- readonly attribute string mode;
+ readonly attribute ACString commandId;
+ readonly attribute AUTF8String command;
+ readonly attribute ACString mode;
};
[scriptable, uuid(22A6C234-CC35-D374-2F01-FD4C605C905C)]
interface svIUtils : nsISupports {
nsISimpleEnumerator getproc(in string propertyName);
- wstring execInR(in wstring command, in string mode);
- void execInRBgr(in wstring command, in string mode, in string uid);
+ AUTF8String execInR(in AUTF8String command, in ACString mode, in double timeout);
+ void execInRBgr(in AUTF8String command, in ACString mode, in ACString uid);
PRInt32 startSocketServer(in svIStuffListener requestHandler);
void stopSocketServer();
- void setSocketInfo(in string host, in long port, in boolean outgoing);
- readonly attribute wstring lastCommand;
- readonly attribute wstring lastResult;
- attribute wstring id;
+ void setSocketInfo(in ACString host, in long port, in boolean outgoing);
+ readonly attribute AUTF8String lastCommand;
+ readonly attribute AUTF8String lastResult;
+ attribute ACString id;
boolean serverIsUp();
- wstring pushLeft(in wstring text, in string eol, in long indent, in long tabwidth);
+ wstring pushLeft(in AUTF8String text, in ACString eol, in long indent, in long tabwidth);
void escape();
- void calltip(in wstring text);
- void complete(in wstring text);
+ void calltip(in AUTF8String text);
+ void complete(in AUTF8String text);
};
//[scriptable, uuid(16F32A31-EA47-5079-2F26-D98DC068E776)]
Modified: komodo/SciViews-K-dev/components/svUtils.py
===================================================================
--- komodo/SciViews-K-dev/components/svUtils.py 2011-03-28 17:49:13 UTC (rev 371)
+++ komodo/SciViews-K-dev/components/svUtils.py 2011-03-30 19:41:55 UTC (rev 372)
@@ -122,8 +122,8 @@
ret = map(self._asSString, ret);
return SimpleEnumerator(ret)
- def execInR(self, command, mode):
- return self.rconnect(command, mode, False, .5, "")
+ def execInR(self, command, mode, timeout = .5):
+ return self.rconnect(command, mode, False, timeout, "")
def execInRBgr(self, command, mode, uid):
log.debug("execInRBgr: %s..." % command[0:10])
Modified: komodo/SciViews-K-dev/content/js/commands.js
===================================================================
--- komodo/SciViews-K-dev/content/js/commands.js 2011-03-28 17:49:13 UTC (rev 371)
+++ komodo/SciViews-K-dev/content/js/commands.js 2011-03-30 19:41:55 UTC (rev 372)
@@ -594,6 +594,9 @@
//'cmdset_rApp' commandset being grayed out
//at startup...
_this.updateRStatus(sv.rconn.testRAvailability(false));
+
+ if(sv.r.running) sv.rbrowser.smartRefresh(true);
+
}, 600);
_setKeybindings();
Modified: komodo/SciViews-K-dev/content/js/pref-R.js
===================================================================
--- komodo/SciViews-K-dev/content/js/pref-R.js 2011-03-28 17:49:13 UTC (rev 371)
+++ komodo/SciViews-K-dev/content/js/pref-R.js 2011-03-30 19:41:55 UTC (rev 372)
@@ -217,7 +217,6 @@
function OnPreferencePageLoading(prefset) {}
function OnPreferencePageOK(prefset) {
-
var outDec = document.getElementById('r.csv.dec').value;
var outSep = document.getElementById('r.csv.sep').value;
@@ -250,19 +249,6 @@
//sv.socket.setSocketType(clientType);
menuListGetValues();
-
- // Restart socket server if running and port changed
- //;var serverPort = document.getElementById('sciviews.ko.port').value;
- //XXX: Manual port setting is deprecated - it hardly ever works
-
- //if(sv.rconn.serverIsUp &&
- //serverPort != prefset.getLongPref("sciviews.ko.port")){ XXX
- //serverPort != sv.pref.getPref("sciviews.ko.port")) {
- //prefset.setStringPref("sciviews.ko.port", serverPort);
- //sv.socket.serverStart();
- //sv.socket.serverStart();
- //sv.rconn.restartSocketServer();
- //}
return true;
}
Modified: komodo/SciViews-K-dev/content/js/r.js
===================================================================
--- komodo/SciViews-K-dev/content/js/r.js 2011-03-28 17:49:13 UTC (rev 371)
+++ komodo/SciViews-K-dev/content/js/r.js 2011-03-30 19:41:55 UTC (rev 372)
@@ -936,43 +936,40 @@
}
// Select CRAN mirror, with optional callback
-sv.r.pkg.chooseCRANMirror = function (callback) {
+sv.r.pkg.chooseCRANMirror = function (setPref) {
var res = false;
-
var cmd = 'assignTemp("cranMirrors", getCRANmirrors(all = FALSE, local.only = FALSE));' +
'write.table(getTemp("cranMirrors")[, c("Name", "URL")], col.names = FALSE, quote = FALSE, sep ="' +
sv.r.sep + '", row.names = FALSE)';
- res = sv.r.evalCallback(cmd, function (repos) {
- var res = false;
+ var reposList = sv.rconn.evalAtOnce(cmd, 1);
- if (repos.trim() == "") {
- sv.alert("Error getting CRAN Mirrors list.");
- } else {
- repos = repos.split(/[\n\r]+/);
- var names = [], urls = [];
- for (i in repos) {
- var m = repos[i].split(sv.r.sep);
- names.push(m[0]);
- urls.push(m[1]);
- }
- items = ko.dialogs.selectFromList(sv.translate("CRAN mirrors"),
- sv.translate("Select CRAN mirror to use:"), names, "one");
+ if (!reposList.trim()) {
+ sv.alert("Error getting CRAN Mirrors list.");
+ return '';
+ }
- repos = urls[names.indexOf(items[0])].replace(/\/$/, "");
- ko.statusBar.AddMessage(sv.translate("Current CRAN mirror is set to %S",
- repos), "SciViews-K", 5000, false);
+ var reposList = reposList.split(/[\n\r]+/);
+ var names = [], urls = [];
+ for (i in reposList) {
+ var m = reposList[i].split(sv.r.sep);
+ names.push(m[0]);
+ urls.push(m[1]);
+ }
- sv.r.eval('with(TempEnv(), {repos <- getOption("repos");' +
- 'repos["CRAN"] <- "' + repos + '"; ' + 'options(repos = repos)})');
- cran = sv.pref.setPref("CRANMirror", repos);
- if (callback) callback(repos);
- }
- return(res);
- });
- ko.statusBar.AddMessage(sv.translate(
- "Retrieving CRAN mirrors list... please wait."), "SciViews-K", 20000, true);
- return(res);
+ var items = ko.dialogs.selectFromList(sv.translate("CRAN mirrors"),
+ sv.translate("Select CRAN mirror to use:"), names, "one");
+
+ if(!items) return null;
+
+ repos = urls[names.indexOf(items[0])].replace(/\/$/, "");
+
+ cmd = 'with(TempEnv(), {repos <- getOption("repos");' +
+ 'repos["CRAN"] <- "' + repos + '"; ' + 'options(repos = repos)})';
+ sv.rconn.eval(cmd, null, true);
+ if (setPref) sv.pref.setPref("CRANMirror", repos);
+
+ return(repos);
}
// List available packages on the selected repositories
@@ -980,8 +977,8 @@
var res = sv.r.eval('.pkgAvailable <- available.packages()\n' +
'as.character(.pkgAvailable[, "Package"])');
ko.statusBar.AddMessage(sv.translate(
- "Looking for available R packages... please wait"),
- "SciViews-K", 5000, true);
+ "Looking for available R packages... please wait"),
+ "SciViews-K", 5000, true);
return(res);
}
@@ -1154,50 +1151,32 @@
// sv.r.pkg.install("sciviews", "http://r.meteo.uni.wroc.pl") // use different CRAN mirror
sv.r.pkg.install = function (pkgs, repos) {
- // Just in case, to prevent infinite callbacks but such should never happen
- var allowCCM = arguments.length < 3;
+ var reset = false;
+ if (repos === true) {
+ reset = true;
+ repos = undefined;
+ }
- var res = false;
- var reset = (repos === true);
-
- var defaultRepos = sv.pref.getPref("CRANMirror");
- if (defaultRepos == "None") defaultRepos = "";
- //defaultRepos = "http://cran.r-project.org/";
-
- function _installCallback() {
- sv.r.pkg.install(pkgs, defaultRepos, true);
- };
-
- if (!repos && defaultRepos) {
- repos = defaultRepos;
- } else if (reset && allowCCM) {
- res = sv.r.pkg.chooseCRANMirror(_installCallback);
- return;
- } else if (!repos && allowCCM) {
- res = sv.r.evalCallback("cat(getOption(\"repos\")[\"CRAN\"])",
- function(cran) {
- var res = false;
- cran = cran.trim();
- if (cran == "@CRAN@") {
- res = sv.r.pkg.chooseCRANMirror(_installCallback);
- } else {
- sv.pref.setPref("CRANMirror", cran);
- res = sv.r.pkg.install(pkgs, cran, true);
- }
- return;
- }
- );
- return;
+ if (repos === undefined) {
+ var defaultRepos = sv.pref.getPref("CRANMirror");
+ if (reset || !defaultRepos || defaultRepos == "None") {
+ repos = sv.r.pkg.chooseCRANMirror();
+ if (!repos) return;
+ } else
+ repos = defaultRepos;
+ } else if (repos === false) {
+ repos = sv.rconn.evalAtOnce("cat(getOption(\"repos\")[\"CRAN\"])").trim();
+ if (repos == "@CRAN@") return;
}
// At this point repos should be always set
sv.cmdout.append(sv.translate("Using repository at %S", repos));
-
repos = repos.toLowerCase();
var startDir = null;
- if (typeof pkgs == "string" &&
- sv.tools.file.exists(pkgs) == sv.tools.file.TYPE_DIRECTORY) {
+
+ // TODO: allow for array of package files
+ if (typeof(pkgs) == "string" && sv.tools.file.exists(pkgs) == sv.tools.file.TYPE_DIRECTORY) {
repos = "local";
startDir = pkgs;
}
@@ -1206,27 +1185,22 @@
if (!pkgs && repos != "local") {
ko.statusBar.AddMessage(sv.translate("Listing available packages..."),
"SciViews-K", 5000, true);
- res = sv.r.evalCallback('cat(available.packages(contriburl=contrib.url("'
- + repos + '", getOption("pkgType")))[,1], sep="' +
- sv.r.sep + '")', function (pkgs) {
- ko.statusBar.AddMessage("", "SciViews-K");
+ pkgs = sv.rconn.evalAtOnce('cat(tryCatch(available.packages(contriburl=contrib.url("'
+ + repos + '", getOption("pkgType")))[,1],warning=function(e)e$message), sep="' +
+ sv.r.sep + '")', 5).trim();
- var res = false;
- if (pkgs.trim() != "") {
- pkgs = pkgs.split(sv.r.sep);
- // Case insensitive sorting:
- pkgs.sort(function(a,b) a.toUpperCase() > b.toUpperCase());
+ pkgs = pkgs.split(sv.r.sep);
+ if (pkgs.length < 3) {
+ ko.dialogs.alert('Listing available packages, R said:', pkgs.join(''), 'SciViews-K');
+ return;
+ }
+ // Case insensitive sorting:
+ pkgs.sort(function(a,b) a.toUpperCase() > b.toUpperCase());
- pkgs = ko.dialogs.selectFromList(
- sv.translate("Install R package"),
- sv.translate("Select package(s) to install") + ":", pkgs);
-
- if (pkgs != null) {
- res = sv.r.pkg.install(pkgs, repos, true);
- }
- }
- });
- return;
+ pkgs = ko.dialogs.selectFromList(
+ sv.translate("Install R package"),
+ sv.translate("Select package(s) to install") + ":", pkgs);
+ if (pkgs == null) return;
}
// Expand short names
Modified: komodo/SciViews-K-dev/content/js/rconnection.js
===================================================================
--- komodo/SciViews-K-dev/content/js/rconnection.js 2011-03-28 17:49:13 UTC (rev 371)
+++ komodo/SciViews-K-dev/content/js/rconnection.js 2011-03-30 19:41:55 UTC (rev 372)
@@ -99,7 +99,10 @@
}
// Evaluate in R quickly - and return result
-this.evalAtOnce = function(command) _svuSvc.execInR(command, "h");
+this.evalAtOnce = function(command, timeout) {
+ if(timeout == undefined) timeout = .5;
+ return _svuSvc.execInR(command, "h", timeout);
+}
this.escape = function(command) _svuSvc.escape(command);
Modified: komodo/SciViews-K-dev/content/js/robjects.js
===================================================================
--- komodo/SciViews-K-dev/content/js/robjects.js 2011-03-28 17:49:13 UTC (rev 371)
+++ komodo/SciViews-K-dev/content/js/robjects.js 2011-03-30 19:41:55 UTC (rev 372)
@@ -52,7 +52,7 @@
// _getFilter()
// _addVItems(item, parentIndex, level, parentUid)
// _addVIChildren(vItem, parentIndex, isOpen)
-// _getVItem(obj, index, level, first, last, parentIndex, parentUid)
+// _getVItem(obj, index, level, first, last, parentIndex)
//
///// Private properties
// iconTypes - icons to display
@@ -182,13 +182,8 @@
if (!isInitialized) return;
var rowsBefore;
- //var visDataLen = _this.visibleData.length;
-
- //if(!_this.treeBox) {
rowsBefore = _this.visibleData.length;
- //} else {
- // rowsBefore = _this.treeBox.view.rowCount;
- //}
+
var firstVisibleRow = _this.treeBox? _this.treeBox.getFirstVisibleRow() : 0;
_this.visibleData = [];
@@ -305,7 +300,7 @@
return null;
}
-// New method (will replace _parseObjectList & _parseSubObjectList)
+// Below replaces _parseObjectList & _parseSubObjectList
this.parseObjListResult = function _parseObjListResult (data, rebuild) {
var closedPackages = {};
var currentPackages = _this.treeData.map(function(x) {
@@ -325,10 +320,8 @@
if (lines[i].indexOf("Env=") == 0) {
envName = lines[i].substr(4).trim();
if(lines[i + 1].indexOf("Obj=") != 0)
- throw new Error("Expected 'Obj=' after 'Env='");
+ throw new Error("Expected 'Obj=' after 'Env='");
objName = lines[i + 1].substr(4).trim();
- //if (branch && branch.fullName == objName) treeBranch = branch;
- //else
treeBranch = _this.getRObjTreeLeafByName(objName, envName);
if(!treeBranch && !objName) { // This is environment
treeBranch = new RObjectLeaf(envName, false);
@@ -337,11 +330,15 @@
lastAddedRootElement = treeBranch;
}
if(treeBranch) {
+ var isEmpty = (lines[i+2].indexOf('Env') == 0)
+ || (lines.length == i + 3);
if(!objName) {
if(closedPackages[envName])
treeBranch.isOpen = false;
- } else
+ } else {
treeBranch.isOpen = true;
+ }
+ //treeBranch.children = isEmpty? undefined : [];
treeBranch.children = [];
treeBranch.childrenLoaded = true;
}
@@ -350,6 +347,9 @@
}
if(!treeBranch) continue; // this object is missing, skip all children
if(i >= lines.length) break;
+ if(lines[i].indexOf('Env') == 0) {
+ i--; continue;
+ }
try {
var leaf = new RObjectLeaf(envName, true, lines[i].split(sep), i, treeBranch);
treeBranch.children.push(leaf);
@@ -372,7 +372,7 @@
var vd = this.visibleData;
var ret = [];
for (var i in vd) {
- if(this.isContainerOpen(i)) {
+ if(_this.isContainerOpen(i)) {
var oi = vd[i].origItem;
var env = oi.env || oi.fullName;
var objName = oi.type == "environment"? "" : oi.fullName;
@@ -393,8 +393,9 @@
this._getObjListCommand = _getObjListCommand; // XXX
this.smartRefresh = function(force) {
- function __toUnique(a, j) { if(a.indexOf(j)==-1) a.push(j); return(a)};
+ _this.getPackageList();
+
var cmd, data, init;
init = force || !_this.treeData.length || !_this.treeBox;
@@ -404,12 +405,13 @@
} else {
var cmd1 = this.getOpenItems(true);
var cmd2 = this.treeData.map(function(x) _getObjListCommand(x.fullName,""));
- cmd = cmd1.concat(cmd2).reduce(__toUnique, []).join("\n");
+ cmd = sv.tools.array.unique(cmd1.concat(cmd2)).join("\n");
}
isInitialized = true;
if (init) document.getElementById("sciviews_robjects_objects_tree").view = this;
+ //print(cmd);
sv.rconn.eval(cmd, this.parseObjListResult, true);
//this.parseObjListResult(data);
/////if (init) this.treeBox.scrollToRow(0);
@@ -457,48 +459,35 @@
this.filter = function (x) true;
-function _addVItems (item, parentIndex, level, parentUid) {
- if (typeof(item) == "undefined") return(parentIndex);
- if (typeof(level) == "undefined") level = -1;
- if (!parentUid) parentUid = "";
+function _addVItems (item, parentIndex, level) {
+ if (item === undefined) return(parentIndex);
+ if (level === undefined) level = -1;
if (!parentIndex) parentIndex = 0;
var idx = parentIndex;
var len = item.length;
- var conditionalView;
+ //print("_addVItems = " + item);
+
for (var i = 0; i < len; i++) {
//item[i].class != "package" &&
if (level == 1 && !_this.filter(item[i].sortData[filterBy])) {
item[i].index = -1;
continue;
- // Set conditionalView = true if any child nodes pass fitering
- //conditionalView = true;
- } else {
- //conditionalView = false;
}
idx++;
- var vItem = _getVItem(item[i], idx, level,
- i == 0, i == len - 1,
- parentIndex, parentUid);
+ var vItem = _getVItem(item[i], idx, level, i == 0, i == len - 1,
+ parentIndex);
_this.visibleData[idx] = vItem;
if (vItem.isContainer && vItem.isOpen && vItem.childrenLength > 0) {
var idxBefore = idx;
- idx = _addVItems(item[i].children, idx, level + 1,
- vItem.uid + "»");
+ idx = _addVItems(item[i].children, idx, level + 1);
// No children is visible
if (idxBefore == idx) {
vItem.isContainerEmpty = true;
- // if this item was to be viewed on condition any children
- // is visible, remove this item:
- /*if (conditionalView) {
- this.visibleData.pop();
- idx--;
- }*/
}
- //sv.log.debug(idx + "<-" + idxBefore);
}
}
return(idx);
@@ -520,13 +509,12 @@
vItem.children.push(_getVItem(children[i], idx, vItem.level + 1,
i == 0, i == len - 1,
// Closed subtree elements have 0-based parentIndex
- isOpen ? parentIndex : 0,
- vItem.uid + "»"));
+ isOpen ? parentIndex : 0));
}
vItem.isContainerEmpty = vItem.children.length == 0;
};
-function _getVItem (obj, index, level, first, last, parentIndex, parentUid) {
+function _getVItem (obj, index, level, first, last, parentIndex) {
var vItem = {};
if (obj.group == "list" || obj.group == "function" || obj.list) {
@@ -543,7 +531,6 @@
vItem.isList = false;
}
vItem.isOpen = (typeof(obj.isOpen) != "undefined") && obj.isOpen;
- vItem.uid = parentUid + obj.name;
vItem.parentIndex = parentIndex;
vItem.level = level;
vItem.first = first;
@@ -554,7 +541,6 @@
return(vItem);
};
-
//function _VisibleTreeItem (oi, index, parentIndex) {
// this.isList = (oi.group == "list") || (oi.group == "function")
// || (oi.list);
@@ -718,17 +704,18 @@
if (!item) return;
_this.selection.select(idx);
- if (item.isList && !item.origItem.isOpen &&
- !item.origItem.childrenLoaded) {
- //_addObject(item.origItem.env, item.origItem.fullName,
- // _parseSubObjectList, item);
+ if (item.isList && !item.origItem.isOpen && !item.origItem.childrenLoaded) {
_addObject(item.origItem.env, item.origItem.fullName,
this.parseObjListResult);
return;
}
var rowsChanged;
var iLevel = item.level;
- if (!item.childrenLength) return;
+ //print("childrenLength = " + item.childrenLength);
+ if (!item.childrenLength) {
+ item.isContainer = item.origItem.isOpen = false;
+ return;
+ }
if (item.origItem.isOpen) { // Closing subtree
@@ -749,7 +736,7 @@
}
} else { // Opening subtree
if (typeof(item.children) == "undefined")
- _addVIChildren(item, idx, false);
+ _addVIChildren(item, idx, false);
// Filter child items
var insertItems = [];
@@ -908,6 +895,39 @@
_this.displayPackageList(false);
};
+// Display the list of packages in the search path
+this.displayPackageList = function() {
+ var pack;
+ var node = document.getElementById("sciviews_robjects_searchpath_listbox");
+ var selectedLabel = node.selectedItem? node.selectedItem.label : null;
+
+ while(node.firstChild) node.removeChild(node.firstChild);
+ var packs = _this.searchPath;
+ var selectedPackages = _this.treeData.map(function(x) x.name);
+
+
+ for(var i = 0; i < packs.length; i++) {
+ pack = packs[i];
+ var item = document.createElement("listitem");
+ item.setAttribute("type", "checkbox");
+ item.setAttribute("label", pack);
+ item.setAttribute("checked", selectedPackages.indexOf(pack) != -1);
+ node.appendChild(item);
+ }
+
+ if (selectedLabel != null) {
+ for(var i = 0; i < node.itemCount; i++) {
+ if (node.getItemAtIndex(i).label == selectedLabel) {
+ node.selectedIndex = i;
+ break;
+ }
+ }
+ } else {
+ node.selectedIndex = 0;
+ }
+
+};
+
// Clear the list of packages on the search path (when quitting R)
this.clearPackageList = function () {
_this.searchPath = [];
@@ -936,28 +956,6 @@
}
}
-// Display the list of packages in the search path
-this.displayPackageList = function (refreshObjects) {
- // refreshObjects is made optional and is true in this case
- if (refreshObjects === undefined) refreshObjects = true;
- var pack;
- var node = document.getElementById("sciviews_robjects_searchpath_listbox");
- while(node.firstChild) node.removeChild(node.firstChild);
- var packs = _this.searchPath;
- var selectedPackages = _this.treeData.map(function(x) x.name);
-
- for(var i = 0; i < packs.length; i++) {
- pack = packs[i];
- var item = document.createElement("listitem");
- item.setAttribute("type", "checkbox");
- item.setAttribute("label", pack);
- item.setAttribute("checked", selectedPackages.indexOf(pack) != -1);
- node.appendChild(item);
- }
-
- if (refreshObjects) _this.refreshAll();
-};
-
// Change the display status of a package by clicking an item in the list
this.packageSelectedEvent = function (event) {
var el = event.target;
@@ -1420,14 +1418,14 @@
this.packageListObserver = {
onDrop : function (event, transferData, session) {
var data = transferData;
- sv.log.debug("dropped object was " +
- transferData.flavour.contentType);
+ sv.log.debug("dropped object was " + transferData.flavour.contentType);
var path;
if (transferData.flavour.contentType == "application/x-moz-file") {
path = transferData.data.path;
} else if (transferData.flavour.contentType == "text/unicode") {
path = new String(transferData.data).trim();
}
+
// Attach the file if it is an R workspace
if (path.search(/\.RData$/i) > 0) {
//sv.alert("will attach: " + path);
@@ -1439,7 +1437,7 @@
path = path.replace(/^package:/, "");
sv.r.evalCallback("tryCatch(library(\"" + path +
- "\"), error = function(e) {cat(\"<error>\"); message(e)})",
+ "\"), error = function(e) {cat(\"<error>\"); message(e)})",
function (message) {
if (message.indexOf('<error>') > -1) {
message = message.replace('<error>', '');
Modified: komodo/SciViews-K-dev/content/js/sciviews.js
===================================================================
--- komodo/SciViews-K-dev/content/js/sciviews.js 2011-03-28 17:49:13 UTC (rev 371)
+++ komodo/SciViews-K-dev/content/js/sciviews.js 2011-03-30 19:41:55 UTC (rev 372)
@@ -209,7 +209,9 @@
// function declaration pattern:
var funcRegExStr = "\\S+\\s*(<-|=)\\s*function\\s*\\(";
+ //var funcRegExStr = "\\b(([`'\\\"])(.+)\\2|([\w\u0100-\uFFFF\\.]+))\\s*(<-|=)\\s*function\\s*\\(";
+
var findSvc = Components.classes['@activestate.com/koFindService;1']
.getService(Components.interfaces.koIFindService);
Modified: komodo/SciViews-K-dev/content/overlayMain.xul
===================================================================
--- komodo/SciViews-K-dev/content/overlayMain.xul 2011-03-28 17:49:13 UTC (rev 371)
+++ komodo/SciViews-K-dev/content/overlayMain.xul 2011-03-30 19:41:55 UTC (rev 372)
@@ -106,6 +106,7 @@
<command id="cmd_svSessionMgr" key="key_cmd_svSessionMgr"
oncommand="ko.commands.doCommand('cmd_svSessionMgr');"
desc="R: &svOpenSessMgr;" label="&svOpenSessMgr;" accesskey="&svOpenSessMgr.key;"/>
+
</commandset>
<!-- event names changed in Komodo 6: keeping the old one for compatibility
@@ -183,14 +184,38 @@
class="menuitem-iconic r-run-command-icon"/>
<menuitem id="r_quit_console_menu" observes="cmd_svQuitR"
class="menuitem-iconic r-quit-command-icon"/>
- <menuitem id="r_start_pkg_manager" observes="cmd_svOpenPkgManager"
- class="menuitem-iconic r-pkg-manager"/>
<menuitem id="r_start_help" observes="cmd_svOpenHelp"
class="menuitem-iconic help-icon"/>
<menuitem id="r_browse_wd" observes="cmd_svBrowseWD"
class="menuitem-iconic r-working-dir-icon"/>
<menuitem id="r_session_mgr" observes="cmd_svSessionMgr"
class="menuitem-iconic r-session-dir-icon"/>
+ <menuseparator/>
+ <menuitem id="r_start_pkg_manager" observes="cmd_svOpenPkgManager"
+ class="menuitem-iconic r-pkg-manager"/>
+ <menu class="menuitem-iconic robjects-pkg-icon"
+ label="R packages">
+ <menupopup>
+ <menuitem id="r_pkg_load" label="Load packages..."
+ accesskey="l" class="menuitem-iconic r-pkg-load-icon"
+ oncommand="sv.r.pkg.load();"/>
+ <menuitem id="r_pkg_load" label="Attach workspace..."
+ accesskey="a" class="menuitem-iconic r-data-attach"
+ oncommand="sv.r.loadWorkspace(null, true);"/>
+ <menuitem id="r_pkg_install" label="Install..."
+ accesskey="i" class="menuitem-iconic r-pkg-install-icon"
+ oncommand="sv.r.pkg.install();"/>
+ <menuitem id="r_pkg_installLocal" label="Install from local files..."
+ accesskey="c" class="menuitem-iconic r-pkg-install-local-icon"
+ oncommand="sv.r.pkg.install(null, 'local');"/>
+ <menuitem id="r_pkg_update" label="Update"
+ accesskey="u" class="menuitem-iconic r-pkg-update-icon"
+ oncommand="sv.r.pkg.update();"/>
+ <menuitem id="r_pkg_remove" label="Remove..."
+ accesskey="r" class="menuitem-iconic r-pkg-remove-icon"
+ oncommand="sv.r.pkg.remove();"/>
+ </menupopup>
+ </menu>
<menuseparator/>
<menuitem id="r_send_line_sel_menu" observes="cmd_svRRunLineOrSelection"
Modified: komodo/SciViews-K-dev/content/pref-R.xul
===================================================================
--- komodo/SciViews-K-dev/content/pref-R.xul 2011-03-28 17:49:13 UTC (rev 371)
+++ komodo/SciViews-K-dev/content/pref-R.xul 2011-03-30 19:41:55 UTC (rev 372)
@@ -16,6 +16,7 @@
Contributor(s):
Philippe Grosjean
+ Kamil Barton
ActiveState Software Inc (code inspired from)
Alternatively, the contents of this file may be used under the terms of
@@ -63,7 +64,7 @@
<vbox id="no-avail-interps-message" flex="1" align="center">
<description style="font-weight: bold;">
No R installation was found on your system. If you would like to debug
- and run Ruby programs in Komodo you will need to install Ruby. You can
+ and run R code in Komodo you will need to install R. You can
get R from the CRAN website at
</description>
<button label="http://cran.r-project.org/"
@@ -108,7 +109,7 @@
<label class="label" control="R_command" crop="end"
value="This command will be used to start R (R -> Start R):"/>
<textbox id="R_command" value="" class="plain"
- style="background: none; padding-top: 1px !important; margin-left: 10px !important; color: rgb(184, 38, 25);" />
+ style="background: none; padding-top: 1px !important; margin-left: 10px !important;" />
</vbox>
</groupbox>
Modified: komodo/SciViews-K-dev/defaults/.Rprofile
===================================================================
--- komodo/SciViews-K-dev/defaults/.Rprofile 2011-03-28 17:49:13 UTC (rev 371)
+++ komodo/SciViews-K-dev/defaults/.Rprofile 2011-03-30 19:41:55 UTC (rev 372)
@@ -1,2 +1,2 @@
source("svStart.R")
-svStart()
\ No newline at end of file
+svStart()
Modified: komodo/SciViews-K-dev/defaults/svMisc_0.9-61.tar.gz
===================================================================
(Binary files differ)
Modified: komodo/SciViews-K-dev/defaults/svSocket_0.9-48.tar.gz
===================================================================
(Binary files differ)
More information about the Sciviews-commits
mailing list