[Sciviews-commits] r105 - komodo/SciViews-K/content/js pkg/svMisc/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jan 28 14:52:58 CET 2009
Author: prezez
Date: 2009-01-28 14:52:57 +0100 (Wed, 28 Jan 2009)
New Revision: 105
Modified:
komodo/SciViews-K/content/js/robjects.js
pkg/svMisc/R/objList.R
Log:
object browser modified to work with updated objList.
Modified: komodo/SciViews-K/content/js/robjects.js
===================================================================
--- komodo/SciViews-K/content/js/robjects.js 2009-01-23 18:32:26 UTC (rev 104)
+++ komodo/SciViews-K/content/js/robjects.js 2009-01-28 13:52:57 UTC (rev 105)
@@ -3,10 +3,11 @@
//TODO: quoting non-syntactic sub-names inserted into text
//TODO: preserve opened sub-objects on refresh
//TODO: context menu for search-paths list
-//TODO: "remove" command: Shift + Command - removes immediatelly (confirmation box first), Command - adds R code to the current document
//TODO: renaming objects on the list - editable names
+//"remove" command: Shift + Command - removes immediatelly (confirmation box first), Command - adds R code to the current document
+
//sv.r.objects = rObjectsTree;
/*
@@ -102,9 +103,9 @@
*/
-
var rObjectsTree = {
debug: false,
+ //debug: true,
visibleData : [],
treeData: [],
isInitialized: false,
@@ -227,9 +228,15 @@
_parseObjectList: function(data, tv) {
// when used as a callback, this = window, have to use rObjectsTree instead
- if (data == "") { return; } //no changes
+ if (data == "" || (data.trim() == "An empty objects list") )
+ return; //no changes
+
var lines = data.split(/\r?\n/);
+ // get rid of the "Objects list:" line
+ if (lines[0].indexOf("Objects list:") != -1)
+ lines.shift()
+
var item, line, pack, idx;
var sep = ';';
var packIdx = [], packAdded = [];
@@ -363,18 +370,21 @@
var lines = data.split(/\r?\n/);
- if (data == "" || lines.length < 3) {
+ if (data == "" || (data.trim() == "An empty objects list") || lines.length < 4) {
obj.isContainer = false;
rObjectsTree.treeBox.invalidateRow(obj.origItem.index);
return;
}
+ // get rid of the "Objects list:" line
+ if (lines[0].indexOf("Objects list:") != -1)
+ lines.shift()
- var env = lines[0].substr(lines[0].lastIndexOf("=") + 1).rtrim(); // Environment
- var treeParent = lines[1].substr(lines[1].lastIndexOf("=") + 1).rtrim(); // parent object
+ var env = lines[0].substr(lines[0].lastIndexOf("=") + 1).trim(); // Environment - 1st line
+ var treeParent = lines[1].substr(lines[1].lastIndexOf("=") + 1).trim(); // parent object - 2ng line
var vd = rObjectsTree.visibleData;
- if (!obj) {
+ if (!obj) { // reloading sub-lists without passing parent tree item - not used yet
if (treeParent) {
// TODO: smarter way to do it than searching through all items
for (var i = 0; i < vd.length; i++) {
Modified: pkg/svMisc/R/objList.R
===================================================================
--- pkg/svMisc/R/objList.R 2009-01-23 18:32:26 UTC (rev 104)
+++ pkg/svMisc/R/objList.R 2009-01-28 13:52:57 UTC (rev 105)
@@ -111,7 +111,7 @@
assignTemp(".guiObjListCache", allList)
}
}
-
+
# Create the 'objList' object
attr(res, "all.info") <- all.info
attr(res, "envir") <- ename
@@ -151,15 +151,20 @@
if (!inherits(x, "objList"))
stop("x must be an 'objList' object")
if (NROW(x) > 0) {
+
+
cat("Objects list:\n")
if (header) {
- cat("\tEnvironment = ", attr(x, "envir"), "\n", sep = "")
- cat("\tObject = ", if (is.null(attr(x, "object"))) "" else
- attr(x, "object"), "\n", sep = "")
+ header.sep <- if (is.na(sep)) " = " else "="
+
+ cat("Environment", attr(x, "envir"), sep = header.sep)
+ cat("\n")
+ cat("Object", if (is.null(attr(x, "object"))) "" else
+ attr(x, "object"), sep = header.sep)
+ cat("\n")
}
if (is.na(sep)) {
- cat("\n")
print(as.data.frame(x))
} else if (!is.null(nrow(x)) && nrow(x) > 0) {
write.table(x, row.names = FALSE, col.names = FALSE, sep = sep,
More information about the Sciviews-commits
mailing list