[Sciviews-commits] r370 - in komodo/SciViews-K-dev: . content content/js defaults

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 28 00:05:50 CEST 2011


Author: prezez
Date: 2011-03-28 00:05:49 +0200 (Mon, 28 Mar 2011)
New Revision: 370

Modified:
   komodo/SciViews-K-dev/content/js/pref-R.js
   komodo/SciViews-K-dev/content/pref-R.xul
   komodo/SciViews-K-dev/defaults/svStart.R
   komodo/SciViews-K-dev/install.rdf
Log:
Preferences: more changes
svStart.R: now properly loads .RData into .GlobalEnv

Modified: komodo/SciViews-K-dev/content/js/pref-R.js
===================================================================
--- komodo/SciViews-K-dev/content/js/pref-R.js	2011-03-27 21:16:30 UTC (rev 369)
+++ komodo/SciViews-K-dev/content/js/pref-R.js	2011-03-27 22:05:49 UTC (rev 370)
@@ -64,7 +64,11 @@
 			for (var k = 0; k < el.itemCount; k++) {
 				values.push(escape(el.getItemAtIndex(k).value));
 			}
-			el.setAttribute(attribute, values.join(" "));
+
+			values = sv.tools.array.unique(values);
+			var nMax = parseInt(el.getAttribute('maxValues'));
+			if(nMax > 0) values = values.slice(0, nMax);
+			el.setAttribute(attribute, values.join(' '));
 		}
 	}
 }
@@ -107,11 +111,10 @@
 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-gui", "R GUI","\"%Path%\" --sdi %args%", "Rgui.exe", "Rgui", "Win"),
 new _App("r-tk", "R Tk GUI", "\"%Path%\" --interactive --gui:Tk %args%", "R", "R", "Lin,Mac")
 ];
 
-
 function PrefR_OnLoad() {
 	// Get the sv object:
 	var p = parent;
@@ -124,15 +127,15 @@
 
     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)
-						   )
-					   );
+					   && (!x.required.length || x.required.every(
+						function(y) sv.tools.file.whereIs(y).length != 0)));
+	var tmp = {};
+	for (var i in apps) tmp[apps[i].id] = apps[i];
+	apps = tmp;
 
     var menu = document.getElementById("svRApplication");
     menu.removeAllItems();
-    for (var i in apps) menu.appendItem(apps[i].label, i, null);
+    for (var i in apps) menu.appendItem(apps[i].name, i, null);
 
     // update cran mirror list (first local, then tries remote at CRAN)
 	if (!PrefR_UpdateCranMirrors(true)) PrefR_UpdateCranMirrors(false);
@@ -161,18 +164,18 @@
     ////////////////////////////////////
     switch (os.name) { //'posix', 'nt', 'mac', 'os2', 'ce', 'java', 'riscos'.
         case "nt":
-        rs = rs.concat(sv.tools.file.whereIs("Rgui"));
-        rs = rs.concat(sv.tools.file.whereIs("R"));
-		rs.sort(); rs.reverse();
-        break;
+			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?:
-        rs = ["/Applications/R.app", "/Applications/R64.app"];
-        // What about "SciViews R*.app" ???
-        break;
+			//FIXME: as I understand there are only 2 options on Mac, is it right?:
+			rs = ["/Applications/R.app", "/Applications/R64.app"];
+			// What about "SciViews R*.app" ???
+			break;
         case "posix":
         default:
-        rs = rs.concat(sv.tools.file.whereIs("R"));
+			rs = rs.concat(sv.tools.file.whereIs("R"));
     }
     rs.unshift(prefExecutable);
 
@@ -199,8 +202,7 @@
     }
 }
 
-function OnPreferencePageLoading(prefset) {
-}
+function OnPreferencePageLoading(prefset) {}
 
 function OnPreferencePageOK(prefset) {
 
@@ -249,7 +251,7 @@
 		//sv.socket.serverStart();
 		//sv.rconn.restartSocketServer();
 	//}
-	return(true);
+	return true;
 }
 
 function svRDefaultInterpreterOnSelect(event) {
@@ -276,14 +278,13 @@
     PrefR_updateCommandLine(true);
 }
 
-//TODO: rename to PrefR_svRApplicationUpdate
 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 sel = menuApplication.selectedItem;
 
 	var os = Components.classes['@activestate.com/koOs;1']
 		.getService(Components.interfaces.koIOs);
@@ -318,7 +319,7 @@
 		args1 += " --svStartPkgs=SciViews,MASS,ellipse";
 
    	var cwd = sv.tools.file.path("ProfD", "extensions",
-    "sciviewsk at sciviews.org", "defaults");
+		"sciviewsk at sciviews.org", "defaults");
 
 	cmdArgs = cmdArgs.replace(/\s*--[sm]di\b/, "");
 
@@ -363,8 +364,6 @@
 
     editMenulist(menu, path);
     menu.value = path;
-
-
 }
 
 // Get CRAN mirrors list - independently of R
@@ -455,7 +454,7 @@
         menuList.appendItem(arrData[i][0], arrData[i][1], arrData[i][1]);
 	}
 	menuList.value = value;
-	return(true);
+	return true;
 }
 
 // From: http://www.bennadel.com/index.cfm?dax=blog:1504.view

Modified: komodo/SciViews-K-dev/content/pref-R.xul
===================================================================
--- komodo/SciViews-K-dev/content/pref-R.xul	2011-03-27 21:16:30 UTC (rev 369)
+++ komodo/SciViews-K-dev/content/pref-R.xul	2011-03-27 22:05:49 UTC (rev 370)
@@ -75,7 +75,7 @@
 			<label class="label" control="svRApplication" value="Preferred way to run R:"/>
 				<menulist
 				id="svRApplication" oncommand="PrefR_svRApplicationOnSelect(event);"
-				pref="true" />
+				pref="true" editable="false" />
 
 		</hbox>
 		<label value="Use this application:" control="svRDefaultInterpreter" />
@@ -122,14 +122,14 @@
 				<row align="center">
 					<label value="Decimal separator" control="r.csv.dec"/>
 						<menulist pref="true" id="r.csv.dec"
-						values=", ." persist="values">
+						values=", ." persist="values" maxValues="3">
 						<menupopup />
 					</menulist>
 					<label value="CSV field separator" control="r.csv.sep" />
 						<menulist pref="true" id="r.csv.sep" editable="true"
 						onkeyup="if (event.keyCode == 13) editMenulist(this);"
 						onblur="editMenulist(this);"
-						values=", ; \t" persist="values">
+						values=", ; \t" persist="values" maxValues="5">
 						<menupopup />
 					</menulist>
 				</row>
@@ -195,7 +195,7 @@
 		<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">
+		   values="socket http" persist="" editable="false" disabled="true">
 		   <menupopup />
 		  </menulist>
 		</hbox>

Modified: komodo/SciViews-K-dev/defaults/svStart.R
===================================================================
--- komodo/SciViews-K-dev/defaults/svStart.R	2011-03-27 21:16:30 UTC (rev 369)
+++ komodo/SciViews-K-dev/defaults/svStart.R	2011-03-27 22:05:49 UTC (rev 370)
@@ -561,7 +561,7 @@
 		if (!"--vanilla" %in% args && !"--no-restore" %in% args &&
 			!"--no.restore-data" %in% args) {
 				if (file.exists(".RData")) {
-					load(".RData")
+					load(".RData", envir = .GlobalEnv)
 					msg2 <- append(msg2, "data loaded")
 				} else {
 					msg2 <- append(msg2, "no data")

Modified: komodo/SciViews-K-dev/install.rdf
===================================================================
--- komodo/SciViews-K-dev/install.rdf	2011-03-27 21:16:30 UTC (rev 369)
+++ komodo/SciViews-K-dev/install.rdf	2011-03-27 22:05:49 UTC (rev 370)
@@ -4,7 +4,7 @@
     <Description about="urn:mozilla:install-manifest">
         <em:id>sciviewsk at sciviews.org</em:id>
         <em:name>SciViews-K</em:name>
-        <em:version>0.10.2dev</em:version>
+        <em:version>0.10.4dev</em:version>
         <em:description>Edit R (http://www.r-project.org) code with Komodo</em:description>
         <em:creator>Philippe Grosjean</em:creator>
         <em:contributor>Romain Francois</em:contributor>



More information about the Sciviews-commits mailing list