[Sciviews-commits] r470 - komodo/SciViews-K komodo/SciViews-K/components komodo/SciViews-K/content komodo/SciViews-K/content/js komodo/SciViews-K/defaults komodo/SciViews-K/locale/en-GB komodo/SciViews-K/locale/fr-FR komodo/SciViews-K/pylib komodo/SciViews-K/udl pkg/svKomodo pkg/svKomodo/R pkg/svKomodo/inst pkg/svKomodo/man pkg/tcltk2 pkg/tcltk2/R pkg/tcltk2/man/unix pkg/tcltk2/man/windows
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue May 1 15:06:20 CEST 2012
Author: phgrosjean
Date: 2012-05-01 15:06:20 +0200 (Tue, 01 May 2012)
New Revision: 470
Removed:
komodo/SciViews-K/content/rObjects2Pane.xul
pkg/tcltk2/cleanup.win
pkg/tcltk2/configure.win
pkg/tcltk2/tcltk2_tk2icoReplacement.R
Modified:
komodo/SciViews-K/chrome.manifest
komodo/SciViews-K/components/koRLinter.py
komodo/SciViews-K/components/koR_UDL_Language.py
komodo/SciViews-K/components/svRinterpreter.js
komodo/SciViews-K/content/RHelpWindow.xul
komodo/SciViews-K/content/RObjectsOverlay.xul
komodo/SciViews-K/content/js/commands.js
komodo/SciViews-K/content/js/pref-R.js
komodo/SciViews-K/content/js/prefs.js
komodo/SciViews-K/content/js/r-help.js
komodo/SciViews-K/content/js/r.js
komodo/SciViews-K/content/js/robjects.js
komodo/SciViews-K/content/js/sciviews.js
komodo/SciViews-K/content/js/socket.js
komodo/SciViews-K/content/keybindings-mac.kkf
komodo/SciViews-K/content/keybindings.kkf
komodo/SciViews-K/content/pref-R.xul
komodo/SciViews-K/defaults/svStart.R
komodo/SciViews-K/locale/en-GB/main.properties
komodo/SciViews-K/locale/fr-FR/main.properties
komodo/SciViews-K/pylib/lang_r.py
komodo/SciViews-K/udl/R-mainlex.udl
komodo/SciViews-K/udl/Rlex.udl
pkg/svKomodo/DESCRIPTION
pkg/svKomodo/NEWS
pkg/svKomodo/R/koCmd.R
pkg/svKomodo/R/svKomodo-internal.R
pkg/svKomodo/inst/NEWS.Rd
pkg/svKomodo/man/svKomodo-package.Rd
pkg/tcltk2/.DS_Store
pkg/tcltk2/DESCRIPTION
pkg/tcltk2/NAMESPACE
pkg/tcltk2/NEWS
pkg/tcltk2/R/tcltk2-Internal.R
pkg/tcltk2/R/tk2ico.R
pkg/tcltk2/man/unix/tk2ico.Rd
pkg/tcltk2/man/windows/tk2ico.Rd
Log:
Wiki embedded block syntax + tcltk2 bug correction
Modified: komodo/SciViews-K/chrome.manifest
===================================================================
--- komodo/SciViews-K/chrome.manifest 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/chrome.manifest 2012-05-01 13:06:20 UTC (rev 470)
@@ -1,5 +1,7 @@
content sciviewsk jar:sciviewsk.jar!/content/ xpcnativewrappers=yes
+overlay chrome://komodo/content/komodo.xul chrome://sciviewsk/content/RConsoleOverlay.xul appversion<=6.99
+
overlay chrome://komodo/content/komodo.xul chrome://sciviewsk/content/overlayMain.xul appversion>6.99
overlay chrome://komodo/content/komodo.xul chrome://sciviewsk/content/overlayMain-ko6.xul appversion<=6.99
@@ -9,8 +11,8 @@
overlay chrome://places/content/places_panel.xul chrome://sciviewsk/content/placesOverlay.xul appversion>6.99
-overlay chrome://komodo/content/komodo.xul chrome://sciviewsk/content/RConsoleOverlay.xul appversion<=6.99
+
locale sciviewsk en-GB jar:sciviewsk.jar!/locale/en-GB/
locale sciviewsk fr-FR jar:sciviewsk.jar!/locale/fr-FR/
Modified: komodo/SciViews-K/components/koRLinter.py
===================================================================
--- komodo/SciViews-K/components/koRLinter.py 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/components/koRLinter.py 2012-05-01 13:06:20 UTC (rev 470)
@@ -86,7 +86,6 @@
Raise an exception if there is a problem.
"""
- # TODO: R does not like utf-8 produced by Komodo => use a different encoding?
text = request.content.encode("utf-8")
# Retrieve the path to R...
@@ -108,7 +107,7 @@
p = None
try:
- argv = [R] + ["--slave"] + ["-e", "if(isTRUE(require('svTools',quietly=TRUE)))lint('" + os.path.basename(Rfilename) + "',type='flat',encoding='utf8')"]
+ argv = [R] + ["--slave"] + ["-e", "try(Sys.setlocale('LC_CTYPE','UTF-8'),silent=TRUE);if(isTRUE(require('svTools',quietly=TRUE)))lint('" + os.path.basename(Rfilename) + "',type='flat',encoding='utf8')"]
env = koprocessutils.getUserEnv()
cwd = os.path.dirname(Rfilename)
p = process.ProcessOpen(argv, cwd=cwd, env=env)
@@ -140,6 +139,7 @@
columnNo = int(items[2])
result.lineStart = result.lineEnd = lineNo
result.columnStart = columnNo
+ # TODO: this sometimes raises an error!?
result.columnEnd = len(datalines[result.lineEnd-1]) + 1
# Get the error message
if items[3]:
Modified: komodo/SciViews-K/components/koR_UDL_Language.py
===================================================================
--- komodo/SciViews-K/components/koR_UDL_Language.py 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/components/koR_UDL_Language.py 2012-05-01 13:06:20 UTC (rev 470)
@@ -58,7 +58,7 @@
defaultExtension = '.R'
primary = 1
lang_from_udl_family = {
- 'SSL': 'R'
+ 'SSL': None
}
commentDelimiterInfo = {
@@ -86,8 +86,18 @@
a <- data.frame(x = 1:10, y = rnorm(10))
cube(a$x)
plot(y ~ x, data = a, col = 'blue', main = "Plot of \\"a\\"\\0")
-a$y <- NULL; a"""
+a$y <- NULL; a
+!"
+== Wiki block
+
+* Item 1,
+* Item 2.
+
+This is a paragraph of **bold** ans //italic// text.
+!"
+"""
+
# Overriding these base methods to work around bug 81066.
def get_linter(self):
return self._get_linter_from_lang("R")
Modified: komodo/SciViews-K/components/svRinterpreter.js
===================================================================
--- komodo/SciViews-K/components/svRinterpreter.js 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/components/svRinterpreter.js 2012-05-01 13:06:20 UTC (rev 470)
@@ -16,6 +16,7 @@
// R.complete(code); // Get completion list for this code
////////////////////////////////////////////////////////////////////////////////
// TODO: rework calltip() and complete() in sv.r to use this one.
+// TODO: I sometimes got an error, 'callTipItem is undefined'!
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Modified: komodo/SciViews-K/content/RHelpWindow.xul
===================================================================
--- komodo/SciViews-K/content/RHelpWindow.xul 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/RHelpWindow.xul 2012-05-01 13:06:20 UTC (rev 470)
@@ -31,6 +31,17 @@
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK ***** -->
+
+<!--
+TODO:
+* Help called twice for help on selection, list R demos & browse R vignettes
+* Ctrl+Shift+R does not work in help window
+* Search for topic from help window is broken
+* Purge history => navigation arrows are not grayed out (although they are inactive)
+* Add Rseek.org, R blogger, Crantastic + other R web sites to the list
+* It seems that this window is at the origin of a bug that prevents Komodo Edit
+ to shut down on Windows and Linux
+-->
<!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN"
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" [
Modified: komodo/SciViews-K/content/RObjectsOverlay.xul
===================================================================
--- komodo/SciViews-K/content/RObjectsOverlay.xul 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/RObjectsOverlay.xul 2012-05-01 13:06:20 UTC (rev 470)
@@ -193,7 +193,7 @@
tooltiptext="&sciviews.robjects.refresh.tip;"
buttonstyle="pictures"
label="&sciviews.robjects.refresh;" class="refresh-icon"
- oncommand="sv.robjects.getPackageList(true);"/>
+ oncommand="sv.robjects.smartRefresh(true);"/>
<!-- or oncommand="sv.robjects.refreshAll();"-->
<toolbarbutton id="sciviews_robjects_searchpath_button"
observes="cmd_robjects_viewSearchPath"
Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/js/commands.js 2012-05-01 13:06:20 UTC (rev 470)
@@ -64,9 +64,11 @@
return(win);
}
- function _isRRunning () {
- return(sv.r.running);
- }
+ // A temporary work-around for something that does not work!
+ //function _isRRunning () {
+ // return(sv.r.running);
+ //}
+ function _isRRunning () { return(true); }
// TODO: code from SciViews-K-dev to integrate...
//function _RControl_supported () {
@@ -157,11 +159,13 @@
// TODO: startR() is different in SciViews-K-dev => look how to rework!
this.startR = function () {
// Check if R is not already running and servicing on server port
- if (sv.r.test(false, false, true)) {
- ko.statusBar.AddMessage("R is already running!", "SciViews-K",
- 3000, true);
- return;
- }
+ try {
+ if (sv.r.test(false, false, true)) {
+ ko.statusBar.AddMessage("R is already running!", "SciViews-K",
+ 3000, true);
+ return;
+ }
+ } catch(e) { }
var cwd = sv.tools.file.path("ProfD", "extensions",
"sciviewsk at sciviews.org", "defaults");
@@ -244,6 +248,9 @@
// ... make sure to start with a clear R Output window
sv.cmdout.clear(false);
+
+ // Change menus now
+ _this.updateRStatus(true);
}
// This will observe status message notification to be informed about
@@ -428,7 +435,7 @@
'cmd_svConfigureR': ['sv.command.configureR();', 0],
'cmd_svInstallRtoolbox': ['sv.checkToolbox();', 0],
'cmd_svUIlevel': ['sv.askUI(true);', 0],
- 'cmd_svStartR': ['sv.command.startR();', XRStopped],
+ 'cmd_svStartR': ['sv.command.startR();', 0], //XRStopped],
'cmd_svQuitR': ['sv.r.quit();', XRRunning],
'cmd_svOpenPkgManager': ['sv.command.openPkgManager();', XRRunning],
'cmd_svBrowseWD': ['sv.r.setwd("current", true);', XRRunning],
@@ -503,6 +510,13 @@
(((test & XRRunning) != XRRunning) || _isRRunning())
&& (((test & XRStopped) != XRStopped) || !_isRRunning()));
}
+ //var test = handlers[command][1];
+ //return (((test & XRRunning) != XRRunning) || _isRRunning())
+ //&& (((test & XRStopped) != XRStopped) || !_isRRunning())
+ //&& (((test & XisRDoc) != XisRDoc) || true) //_isRCurLanguage())
+ //&& (((test & XHasSelection) != XHasSelection) || _hasSelection()));
+ //}
+
svController.prototype.supportsCommand = svController.prototype
.isCommandEnabled;
svController.prototype.doCommand = function (command) {
@@ -659,36 +673,48 @@
}
////}
- //// 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));
- // if(sv.r.running) sv.rbrowser.smartRefresh(true);
- //
- // // For completions
- // var cuih = ko.codeintel.CompletionUIHandler;
- // cuih.prototype.types.argument = cuih.prototype.types.interface;
- // cuih.prototype.types.environment = cuih.prototype.types.namespace;
- // cuih.prototype.types.file = "chrome://sciviewsk/skin/images/cb_file.png";
- // }, 600);
- //
- //
- // var osName = Components.classes['@activestate.com/koOs;1']
- // .getService(Components.interfaces.koIOs).name;
- //
- // if(!_setKeybindings(false, osName)) // use system specific keybindings
- // _setKeybindings(false, '') // fallback - use default
- //
- // sv.rconn.startSocketServer();
+ // 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.r.test());
+ if(sv.r.running) sv.rbrowser.smartRefresh(true);
+
+ // For completions
+ var cuih = ko.codeintel.CompletionUIHandler;
+ cuih.prototype.types.argument = cuih.prototype.types.interface;
+ cuih.prototype.types.environment = cuih.prototype.types.namespace;
+ cuih.prototype.types.file = "chrome://sciviewsk/skin/images/cb_file.png";
+ }, 600);
- addEventListener("load", _setKeybindings, false);
- addEventListener("load", function ()
- setTimeout(_setControllers, 600), false);
+ var osName = Components.classes['@activestate.com/koOs;1']
+ .getService(Components.interfaces.koIOs).name;
+
+ if (!_setKeybindings(false, osName)) // use system specific keybindings
+ _setKeybindings(false, '') // fallback - use default
+
+ sv.socket.serverStart();
+ }
+
+ //addEventListener("load", _setKeybindings, false);
+ //addEventListener("load", function ()
+ // setTimeout(_setControllers, 600), false);
+ addEventListener("load", _this.onLoad, false);
+
+ // Just in case, run a clean-up before quitting Komodo:
+ function svCleanup () sv.socket.serverStop();
+ ko.main.addWillCloseHandler(svCleanup);
+
+// function ObserveR () {
+// var el = document.getElementById('cmd_svRStarted');
+// el.setAttribute("checked", _isRRunning());
+// }
+// addEventListener("r_app_started_closed", ObserveR, false);
+
}).apply(sv.command);
// XXX: for DEBUG only
Modified: komodo/SciViews-K/content/js/pref-R.js
===================================================================
--- komodo/SciViews-K/content/js/pref-R.js 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/js/pref-R.js 2012-05-01 13:06:20 UTC (rev 470)
@@ -23,6 +23,11 @@
// Note: PrefR_OnLoad() used instead
// OnPreferencePageOK(prefset); // User clicks OK
////////////////////////////////////////////////////////////////////////////////
+// TODO: eliminate items not found on the disk for the list of Mac R apps!?
+// TODO: wrong calculation of args + check problems when args is empty
+// TODO: x-terminal-emulator not defined on Mac OS X => R terminal is broken
+// on Mac OS X!
+//
// Prefs to possibly include later on:
// * Address for remote R (sv.socket.host)?
// if not localhost - disable source* commands
@@ -30,6 +35,7 @@
// * R Site search url (%S replaced by topic)
var sv;
+var cancelled = false;
// List of supported R applications
var apps = [
@@ -65,7 +71,7 @@
required:"/Applications/R.app",
platform:"Mac"},
{id:"r64-app", label:"R64 app",
- path:"open -a \"%Path%\" \"%cwd%\"",
+ path:"open -a \"%Path%\" \"%cwd%\"",
app:"R64.app",
required:"/Applications/R64.app",
platform:"Mac"},
@@ -95,7 +101,7 @@
//// Utilities /////////////////////////////////////////////////////////////////
// Used at startup
function _menuListSetValues (attribute) {
- if (!attribute) attribute = 'values';
+ if (!attribute) attribute = 'items';
var ml = document.getElementsByTagName('menulist');
var el, values, v;
for (var i = 0; i < ml.length; i++) {
@@ -148,6 +154,7 @@
rs = ["/Applications/R.app", "/Applications/R64.app",
"/Applications/SciViews R.app", "/Applications/SciViews R64.app",
sv.tools.file.whereIs("R")];
+ // TODO: eliminate items not found on the disk!?
break;
default:
rs = rs.concat(sv.tools.file.whereIs("R"));
@@ -421,11 +428,11 @@
//// Standard interface for preference pages ///////////////////////////////////
-function OnPreferencePageLoading(prefset) {
- // Nothing to do?
+function OnPreferencePageLoading (prefset) {
+ // Nothing to do? PrefR_OnLoad() invoked instead!
}
-function OnPreferencePageOK(prefset) {
+function OnPreferencePageOK (prefset) {
prefset = parent.hPrefWindow.prefset;
// Set R interpreter
@@ -475,14 +482,15 @@
// Restart socket server if running and port or channel changed
var koType = document.getElementById('sciviews.ko.type').value;
- var koPort = document.getElementById('sciviews.ko.port').value;
- if (koPort != prefset.getStringPref("sciviews.ko.port") ||
+ var koPort = parseInt(document.getElementById('sciviews.ko.port').value);
+ if (koPort != prefset.getDoublePref("sciviews.ko.port") ||
koType != sv.serverType) {
// Stop server with old config, if it is started
var isStarted = sv.socket.serverIsStarted;
if (isStarted) sv.socket.serverStop();
- prefset.setStringPref("sciviews.ko.port", koPort);
+ prefset.setDoublePref("sciviews.ko.port", koPort);
prefset.setStringPref("sciviews.ko.type", koType);
+
sv.serverType = koType;
// Start server with new config, if previous one was started
if (isStarted) sv.socket.serverStart();
Modified: komodo/SciViews-K/content/js/prefs.js
===================================================================
--- komodo/SciViews-K/content/js/prefs.js 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/js/prefs.js 2012-05-01 13:06:20 UTC (rev 470)
@@ -37,7 +37,7 @@
"sciviews.r.port": 8888,
"sciviews.r.host": "127.0.0.1",
"sciviews.r.interpreter": "",
- //"sciviews.r.args": "--quiet",
+ "sciviews.r.args": "--quiet",
//"sciviews.r.auto-start": false,
"sciviews.r.batchinterp": "",
"r.csv.dec": ".",
@@ -175,7 +175,7 @@
// Simplify storage of default tooltips for arguments in interpolation queries
this.tip = function (arg, tip) {
- _this.set("dialog-tip-" + arg, tip, true);
+ _this.setPref("dialog-tip-" + arg, tip, true);
}
}).apply(sv.prefs);
Modified: komodo/SciViews-K/content/js/r-help.js
===================================================================
--- komodo/SciViews-K/content/js/r-help.js 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/js/r-help.js 2012-05-01 13:06:20 UTC (rev 470)
@@ -10,6 +10,7 @@
// handle "javascript:" commands.
// original code located in chrome://komodo/content/launch.js
////////////////////////////////////////////////////////////////////////////////
+// TODO: check if this works!!!
// This should be kept updated with new versions of the original function
ko.help.language = function () {
@@ -52,6 +53,7 @@
}
if (command.search(/^\s*javascript:\s*(\S.*)\s*$/) != -1) {
+ // Note that in Komodo 6, interpolateStrings is deprecated in favor of interpolateString!
command = ko.interpolate.interpolateStrings(RegExp.$1);
eval(command);
} else {
Modified: komodo/SciViews-K/content/js/r.js
===================================================================
--- komodo/SciViews-K/content/js/r.js 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/js/r.js 2012-05-01 13:06:20 UTC (rev 470)
@@ -131,7 +131,7 @@
res = sv.socket.rCommandSync(
'cat(localeToCharset()[1], R.version.string, sep = "%%%")');
if (res == null) { // If R is not running...
- sv.r.running = false;
+ window.setTimeout("sv.command.updateRStatus(false);", 500);
// Indicate R should be started, or... is starting!
if (isStarting) {
sv.cmdout.message("R is starting... please wait", 0, false);
@@ -141,6 +141,9 @@
}
return(false);
} else {
+ // Update menus...
+ window.setTimeout("sv.command.updateRStatus(true);", 500);
+
// Split results
var result = res.split("%%%");
// TODO: check we have two results and they match expected strings
@@ -162,7 +165,6 @@
// Change message in R Output
if (showVersion)
sv.cmdout.message(RversionString + " is ready!");
- sv.r.running = true;
return(true);
}
} catch (e) {
@@ -174,7 +176,7 @@
// Function called when R is closed
sv.r.closed = function () {
- sv.r.running = false;
+ window.setTimeout("sv.command.updateRStatus(false);", 500);
// Blank R output
sv.cmdout.message("R has quit!", 0, false);
// Reset statusbar
@@ -867,9 +869,9 @@
// Ask for the filename if not provided
if (!file) {
file = sv.fileOpen("", ".RData",
- sv.translate("Browse for R workspace file"),
+ sv.translate("Browse for R workspace file"),
[sv.translate("R workspace") + " (*.RData)|*.RData"], true);
- } else if (typeof file == "string") {
+ } else if (typeof(file == "string")) {
file = file.split(/[;,]/);
}
if (!file || !file.length) return;
@@ -904,9 +906,10 @@
// Ask for the filename if not provided
if (typeof(file) == "undefined") {
if (typeof(title) == "undefined")
- title = 'Load the history from a file';
- file = ko.filepicker.openFile("", ".Rhistory", title);
- if (file == null) return; // User clicked cancel
+ file = sv.fileOpen("", ".Rhistory",
+ sv.translate("Load an R history from a file"),
+ [sv.translate("R history") + " (*.Rhistory)|*.Rhistory"], false);
+ if (!file || !file.length) return; // User clicked cancel
}
sv.r.eval('loadhistory("' + file.addslashes() + '")');
}
@@ -1562,6 +1565,7 @@
var title = 'Select a Komodo project file (.kpf) to make .pot file';
var Filters = [];
Filters.push("Komodo Project");
+ // TODO: in Ko6, openFile() is deprecated in favor of browseForFile()
kpfFile = ko.filepicker.openFile("", "project.kpf", title,
null, Filters);
}
@@ -1581,6 +1585,7 @@
var title = 'Select a Komodo package file (.kpz) to make .pot file';
var Filters = [];
Filters.push("Komodo Package");
+ // TODO: in Ko6, openFile() is deprecated in favor of browseForFile()
kpzFile = ko.filepicker.openFile("", "package.kpz", title,
null, Filters);
}
@@ -1600,6 +1605,7 @@
var title = 'Select a Komodo project file (.kpf) to translate';
var Filters = [];
Filters.push("Komodo Project");
+ // TODO: in Ko6, openFile() is deprecated in favor of browseForFile()
kpfFile = ko.filepicker.openFile("", "project.kpf", title,
null, Filters);
}
@@ -1619,6 +1625,7 @@
var title = 'Select a Komodo package file (.kpz) to translate';
var Filters = [];
Filters.push("Komodo Package");
+ // TODO: in Ko6, openFile() is deprecated in favor of browseForFile()
kpzFile = ko.filepicker.openFile("", "package.kpz", title,
null, Filters);
}
Modified: komodo/SciViews-K/content/js/robjects.js
===================================================================
--- komodo/SciViews-K/content/js/robjects.js 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/js/robjects.js 2012-05-01 13:06:20 UTC (rev 470)
@@ -1,6 +1,6 @@
// SciViews-K R objects explorer functions
// Define the 'sv.robjects' tree and implement RObjectsOverlay functions
-// Copyright (c) 2009, Kamil Barton & Ph. Grosjean (phgrosjean at sciviews.org)
+// Copyright (c) 2009-2012, K. Barton & Ph. Grosjean (phgrosjean at sciviews.org)
// License: MPL 1.1/GPL 2.0/LGPL 2.1
////////////////////////////////////////////////////////////////////////////////
// sv.robjects namespace (not intended for external use)
@@ -43,6 +43,9 @@
' object = "%OBJ%", all.info = FALSE, compare = FALSE), sep = "' + sep +
'", eol = "\\n")';
+ var print = sv.cmdout.append; /// XXX DEBUG
+ var clear = sv.cmdout.clear; /// XXX DEBUG
+
// This should be changed if new icons are added
var iconTypes = ['array', 'character', 'data.frame', 'Date', 'dist',
'empty', 'factor', 'function', 'glm', 'htest', 'integer', 'list',
@@ -290,7 +293,7 @@
}
function _getObjListCommand (env, objName) {
- var id = sv.pref.getPref("sciviews.ko.id", "sv");
+ var id = sv.prefs.getPref("sciviews.ko.id", "SciviewsK");
var cmd = cmdPattern.replace(/%ID%/g, id)
.replace(/%ENV%/g, new String(env).addslashes())
.replace(/%OBJ%/g, objName? objName.replace(/\$/g, "$$$$") : "");
@@ -576,12 +579,12 @@
document.getElementById(columnName)
.setAttribute("sortDirection", sortDirection);
- if(!root || root == _this.treeData) {
+ if (!root || root == _this.treeData) {
// Sort packages always by name
this.treeData.sort(_sortComparePkgs);
for (var i in this.treeData) {
if (typeof (this.treeData[i].children) == "object")
- _sortRecursive(this.treeData[i].children);
+ _sortRecursive(_this.treeData[i].children);
}
} else if (root.children) _sortRecursive(root.children);
@@ -619,16 +622,21 @@
var vd = this.visibleData;
var item = vd[idx];
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);
+ this.parseObjListResult, item);
return;
}
var rowsChanged;
var iLevel = item.level;
- if (!item.childrenLength) return;
+ if (!item.childrenLength) {
+ item.isContainer = item.origItem.isOpen = false;
+ return;
+ }
if (item.origItem.isOpen) { // Closing subtree
var k;
@@ -701,7 +709,7 @@
};
this.isContainerOpen = function (idx) {
- return(this.visibleData[idx].origItem.isOpen);
+ return(_this.visibleData[idx].origItem.isOpen);
};
this.isContainerEmpty = function (idx) {
@@ -825,7 +833,7 @@
} else {
return(false);
}
- pos = _this.searchPaths.indexOf(path);
+ pos = _this.searchPath.indexOf(path);
if (pos == -1) return(false);
document.getElementById("sciviews_robjects_searchpath_listbox")
@@ -873,20 +881,20 @@
// Callback to process the list of packages in the search path from R
this.processPackageList = function _processPackageList (data) {
if (data == "") return;
- _this.searchPaths = data.replace(/[\n\r]/g, "").split(sep);
+ _this.searchPath = data.replace(/[\n\r]/g, "").split(sep);
_this.displayPackageList();
};
// Display the list of packages in the search path
this.displayPackageList = function () {
- // 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");
+ var selectedLabel = node.selectedItem? node.selectedItem.label : null;
+
while (node.firstChild)
node.removeChild(node.firstChild);
- var packs = _this.searchPaths;
+ var packs = _this.searchPath;
var selectedPackages = _this.treeData.map(function(x) x.name);
// Display at least .GlobalEnv
if (!selectedPackages.length) selectedPackages.push(".GlobalEnv");
@@ -913,7 +921,7 @@
// Clear the list of packages on the search path (when quitting R)
this.clearPackageList = function () {
- _this.searchPaths = [];
+ _this.searchPath = [];
_this.displayPackageList();
_this.parseObjListResult("Env=.GlobalEnv\nObj=\n");
}
@@ -936,7 +944,7 @@
}
if (!box.collapsed) {
- //if (!_this.searchPaths.length) _this.getPackageList();
+ //if (!_this.searchPath.length) _this.getPackageList();
_this.smartRefresh();
}
}
@@ -1240,7 +1248,7 @@
// Select only objects:
obj = obj.filter(function (x) {
if (x.type != "object") {
- _this.selection.toggleSelect(x.index); return false
+ _this.selection.toggleSelect(x.index); return(false)
} else {
return(true);
}
@@ -1271,8 +1279,8 @@
// PhG: I want the simplest syntax as possible
//var cmd = 'save(list = c(' + obj.map(function(x) '"' + x.name + '"')
// .join(',') + '), file = "' + fileName.addslashes() + '")';
- var cmd = 'save(' + obj.name.join(', ') + ', file = "' +
- fileName.addslashes() + '")';
+ var cmd = 'save(list=c(' + obj.map(function(x) '"' + x.name + '"')
+ .join(',') + '), file = "' + fileName.addslashes() + '")';
sv.r.eval(cmd);
break;
@@ -1321,9 +1329,9 @@
if (obj[i].env == ".GlobalEnv") {
cmds.push(action + "(" + obj[i].fullName + ")");
} else {
- cmds.push(action + "evalq(" + obj[i].fullName +
+ cmds.push(action + "(evalq(" + obj[i].fullName +
", envir = as.environment(\"" +
- obj[i].env.addslashes() + "\"))");
+ obj[i].env.addslashes() + "\")))");
}
}
sv.r.eval(cmds.join("\n"));
@@ -1492,7 +1500,7 @@
if (event.target.tagName != 'listitem')
return(false);
- var text = _this.searchPaths[document
+ var text = _this.searchPath[document
.getElementById("sciviews_robjects_searchpath_listbox")
.selectedIndex];
transferData.data = new TransferData();
@@ -1521,11 +1529,12 @@
var listItem = listbox.selectedItem;
var pkg = listItem.getAttribute("label");
- if (pkg == ".GlobalEnv" || pkg == "TempEnv") return;
+ if (pkg == ".GlobalEnv" || pkg == "TempEnv" || pkg == "Autoloads")
+ return;
sv.r.evalCallback(
'tryCatch(detach("' + pkg.addslashes() +
- '"), error = function (e) cat("<error>"));',
+ '", unload = TRUE), error = function (e) cat("<error>"));',
function _packageListKeyEvent_callback (data) {
sv.log.debug(data);
if (data.trim() != "<error>") {
Modified: komodo/SciViews-K/content/js/sciviews.js
===================================================================
--- komodo/SciViews-K/content/js/sciviews.js 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/js/sciviews.js 2012-05-01 13:06:20 UTC (rev 470)
@@ -80,7 +80,7 @@
sv.showVersion = true;
-sv._compareVersions = function(a, b) Components
+sv._compareVersion = function(a, b) Components
.classes["@mozilla.org/xpcom/version-comparator;1"]
.getService(Components.interfaces.nsIVersionComparator).compare(a, b);
@@ -511,10 +511,12 @@
sv.alert(sv.translate("Nothing is selected!"));
return(false);
} else {
+ // Note that in Komodo 6, interpolateStrings is deprecated in favor of interpolateString!
sel = ko.interpolate.interpolateStrings('%W');
}
} else {
// Get the URL-escaped selection
+ // Note that in Komodo 6, interpolateStrings is deprecated in favor of interpolateString!
sel = ko.interpolate.interpolateStrings('%S');
}
var helpURL = URL.replace("<keyword>", sel);
Modified: komodo/SciViews-K/content/js/socket.js
===================================================================
--- komodo/SciViews-K/content/js/socket.js 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/js/socket.js 2012-05-01 13:06:20 UTC (rev 470)
@@ -649,7 +649,7 @@
" unmanaged error");
}
}
-
+
// Core function for the SciViews-K socket/file server
// Create the _serverSocket object
// TODO: it does not handle correctly conversion
@@ -658,8 +658,9 @@
if (_this.debug) sv.log.debug("Socket/file server: serverStart");
try {
- _serverSocket.close();
+ if (typeof(_serverSocket) != "undefined") _serverSocket.close();
} catch(e) {
+ // Note that this is not an error => activate this only for debugging
sv.log.exception(e, "sv.socket.serverStart() failed to close the" +
" socket/file before reopening it");
}
@@ -763,8 +764,8 @@
try {
_serverSocket.close();
} catch(e) {
- sv.log.exception(e, "Socket server: serverStop() cannot" +
- " close the socket", true);
+ sv.log.exception(e, "Socket server: serverStop()" +
+ " cannot close the socket", true);
}
}
}
@@ -827,5 +828,5 @@
}).apply(sv.socket);
// Launch the SciViews socket server on Komodo startup
-addEventListener("load", function()
- window.setTimeout("sv.socket.serverStart();", 500), false);
+//addEventListener("load", function()
+// window.setTimeout("sv.socket.serverStart();", 500), false);
Modified: komodo/SciViews-K/content/keybindings-mac.kkf
===================================================================
--- komodo/SciViews-K/content/keybindings-mac.kkf 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/keybindings-mac.kkf 2012-05-01 13:06:20 UTC (rev 470)
@@ -26,4 +26,4 @@
binding cmd_svRObjRefreshDisplay Meta+P
binding cmd_svRActiveDF Meta+D
-binding cmd_svRLoadDF Meta+L
+#No! This is cmd_gotoLine! binding cmd_svRLoadDF Meta+L
Modified: komodo/SciViews-K/content/keybindings.kkf
===================================================================
--- komodo/SciViews-K/content/keybindings.kkf 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/keybindings.kkf 2012-05-01 13:06:20 UTC (rev 470)
@@ -26,4 +26,4 @@
binding cmd_svRObjRefreshDisplay Ctrl+P
binding cmd_svRActiveDF Ctrl+D
-binding cmd_svRLoadDF Ctrl+L
+#No! cmd_gotoLine?! binding cmd_svRLoadDF Ctrl+L
Modified: komodo/SciViews-K/content/pref-R.xul
===================================================================
--- komodo/SciViews-K/content/pref-R.xul 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/pref-R.xul 2012-05-01 13:06:20 UTC (rev 470)
@@ -33,7 +33,7 @@
***** END LICENSE BLOCK ***** -->
-<!-- SciViews-K preference page -->
+<!-- SciViews-K preference page to configure R interpreter -->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://komodo/skin/" type="text/css"?>
@@ -45,8 +45,8 @@
<?xml-stylesheet href="chrome://komodo/skin/prefs/prefs.css" type="text/css"?>
<window xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- class="kodialog" orient="vertical" onload="PrefR_OnLoad(event);">
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ class="kodialog" orient="vertical" onload="PrefR_OnLoad();">
<script src="chrome://komodo/content/library/trace.js" type="application/x-javascript"/>
<script src="chrome://komodo/content/library/logging.js" type="application/x-javascript"/>
@@ -58,7 +58,7 @@
<box class="kobox-smallheader" title="R interpreter configuration"/>
- <vbox flex="1" class="autoscroll">
+ <vbox id="r-prefs-vbox" flex="1" class="autoscroll">
<groupbox orient="vertical">
<caption label="Default R Interpreter"/>
@@ -130,14 +130,14 @@
<row align="center">
<label value="Decimal separator" control="r.csv.dec"/>
<menulist pref="true" id="r.csv.dec"
- values=", ." persist="values" maxValues="3">
+ items=", ." persist="items" 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) PrefR_editMenulist(this);"
onblur="PrefR_editMenulist(this);"
- values=", ; \t" persist="values" maxValues="5">
+ items=", ; \t" persist="items" maxValues="5">
<menupopup />
</menulist>
</row>
@@ -161,7 +161,7 @@
</groupbox>
<groupbox orient="vertical" align="left">
- <caption label="Miscellanous"/>
+ <caption label="Miscellaneous"/>
<label value="Startup packages"/>
<vbox align="left">
@@ -210,9 +210,9 @@
<hbox align="center">
<label value="Server type:" control="sciviews.r.type"/>
<menulist pref="true" id="sciviews.r.type"
- values="http socket" persist="values">
+ items="http socket" persist="items">
<menupopup />
- </menulist>
+ </menulist>
</hbox>
<grid>
@@ -238,7 +238,7 @@
<hbox align="center">
<label value="Client type:" control="sciviews.ko.type"/>
<menulist pref="true" id="sciviews.ko.type"
- values="file socket" persist="values">
+ items="file socket" persist="items">
<menupopup />
</menulist>
</hbox>
Deleted: komodo/SciViews-K/content/rObjects2Pane.xul
===================================================================
--- komodo/SciViews-K/content/rObjects2Pane.xul 2012-04-21 10:44:31 UTC (rev 469)
+++ komodo/SciViews-K/content/rObjects2Pane.xul 2012-05-01 13:06:20 UTC (rev 470)
@@ -1,335 +0,0 @@
-<?xml version="1.0"?>
- <!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License
- Version 1.1 (the "License"); you may not use this file except in
- compliance with the License. You may obtain a copy of the License at
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/sciviews -r 470
More information about the Sciviews-commits
mailing list