[Sciviews-commits] r196 - in komodo/SciViews-K/content/js: . tools
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Sep 24 15:43:47 CEST 2009
Author: prezez
Date: 2009-09-24 15:43:47 +0200 (Thu, 24 Sep 2009)
New Revision: 196
Modified:
komodo/SciViews-K/content/js/commands.js
komodo/SciViews-K/content/js/r-help.js
komodo/SciViews-K/content/js/r.js
komodo/SciViews-K/content/js/tools/file.js
Log:
Added: sv.tools.file.getURI(nsIFile),
modified sv.command.openHelp to handle paths properly.
Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js 2009-09-20 23:47:24 UTC (rev 195)
+++ komodo/SciViews-K/content/js/commands.js 2009-09-24 13:43:47 UTC (rev 196)
@@ -25,7 +25,8 @@
function _keepCheckingR (stopMe) {
clearInterval(sv.r.testInterval);
if (!stopMe) {
- sv.r.testInterval = window.setInterval(sv.r.test, 1000);
+ // checking every second may cause problems when R is busy, changed to 5000
+ sv.r.testInterval = window.setInterval(sv.r.test, 5000);
}
setTimeout(window.updateCommands, 1000, 'r_app_started_closed');
}
@@ -327,6 +328,9 @@
RHelpWin.focus();
}
} else {
+ // Webpage should be of the form: file:///
+ webpage = sv.tools.file.getURI(sv.tools.file.getfile(webpage.replace(/\//g, "\\")));
+
// We want to display a specific page
if (typeof(RHelpWin) == "undefined" || RHelpWin.closed) {
RHelpWin = window.openDialog(
@@ -523,4 +527,4 @@
}).apply(sv.command);
addEventListener("load", sv.command.setControllers, false);
-addEventListener("load", sv.command.setKeybindings, false);
\ No newline at end of file
+addEventListener("load", sv.command.setKeybindings, false);
Modified: komodo/SciViews-K/content/js/r-help.js
===================================================================
--- komodo/SciViews-K/content/js/r-help.js 2009-09-20 23:47:24 UTC (rev 195)
+++ komodo/SciViews-K/content/js/r-help.js 2009-09-24 13:43:47 UTC (rev 196)
@@ -1,11 +1,14 @@
// SciViews-K R functions
// Define functions to pilot R from Komodo Edit 'sv.r' & 'sv.r.pkg'
-// Copyright (c) 2009, Kamil Barton
+// based on original Komodo code
+// Copyright (c) 2000-2007, ActiveState Software Inc
+// Copyright (c) 2009, Kamil Bartoñ
// License: MPL 1.1/GPL 2.0/LGPL 2.1
////////////////////////////////////////////////////////////////////////////////
// ko.help.language(); // Replacement for language specific help on selection
- //function (cmd_helpLanguage command) to handle R help
- // without using system command
+ //function (cmd_helpLanguage command) extended to
+ //handle "javascript:" commands.
+// original code located in chrome://komodo/content/launch.js
////////////////////////////////////////////////////////////////////////////////
// This should be kept updated with new versions of the original function
Modified: komodo/SciViews-K/content/js/r.js
===================================================================
--- komodo/SciViews-K/content/js/r.js 2009-09-20 23:47:24 UTC (rev 195)
+++ komodo/SciViews-K/content/js/r.js 2009-09-24 13:43:47 UTC (rev 196)
@@ -250,6 +250,7 @@
}
// Set the current working directory (to current buffer dir, or ask for it)
+// TODO: make it update sv.prefs.setSession?
sv.r.setwd = function (dir, ask, type) {
// TODO: simplify this:
// for compatibility with previous versions
@@ -503,6 +504,7 @@
}
// The callback for sv.r.calltip
+//TODO: make private
sv.r.calltip_show = function (tip) {
if (tip != "") {
//ko.statusBar.AddMessage(tip, "R", 2000, true);
@@ -513,9 +515,9 @@
}
// AutoComplete mechanism for R
+// deprecated??
sv.r.complete = function (code) {
- //if (ko.views.manager.currentView.languageObj.name != "R")
- // return false;
+
// If code is not defined, get currently edited code
if (typeof(code) == "undefined" | code == "") {
code = sv.getTextRange("codefrag");
@@ -524,7 +526,6 @@
var scimoz = ko.views.manager.currentView.scimoz;
var cmd = 'Complete("' + code + '", print = TRUE, types = "scintilla")';
- //sv.log.debug(cmd);
var res = sv.r.evalCallback(cmd, function(autoCstring) {
// these should be set only once?:
@@ -535,7 +536,6 @@
autoCstring = autoCstring.replace(/^(.*)[\r\n]+/, "");
var trigPos = RegExp.$1;
- //var trigPos = RegExp.$1.split(/;/g)[1];
autoCstring = autoCstring.replace(/\r?\n/g, autoCSeparatorChar);
@@ -559,6 +559,7 @@
// Display R objects in different ways
// TODO: allow custom methods + arguments + forcevisible + affect to var
+// TODO: this duplicates rObjectsTree.do(), so do something with it
sv.r.display = function (topic, what) {
var res = false;
if (typeof(topic) == "undefined" | topic == "") topic = sv.getText();
@@ -637,6 +638,7 @@
}
// Run the example for selected item
+// TODO: merge with sv.r.help
sv.r.example = function (topic) {
var res = false;
if (typeof(topic) == "undefined" | topic == "") topic = sv.getText();
@@ -673,6 +675,7 @@
}
// The callback for sv.r.search
+//TODO: make private
sv.r.search_select = function (topics) {
ko.statusBar.AddMessage("", "R");
var res = false;
@@ -1412,6 +1415,7 @@
}
// Select CRAN mirror
+//TODO: remove?
sv.r.pkg.CRANmirror = function () {
sv.r.pkg.chooseCRANMirror(false);
}
@@ -1564,6 +1568,7 @@
}
// The callback for sv.r.pkg.unload
+//TODO: make private
sv.r.pkg.unload_select = function (pkgs) {
ko.statusBar.AddMessage("", "R");
var res = false;
@@ -1671,6 +1676,7 @@
}
// Install R packages from local files (either source, or binaries)
+// TODO: combine with: sv.r.pkg.install
sv.r.pkg.installLocal = function () {
var res = false;
// Get list of files to install
@@ -1697,6 +1703,7 @@
}
// Install the SciViews bundle from CRAN
+// TODO: combine with: sv.r.pkg.install
sv.r.pkg.installSV = function () {
var res = false;
res = sv.r.eval('install.packages(c("svMisc", "svSocket", "svGUI", "svIDE"' +
@@ -1707,6 +1714,7 @@
}
// Install the latest development version of Sciviews packages from R-Forge
+// TODO: combine with: sv.r.pkg.install
sv.r.pkg.installSVrforge = function () {
var res = false;
var response = ko.dialogs.customButtons(
Modified: komodo/SciViews-K/content/js/tools/file.js
===================================================================
--- komodo/SciViews-K/content/js/tools/file.js 2009-09-20 23:47:24 UTC (rev 195)
+++ komodo/SciViews-K/content/js/tools/file.js 2009-09-24 13:43:47 UTC (rev 196)
@@ -206,6 +206,13 @@
} catch (e) { return null; }
}
+ this.getURI = function(file) {
+ var ios = Components.classes["@mozilla.org/network/io-service;1"].
+ getService(Components.interfaces.nsIIOService);
+ var URL = ios.newFileURI(file);
+ return URL.spec;
+ }
+
// Read data from an URI
this.readURI = function (uri) {
var fileSvc = Components.classes["@activestate.com/koFileService;1"]
More information about the Sciviews-commits
mailing list