[Sciviews-commits] r252 - komodo/SciViews-K komodo/SciViews-K/content komodo/SciViews-K/content/js komodo/SciViews-K/defaults pkg/tcltk2 pkg/tcltk2/R pkg/tcltk2/win/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Mar 18 16:06:27 CET 2010
Author: phgrosjean
Date: 2010-03-18 16:06:27 +0100 (Thu, 18 Mar 2010)
New Revision: 252
Added:
komodo/SciViews-K/content/js/ask.js
komodo/SciViews-K/defaults/R reference (0.9.12).kpz
komodo/SciViews-K/defaults/SciViews-K (0.9.12).kpz
komodo/SciViews-K/defaults/SciViews_0.9-1.tar.gz
komodo/SciViews-K/defaults/SciViews_0.9-1.zip
komodo/SciViews-K/defaults/ellipse_0.3-5.tar.gz
komodo/SciViews-K/defaults/ellipse_0.3-5.zip
komodo/SciViews-K/sciviewsk-0.9.11-ko.xpi
komodo/SciViews-K/sciviewsk-0.9.12-ko.xpi
Removed:
komodo/SciViews-K/defaults/R reference.kpz
komodo/SciViews-K/defaults/SciViews-K.kpz
Modified:
komodo/SciViews-K/content/js/commands.js
komodo/SciViews-K/content/js/prefs.js
komodo/SciViews-K/content/js/r.js
komodo/SciViews-K/content/js/rinterpolationquery.js
komodo/SciViews-K/content/js/sciviews.js
komodo/SciViews-K/content/overlayMain.xul
komodo/SciViews-K/defaults/.DS_Store
komodo/SciViews-K/defaults/svStart.R
komodo/SciViews-K/install.rdf
komodo/SciViews-K/sciviewsk-0.9.10-ko.xpi
pkg/tcltk2/DESCRIPTION
pkg/tcltk2/NEWS
pkg/tcltk2/R/tcltk2-Internal.R
pkg/tcltk2/win/src/Winico06.c
Log:
Changes to the interpolationquery dialog boxes and R startup function
Added: komodo/SciViews-K/content/js/ask.js
===================================================================
--- komodo/SciViews-K/content/js/ask.js (rev 0)
+++ komodo/SciViews-K/content/js/ask.js 2010-03-18 15:06:27 UTC (rev 252)
@@ -0,0 +1,67 @@
+// SciViews-K ask interpolation query code ('sv.ask' namespace)
+// Define functions useful in the context of interpolation query dialog box
+// Copyright (c) 2010, Ph. Grosjean (phgrosjean at sciviews.org)
+// License: MPL 1.1/GPL 2.0/LGPL 2.1
+////////////////////////////////////////////////////////////////////////////////
+// sv.ask.setDefault(object, classes); // Set default object for those class(es)
+// sv.ask.vars(object, restrict); // List all numeric variables for object
+// sv.ask.factors(object, restrict); // List all factor variables for object
+//
+////////////////////////////////////////////////////////////////////////////////
+// TODO: list files in a directory and a given extension
+
+
+if (typeof(sv.ask) == 'undefined') sv.ask = new Object();
+
+// Set default object for the given class(es)
+sv.ask.setDefault = function (object, classes) {
+ // If classes is provided, set corresponding preferences
+ // Otherwise, ask R for the classes (also look if it is data.frame or lm)!
+ var cls, i;
+ switch (arguments.length) {
+ case 1:
+ // No class provided => send code to R to set it according to the
+ // actual class of the object
+ res = sv.r.evalCallback('if (exists("' + object + '")) ' +
+ 'cat(c("' + object + '", class(' + object + ')), sep = "|")',
+ function (message) {
+ var cls = sv.tools.strings.removeLastCRLF(message).split("|");
+ var obj = cls[0];
+ for (i = 1; i < cls.length; i++) {
+ if (cls[i] != null & cls[i] != "") {
+ sv.prefs.setString("r.active." + cls[i], obj, true);
+ if (cls[i] == "data.frame") {
+ sv.prefs.setString("r.active.data.frame.d", obj +
+ "$", true);
+ sv.r.obj_message();
+ } else if (cls[i] == "lm") sv.r.obj_message();
+ }
+ }
+ }
+ );
+ break;
+
+ case 2:
+ // Classes are provided (separated by |)
+ cls = classes.split("|");
+ for (i = 0; i < cls.length; i++) {
+ if (cls[i] != null & cls[i] != "") {
+ sv.prefs.setString("r.active." + cls[i], object, true);
+ if (cls[i] == "data.frame") {
+ sv.prefs.setString("r.active.data.frame.d", object + "$", true);
+ sv.r.obj_message();
+ } else if (cls[i] == "lm") sv.r.obj_message();
+ }
+ }
+ }
+}
+
+// List all numeric variables for object
+sv.ask.vars = function (object, restrict) {
+ // TODO...
+}
+
+// List all factor variables for object
+sv.ask.factors = function (object, restrict) {
+ // TODO...
+}
Property changes on: komodo/SciViews-K/content/js/ask.js
___________________________________________________________________
Name: svn:executable
+ *
Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js 2010-03-18 15:05:26 UTC (rev 251)
+++ komodo/SciViews-K/content/js/commands.js 2010-03-18 15:06:27 UTC (rev 252)
@@ -111,6 +111,9 @@
// runIn = "command-output-window", "new-console",
// env strings: "ENV1=fooJ\nENV2=bar"
// gPrefSvc.prefs.getStringPref("runEnv");
+
+ // Reasonable default values are set in prefs.js... but just in case, we
+ // make sure to redefine reasonable default values here
var isWin = navigator.platform.indexOf("Win") === 0;
// Default preferredRApp on Windows is r-gui
var preferredRApp = sv.prefs.getString("svRApplicationId", isWin?
Modified: komodo/SciViews-K/content/js/prefs.js
===================================================================
--- komodo/SciViews-K/content/js/prefs.js 2010-03-18 15:05:26 UTC (rev 251)
+++ komodo/SciViews-K/content/js/prefs.js 2010-03-18 15:06:27 UTC (rev 252)
@@ -64,6 +64,11 @@
}
}
+// Simplify storage of default tooltips for arguments in interpolation queries
+sv.prefs.tip = function (arg, tip) {
+ sv.prefs.setString("dialog-tip-" + arg, tip, true);
+}
+
//// Preferences (default values, or values reset on each start) ///////////////
// Define default socket ports for the client and server, and other parameters
sv.prefs.setString("sciviews.server.socket", "7052", false);
@@ -74,7 +79,12 @@
// R interpreter
sv.prefs.setString("svRDefaultInterpreter", "", false);
sv.prefs.setString("svRApplication", "", false);
-sv.prefs.setString("svRApplicationId", "", false);
+// Default R interpreter Id: use a reasonable default, given the platform
+if (navigator.platform.indexOf("Win") === 0) {
+ sv.prefs.setString("svRApplicationId", "r-gui", false);
+} else {
+ sv.prefs.setString("svRApplicationId", "r-terminal", false);
+}
sv.prefs.setString("CRANMirror", "http://cran.r-project.org/", false);
@@ -117,10 +127,9 @@
// Set default dataset to 'df'
// Should be reset to a more useful value during first use of R
sv.prefs.setString("r.active.data.frame", "<df>", true);
+sv.prefs.setString("r.active.data.frame.d", "<df>$", true);
sv.prefs.setString("r.active.lm", "<lm>", true);
-sv.prefs.setString("r.active.princomp", "<princomp>", true);
-sv.prefs.setString("r.active.prcomp", "<prcomp>", true);
-sv.prefs.setString("r.active.PCA", "<PCA>", true);
+sv.prefs.setString("r.active.pcomp", "<pcomp>", true);
sv.prefs.mru("var", true, "");
sv.prefs.mru("var2", true, "");
sv.prefs.mru("x", true, "");
@@ -174,13 +183,15 @@
// Var.equal (for t-test)
sv.prefs.mru("var.equal", true, 'TRUE|FALSE', "|");
-// For multivariate stats
-sv.prefs.mru("cor", true, 'TRUE|FALSE', "|"); // princomp()
+// For multivariate stats with 'pcomp' object in the SciViews package
+sv.prefs.mru("scale", true, 'TRUE|FALSE', "|");
sv.prefs.mru("loadings", true, 'TRUE|FALSE', "|");
sv.prefs.mru("sort.loadings", true, 'TRUE|FALSE', "|");
sv.prefs.mru("screetype", true, '"barplot"|"lines"', "|");
sv.prefs.mru("pc.biplot", true, 'TRUE|FALSE', "|");
-sv.prefs.mru("choices", true, '1:2|2:3|c(1, 3)|c(1, 4)|c(2, 4)|c(3, 4)', "|");
+sv.prefs.mru("choices", true, '1:2|2:3|c(1, 3)|c(1, 4)|c(2, 4)|3:4', "|");
+sv.prefs.mru("text.pos", true, '1|2|3|4|NULL', "|");
+sv.prefs.mru("labels", false, 'NULL|FALSE|<factor>|list(group = <factor>)', "|");
//// Various graph parameters //////////////////////////////////////////////////
// Colors
Modified: komodo/SciViews-K/content/js/r.js
===================================================================
--- komodo/SciViews-K/content/js/r.js 2010-03-18 15:05:26 UTC (rev 251)
+++ komodo/SciViews-K/content/js/r.js 2010-03-18 15:06:27 UTC (rev 252)
@@ -960,8 +960,6 @@
// "objects than 'data.frame'");
// Temporary code: at least set pref value
sv.prefs.setString("r.active." + objclass, objname, true);
- // Refresh statusbar message in case an 'lm' object is changed
- if (objclass == "lm") sv.r.obj_message();
}
}
}
@@ -981,7 +979,8 @@
// Get currently active 'lm' object
var lm = sv.prefs.getString("r.active.lm", "<none>")
if (lm == "<lm>") lm = "<none>";
- sv.cmdout.message(sv.translate("R session: %S data: %S linear model: %S", ses, df, lm));
+ sv.cmdout.message(sv.translate("R session: %S data: %S linear model: %S",
+ ses, df, lm));
}
// Select one data frame
@@ -1008,6 +1007,7 @@
if (data == "<<<data>>>") {
//var oldobj = sv.prefs.getString("r.active.data.frame", "");
sv.prefs.setString("r.active.data.frame", "<df>", true); // Default value
+ sv.prefs.setString("r.active.data.frame.d", "<df>$", true);
sv.prefs.mru("var", true, "");
sv.prefs.mru("var2", true, "");
sv.prefs.mru("x", true, "");
@@ -1028,6 +1028,7 @@
var objclass = item[1];
// Make sure r.active.data.frame pref is set to obj
sv.prefs.setString("r.active.data.frame", objname, true);
+ sv.prefs.setString("r.active.data.frame.d", objname + "$", true);
items.shift(); // Eliminate first item from the array
// Create three lists: vars collects all var names, nums and facts do so for
// only numeric and factor variables (separate items by "|")
@@ -1061,7 +1062,7 @@
return(true);
}
-// Select one data frame
+// Select one lm object
sv.r.obj_select_lm = function (objname) {
// Refresh the default lm object in R session
res = sv.r.evalCallback(
Modified: komodo/SciViews-K/content/js/rinterpolationquery.js
===================================================================
--- komodo/SciViews-K/content/js/rinterpolationquery.js 2010-03-18 15:05:26 UTC (rev 251)
+++ komodo/SciViews-K/content/js/rinterpolationquery.js 2010-03-18 15:06:27 UTC (rev 252)
@@ -50,8 +50,12 @@
*/
var gQueries = null;
-var gSv = null;
var gHelpWin = null;
+var gIds = new Object();
+var args = new Object();
+var argNames = new Object();
+var sv = null;
+var gOnOK = "";
function OnLoad() {
var dialog = document.getElementById("dialog-interpolationquery")
@@ -60,6 +64,11 @@
okButton.setAttribute("accesskey", "o");
cancelButton.setAttribute("accesskey", "c");
+ // PhG added to retrieve default tooltip from prefs
+ var prefsSvc = Components.classes["@activestate.com/koPrefService;1"].
+ getService(Components.interfaces.koIPrefService);
+ var prefs = prefsSvc.prefs;
+
// PhG added to provide further help on R snippets
var helpButton = dialog.getButton("help");
helpButton.setAttribute("accesskey", "?");
@@ -73,12 +82,11 @@
document.title = "Interpolation Query";
}
gQueries = window.arguments[0].queries;
- gSv = window.arguments[0].sv;
+ sv = window.arguments[0].sv;
// Generate UI for the queries.
var queryRows = document.getElementById("query-rows");
var q, label, textbox, row, hbox, i;
- var j = 0;
try {
for (i = 0; i < gQueries.length; i++) {
// Want the following XUL for each query:
@@ -120,7 +128,7 @@
// for extra features of our R interpolation query dialog box
// and make sure we return nothing from it
switch (q.question) {
- case "R-desc":
+ case "R-desc":
var queryDesc = document.getElementById("query-desc");
if (queryDesc.value == "") {
queryDesc.value = q.answer;
@@ -135,16 +143,36 @@
break;
case "R-tip":
- // Set the tooltip text of a query box to this string
- // They must appear in the same order as the querybox themselves
- var id = "query"+j+"-textbox";
- var queryTextbox = document.getElementById(id);
- queryTextbox.setAttribute("tooltiptext", q.answer);
+ // Set the tooltip text of a query box to the provided string
+ var id = gIds[q.answer.match(/^[^:]+(?=:)/)];
+ if (typeof(id) != 'undefined') {
+ // Change the tooltip for this item
+ document.getElementById(id).setAttribute("tooltiptext",
+ q.answer.replace(/^[^:]+:/, ""));
+ }
// Make sure we return nothing from here!
q.answer = "";
- j = j+1;
break;
+ case "R-onfocus":
+ // Set the onfocus action for this textbox
+ var id = gIds[q.answer.match(/^[^:]+(?=:)/)];
+ if (typeof(id) != 'undefined') {
+ // Change the onfocus attribute for this item
+ document.getElementById(id).setAttribute("onfocus",
+ q.answer.replace(/^[^:]+:/, "") + " this.select();");
+ }
+ // Make sure we return nothing from here!
+ q.answer = "";
+ break;
+
+ case "R-onok":
+ // Set the onok action
+ gOnOK = q.answer;
+ // Make sure we return nothing from here!
+ q.answer = "";
+ break;
+
case "R-help":
case "URL-help":
helpButton.setAttribute("hidden", "false");
@@ -158,7 +186,7 @@
helpButton.setAttribute("hidden", "false");
// Get the RWiki base URL
var baseURL = "http:/wiki.r-project.org/rwiki/doku.php?id="
- baseURL = gSv.prefs.getString("sciviews.rwiki.help.base",
+ baseURL = sv.prefs.getString("sciviews.rwiki.help.base",
baseURL);
dialog.setAttribute("ondialoghelp",
"Help('" + baseURL + q.answer + "');");
@@ -169,10 +197,11 @@
default:
row = document.createElement("row");
row.setAttribute("align", "center");
-
+
label = document.createElement("label");
label.setAttribute("id", "query"+i+"-label");
- label.setAttribute("value", q.question+" =");
+ // PhG: restrict label to first part of 'label-list' pair
+ label.setAttribute("value", q.question.replace(/-.*$/, "")+" =");
label.setAttribute("control", "query"+i+"-textbox");
label.setAttribute("crop", "end");
label.setAttribute("flex", "1");
@@ -180,14 +209,21 @@
textbox = document.createElement("textbox");
textbox.setAttribute("id", "query"+i+"-textbox");
+ // PhG: save the correspondance between q.question and id
+ gIds[q.question] = "query"+i+"-textbox";
textbox.setAttribute("style", "min-height: 1.8em;");
textbox.setAttribute("flex", "1");
+
if (q.answer) {
textbox.setAttribute("value", q.answer);
} else {
textbox.setAttribute("value", "");
}
textbox.setAttribute("onfocus", "this.select();");
+ textbox.setAttribute("onblur",
+ "if (this.value != args['" + q.question + "']) args['" +
+ q.question + "'] = this.value;");
+
if (q.isPassword) {
textbox.setAttribute("type", "password");
@@ -196,8 +232,9 @@
textbox.setAttribute("autocompletepopup", "popupTextboxAutoComplete");
textbox.setAttribute("autocompletesearch", "mru");
if (q.mruName) {
- textbox.setAttribute("autocompletesearchparam",
- "dialog-interpolationquery-"+q.mruName+"Mru");
+ textbox.setAttribute("autocompletesearchparam",
+ "dialog-interpolationquery-"+
+ q.mruName.replace(/^.*-/, "")+"Mru");
textbox.setAttribute("enablehistory", "true");
} else {
// Disable autocomplete: no mruName given.
@@ -210,9 +247,16 @@
textbox.setAttribute("tabscrolling", "false");
textbox.setAttribute("ontextentered", "this.focus();");
}
-
- row.appendChild(textbox);
+ // PhG: if a default tooltip is defined for this item, set it:
+ if (prefs.hasStringPref("dialog-tip-" + q.question))
+ textbox.setAttribute("tooltiptext",
+ prefs.getStringPref("dialog-tip-" + q.question));
+
+ row.appendChild(textbox);
queryRows.appendChild(row);
+
+ // PhG: add this to the args object
+ args[q.question] = q.answer;
}
}
} catch(ex) {
@@ -229,7 +273,7 @@
for (var i = 0; i < gQueries.length; i++) {
var q = gQueries[i];
// Skip special %ask fields like "R-desc" or "R-tip"
- if (!q.question.match(/^(R-desc|R-tip|R-help|RWiki-help|URL-help)$/i)) {
+ if (!q.question.match(/^(R-onfocus|R-onok|R-desc|R-tip|R-help|RWiki-help|URL-help)$/i)) {
var id = "query"+i+"-textbox";
var queryTextbox = document.getElementById(id);
if (queryTextbox.value) {
@@ -241,8 +285,12 @@
q.answer = "";
}
}
- }
- window.arguments[0].retval = "OK";
+ }
+ window.arguments[0].retval = "OK";
+ // Do we have onOK code to execute?
+ if (gOnOK != "") {
+ eval(gOnOK);
+ }
return true;
}
@@ -260,9 +308,9 @@
} else {
// If uri is a R help topic, get the corresponding R HTML help page
// R must be started and linked to Komodo for this to work
- if (gSv.r.running) {
+ if (sv.r.running) {
var cmd = 'cat(getHelpURL(help("' + uri + '", help_type = "html")))';
- var res = gSv.r.evalCallback(cmd, ShowHelp);
+ var res = sv.r.evalCallback(cmd, ShowHelp);
} else {
alert("There is help available for this item, but R must be " +
"started to display it. Close this dialog box and select " +
Modified: komodo/SciViews-K/content/js/sciviews.js
===================================================================
--- komodo/SciViews-K/content/js/sciviews.js 2010-03-18 15:05:26 UTC (rev 251)
+++ komodo/SciViews-K/content/js/sciviews.js 2010-03-18 15:06:27 UTC (rev 252)
@@ -748,52 +748,72 @@
// without notice, all modifications are lost.
sv.checkToolbox = function () {
try {
+ // TODO: determine versions automatically instead of hard-coding it!
+ var svk = "SciViews-K (0.9.12).kpz";
+ var rref = "R reference (0.9.12).kpz";
+
var pkg = ko.interpolate.interpolateStrings("%(path:hostUserDataDir)");
- pkg += "/XRE/extensions/sciviewsk at sciviews.org/templates/SciViews-K.kpz";
- var partSvc = Components.classes["@activestate.com/koPartService;1"]
- .getService(Components.interfaces.koIPartService);
- var SciViewsK_folders = partSvc.getParts("folder", "name", "SciViews-K",
- "*", partSvc.currentProject, new Object());
- if (SciViewsK_folders.length == 0) {
- // The SciViews-K toolbox is not installed yet... do it now
- ko.toolboxes.importPackage(pkg);
- } else {
- // First, eliminate all SciViews-K toolboxes that are too old
- var VersionMacro;
- var SciViewsK_folder;
- sv.showVersion = false;
- for (var i = 0; i < SciViewsK_folders.length; i++) {
- SciViewsK_folder = SciViewsK_folders[i];
- VersionMacro = SciViewsK_folder.
- getChildWithTypeAndStringAttribute(
- "macro", "name", "Version", true);
- if (VersionMacro) {
- ko.projects.executeMacro(VersionMacro);
- if (SciViewsKtoolboxVersion < sv.version) {
- // This toolbox is too old for our extension
- ko.toolboxes.user.removeItem(SciViewsK_folder, true);
- }
- } else {
- // Probably a corrupted SciViews-K toolbox => eliminate it
- ko.toolboxes.user.removeItem(SciViewsK_folder, true);
- }
- }
- // Recheck how many SciViews-K toolboxes are left
- SciViewsK_folders = partSvc.getParts("folder", "name", "SciViews-K",
- "*", partSvc.currentProject, new Object());
- if (SciViewsK_folders.length == 0) {
- // Install the new one now
- ko.toolboxes.importPackage(pkg);
- } else if (SciViewsK_folders.length > 1) {
- // There are duplications, keep only last one
- for (var i = 0; i < (SciViewsK_folders.length - 1); i++) {
- SciViewsK_folder = SciViewsK_folders[i];
- ko.toolboxes.user.removeItem(SciViewsK_folder, true);
- }
- }
- }
+ pkg += "/XRE/extensions/sciviewsk at sciviews.org/defaults/";
+ pkg += svk;
+ ko.toolboxes.importPackage(pkg);
+
+ pkg = ko.interpolate.interpolateStrings("%(path:hostUserDataDir)");
+ pkg += "/XRE/extensions/sciviewsk at sciviews.org/defaults/";
+ pkg += rref;
+ ko.toolboxes.importPackage(pkg);
+
+ // Message prompting for removing old or duplicated toolboxes
+ alert("Toolboxes " + svk + " and " + rref + " are installed. Make sure " +
+ "you delete older or replicated versions of these toolboxes. " +
+ "Also restart Komodo to rebuild toolbars.");
+
+ //// This is old code kept if we want to take something back from it!
+ //var pkg = ko.interpolate.interpolateStrings("%(path:hostUserDataDir)");
+ //pkg += "/XRE/extensions/sciviewsk at sciviews.org/templates/SciViews-K.kpz";
+ //var partSvc = Components.classes["@activestate.com/koPartService;1"]
+ // .getService(Components.interfaces.koIPartService);
+ //var SciViewsK_folders = partSvc.getParts("folder", "name", "SciViews-K",
+ // "*", partSvc.currentProject, new Object());
+ //if (SciViewsK_folders.length == 0) {
+ // // The SciViews-K toolbox is not installed yet... do it now
+ // ko.toolboxes.importPackage(pkg);
+ //} else {
+ // // First, eliminate all SciViews-K toolboxes that are too old
+ // var VersionMacro;
+ // var SciViewsK_folder;
+ // sv.showVersion = false;
+ // for (var i = 0; i < SciViewsK_folders.length; i++) {
+ // SciViewsK_folder = SciViewsK_folders[i];
+ // VersionMacro = SciViewsK_folder.
+ // getChildWithTypeAndStringAttribute(
+ // "macro", "name", "Version", true);
+ // if (VersionMacro) {
+ // ko.projects.executeMacro(VersionMacro);
+ // if (SciViewsKtoolboxVersion < sv.version) {
+ // // This toolbox is too old for our extension
+ // ko.toolboxes.user.removeItem(SciViewsK_folder, true);
+ // }
+ // } else {
+ // // Probably a corrupted SciViews-K toolbox => eliminate it
+ // ko.toolboxes.user.removeItem(SciViewsK_folder, true);
+ // }
+ // }
+ // // Recheck how many SciViews-K toolboxes are left
+ // SciViewsK_folders = partSvc.getParts("folder", "name", "SciViews-K",
+ // "*", partSvc.currentProject, new Object());
+ // if (SciViewsK_folders.length == 0) {
+ // // Install the new one now
+ // ko.toolboxes.importPackage(pkg);
+ // } else if (SciViewsK_folders.length > 1) {
+ // // There are duplications, keep only last one
+ // for (var i = 0; i < (SciViewsK_folders.length - 1); i++) {
+ // SciViewsK_folder = SciViewsK_folders[i];
+ // ko.toolboxes.user.removeItem(SciViewsK_folder, true);
+ // }
+ // }
+ //}
} catch(e) {
- sv.log.exception(e, "Unable to install/update the SciViews-K toolbox");
+ sv.log.exception(e, "Error while installing the SciViews-K & R reference toolboxes");
}
finally { sv.showVersion = true; }
}
Modified: komodo/SciViews-K/content/overlayMain.xul
===================================================================
--- komodo/SciViews-K/content/overlayMain.xul 2010-03-18 15:05:26 UTC (rev 251)
+++ komodo/SciViews-K/content/overlayMain.xul 2010-03-18 15:06:27 UTC (rev 252)
@@ -64,6 +64,7 @@
<script type="application/x-javascript" src="chrome://sciviewsk/content/js/r-help.js"/>
<script type="application/x-javascript" src="chrome://sciviewsk/content/js/commands.js"/>
<script type="application/x-javascript" src="chrome://sciviewsk/content/js/misc.js"/>
+ <script type="application/x-javascript" src="chrome://sciviewsk/content/js/ask.js"/>
<script type="application/x-javascript" src="chrome://sciviewsk/content/js/interpolate.js"/>
<broadcasterset id="broadcasterset_global">
@@ -220,6 +221,9 @@
class="menuitem-iconic r-run-function-icon"/>
<menuitem id="r_src_function_menu" observes="cmd_sv_RSourceFunction"
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" />
</menupopup>
</menu>
</menubar>
Modified: komodo/SciViews-K/defaults/.DS_Store
===================================================================
(Binary files differ)
Added: komodo/SciViews-K/defaults/R reference (0.9.12).kpz
===================================================================
(Binary files differ)
Property changes on: komodo/SciViews-K/defaults/R reference (0.9.12).kpz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: komodo/SciViews-K/defaults/R reference.kpz
===================================================================
(Binary files differ)
Added: komodo/SciViews-K/defaults/SciViews-K (0.9.12).kpz
===================================================================
(Binary files differ)
Property changes on: komodo/SciViews-K/defaults/SciViews-K (0.9.12).kpz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: komodo/SciViews-K/defaults/SciViews-K.kpz
===================================================================
(Binary files differ)
Added: komodo/SciViews-K/defaults/SciViews_0.9-1.tar.gz
===================================================================
(Binary files differ)
Property changes on: komodo/SciViews-K/defaults/SciViews_0.9-1.tar.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: komodo/SciViews-K/defaults/SciViews_0.9-1.zip
===================================================================
(Binary files differ)
Property changes on: komodo/SciViews-K/defaults/SciViews_0.9-1.zip
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: komodo/SciViews-K/defaults/ellipse_0.3-5.tar.gz
===================================================================
(Binary files differ)
Property changes on: komodo/SciViews-K/defaults/ellipse_0.3-5.tar.gz
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: komodo/SciViews-K/defaults/ellipse_0.3-5.zip
===================================================================
(Binary files differ)
Property changes on: komodo/SciViews-K/defaults/ellipse_0.3-5.zip
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Modified: komodo/SciViews-K/defaults/svStart.R
===================================================================
--- komodo/SciViews-K/defaults/svStart.R 2010-03-18 15:05:26 UTC (rev 251)
+++ komodo/SciViews-K/defaults/svStart.R 2010-03-18 15:06:27 UTC (rev 252)
@@ -1,6 +1,6 @@
### SciViews install begin ###
# SciViews-R installation and startup for running R with Komodo/SciViews-K
-# Version 0.9.6, 2009-11-03 Ph. Grosjean (phgrosjean at sciviews.org)
+# Version 0.9.11, 2010-02-09 Ph. Grosjean (phgrosjean at sciviews.org)
# Bug on Linux (Bug #685): for some strange reason R breaks execution of .Rprofile before an
# attempt of installation of ANY package, and then starts executing .Rprofile again from
@@ -11,8 +11,8 @@
# TODO: also use value in koDebug to debug server from within R!
"svStart" <-
-function (minVersion = c(R = "2.10.0", svMisc = "0.9-56",
-svSocket = "0.9-48", svGUI = "0.9-46"),
+function (minVersion = c(R = "2.6.0", svMisc = "0.9-56",
+svSocket = "0.9-48", svGUI = "0.9-46", ellipse = "0.3-5", SciViews = "0.9-1"),
remote.repos = "http://R-Forge.R-project.org",
# I would keep 'pkg.dir' attribute to give user a possibility of running
# svStart manually also from another working dir.
@@ -29,6 +29,10 @@
# R, just run svStart again. For this reason svStart could be included in
# svGUI rather than here. Philippe, what do you think?
+ # TODO: if R crashes before this code is done, 00LOCK remains and it is not
+ # possible to initiate SciViews extensions any more! => use a different
+ # mechanism (perhaps, a file in /tmp and/or make sure the 00LOCK file
+ # is deleted when Komodo Edit quits)
path0 <- getwd()
lockfile <- file.path(path0, "00LOCK")
if (file.exists(lockfile)) return (invisible(NULL))
@@ -181,12 +185,17 @@
# Load packages svMisc, svSocket & svGUI (possibly after installing
# or upgrading them). User is supposed to agree with this install
# from the moment he tries to start and configure R from Komodo Edit
- pkgs <- c("svMisc", "svSocket", "svGUI")
+ # We now also need ellipse and SciViews
+ pkgs <- c("svMisc", "svSocket", "svGUI", "ellipse", "SciViews")
ext <- switch(.Platform$pkgType, # There is a problem on some Macs
# => always install from sources there! mac.binary = "\\.tgz",
win.binary = "\\.zip", "\\.tar\\.gz")
+ typ <- switch(.Platform$pkgType, # There is a problem on some Macs
+ # => always install from sources there! mac.binary = "\\.tgz",
+ win.binary = "win.binary", "source")
- # Find a library location with write access
+ # Find a library location with write access, usually, last item in the
+ # list is fine
lib <- .libPaths()
k <- file.access(lib, 2) == 0
if (!any(k)) {
@@ -207,9 +216,16 @@
if (length(file) > 0) {
# Better by-version sorting
ver <- gsub(paste("(^", pkgName, "_", "|", ext, "$)", sep = ""),
- "", basename(file))
+ "", basename(file))
file <- tail(file[order(sapply(strsplit(ver, "[\\.\\-]"),
function (x) sum(as.numeric(x) * (100 ^ -seq_along(x)))))], 1)
+ # For some reasons (bug probably?) I cannot install a package in
+ # R 2.10.1 under Mac OS X when the path to the package has spaces
+ # Also, correct a bug here when installing package from a
+ # repository where we are not supposed to prepend a path!
+ # Copy the dfile temporarily to the temp dir
+ sourcefile <- file.path(pkg.dir, file)
+ file <- file.path(tempdir(), file)
repos <- NULL
# remove directory lock if exists (happens sometimes on linux)
@@ -218,21 +234,28 @@
}
} else {
# No packages found, download from the web
+ sourcefile <- NULL
+ file <- pkgName
repos <- remote.repos
- file <- pkgName
}
# desc <- suppressWarnings(system.file("DESCRIPTION", package = pkgName))
pkgIsInstalled <- pkgName %in% installed.packages()[, 1]
- if (!pkgIsInstalled) {
- cat("Installing missing package", sQuote(pkgName),
- "into", lib, "\n")
- try(install.packages(file.path(pkg.dir, file), lib = lib, repos = repos))
- } else if ((compareVersion(packageDescription(pkgName,
- fields = "Version"), minVersion[pkgName]) < 0)) {
- cat("Updating package", sQuote(pkgName), "\n")
- try(install.packages(file.path(pkg.dir, file), lib = lib, repos = repos))
+ if (!pkgIsInstalled || compareVersion(packageDescription(pkgName,
+ fields = "Version"), minVersion[pkgName]) < 0) {
+ if (!pkgIsInstalled) {
+ cat("Installing missing package", sQuote(pkgName),
+ "into", lib, "\n")
+ } else {
+ cat("Updating package", sQuote(pkgName), "\n")
+ }
+ # Copy the install file to the temporary directory
+ if (!is.null(sourcefile)) try(invisible(file.copy(sourcefile, file)))
+ # Install or update the package
+ try(install.packages(file, lib = lib, repos = repos, type = typ))
+ # Erase the temporary file
+ try(unlink(file))
} else {
debugMsg("Package", pkgName, "is up to date")
}
@@ -257,8 +280,10 @@
cat("or choose a different port for the server in Komodo\n")
} else {
- # Finally, load svGUI
+ # Finally, load svGUI, MASS and SciViews
res <- require("svGUI", quietly = TRUE)
+ res[2] <- require("MASS", quietly = TRUE)
+ res[3] <- require("SciViews", quietly = TRUE)
if (all(res)) {
cat("R is SciViews ready!\n")
assignTemp(".SciViewsReady", TRUE)
@@ -266,17 +291,16 @@
# Indicate what we have as default packages
options(defaultPackages = c("datasets", "utils",
"grDevices", "graphics", "stats", "methods", "tools",
- "tcltk", "svMisc", "svSocket", "svGUI"))
+ "tcltk", "svMisc", "svSocket", "svGUI", "MASS", "SciViews"))
} else {
cat("R is not SciViews ready, install latest svMisc,",
- "svSocket & svGUI packages\n")
+ "svSocket, svGUI, ellipse & SciViews packages\n")
}
}
}
}
res <- all(res) # all packages are loaded
-
if (res) {
# Make sure Komodo is started now
# Note: in Mac OS X, you have to create the symbolic link manually
Modified: komodo/SciViews-K/install.rdf
===================================================================
--- komodo/SciViews-K/install.rdf 2010-03-18 15:05:26 UTC (rev 251)
+++ komodo/SciViews-K/install.rdf 2010-03-18 15:06:27 UTC (rev 252)
@@ -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.9.10</em:version>
+ <em:version>0.9.12</em:version>
<em:description>Edit R (http://www.r-project.org) code with Komodo</em:description>
<em:creator>Philippe Grosjean</em:creator>
<em:homepageURL>http://sciviews.org/SciViews-K</em:homepageURL>
Modified: komodo/SciViews-K/sciviewsk-0.9.10-ko.xpi
===================================================================
(Binary files differ)
Added: komodo/SciViews-K/sciviewsk-0.9.11-ko.xpi
===================================================================
(Binary files differ)
Property changes on: komodo/SciViews-K/sciviewsk-0.9.11-ko.xpi
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: komodo/SciViews-K/sciviewsk-0.9.12-ko.xpi
===================================================================
(Binary files differ)
Property changes on: komodo/SciViews-K/sciviewsk-0.9.12-ko.xpi
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: pkg/tcltk2/DESCRIPTION
===================================================================
--- pkg/tcltk2/DESCRIPTION 2010-03-18 15:05:26 UTC (rev 251)
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/sciviews -r 252
More information about the Sciviews-commits
mailing list