[Sciviews-commits] r260 - in komodo/SciViews-K: . content/js defaults
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat May 1 16:39:37 CEST 2010
Author: prezez
Date: 2010-05-01 16:39:36 +0200 (Sat, 01 May 2010)
New Revision: 260
Added:
komodo/SciViews-K/sciviewsk-0.9.15-slim-ko.xpi
Modified:
komodo/SciViews-K/content/js/commands.js
komodo/SciViews-K/content/js/prefs.js
komodo/SciViews-K/defaults/svSocket_0.9-48.tar.gz
komodo/SciViews-K/defaults/svSocket_0.9-48.zip
komodo/SciViews-K/defaults/svStart.R
komodo/SciViews-K/install.rdf
Log:
Max supported Komodo version changed to 6.*. (Seems to work ok with Komodo 6.0.0-alpha2)
(version number increased to 0.9.15).
Added xpi with somewhat thinned version of sciviewsk (my proposition is to move GUI enhancements not essential for interfacing R to a separate package (?))
Minor fixes.
Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js 2010-04-30 19:26:16 UTC (rev 259)
+++ komodo/SciViews-K/content/js/commands.js 2010-05-01 14:39:36 UTC (rev 260)
@@ -61,7 +61,7 @@
}
// private methods
- // continuous checking is now disabled - R often hanged
+ // continuous checking is now disabled - R often hanged
function _keepCheckingR (stopMe) {
/*
//clearInterval(sv.r.testInterval);
@@ -108,7 +108,7 @@
// trim just in case
var path = sv.tools.strings.trim(sv.prefs.getString("svRDefaultInterpreter"));
- if (!path) {
+ if (!path || (sv.tools.file.exists(path) == sv.tools.file.TYPE_FILE)) {
if(ko.dialogs.okCancel(
sv.translate("Default R interpreter is not set in " +
"Preferences. Do you want to do it now?"),
Modified: komodo/SciViews-K/content/js/prefs.js
===================================================================
--- komodo/SciViews-K/content/js/prefs.js 2010-04-30 19:26:16 UTC (rev 259)
+++ komodo/SciViews-K/content/js/prefs.js 2010-05-01 14:39:36 UTC (rev 260)
@@ -78,17 +78,27 @@
// R interpreter
sv.prefs.setString("svRDefaultInterpreter", "", false);
-sv.prefs.setString("svRApplication", "", false);
+sv.prefs.setString("svRApplication", null, false);
+
+var svRDefaultInterpreter = sv.prefs.getString("svRDefaultInterpreter", "");
+
// Default R interpreter Id: use a reasonable default, given the platform
if (navigator.platform.indexOf("Win") === 0) {
sv.prefs.setString("svRApplicationId", "r-gui", false);
+ if (!svRDefaultInterpreter)
+ svRDefaultInterpreter = sv.tools.file.whereIs("Rgui");
+
} else {
sv.prefs.setString("svRApplicationId", "r-terminal", false);
+ if (!svRDefaultInterpreter)
+ svRDefaultInterpreter = sv.tools.file.whereIs("R");
}
+sv.prefs.setString("svRDefaultInterpreter", svRDefaultInterpreter, false);
+
sv.prefs.setString("CRANMirror", "http://cran.r-project.org/", false);
+sv.prefs.setString("RHelpCommand", "javascript:sv.r.help(\"%w\")", false);
-
// This is required by sv.helpContext() for attaching help to snippets (hack!)
// Create empty preference sets to be used with snippet help system hack
// [[%pref:R-help:value]] which displays nothing when the snippet is used
Modified: komodo/SciViews-K/defaults/svSocket_0.9-48.tar.gz
===================================================================
(Binary files differ)
Modified: komodo/SciViews-K/defaults/svSocket_0.9-48.zip
===================================================================
(Binary files differ)
Modified: komodo/SciViews-K/defaults/svStart.R
===================================================================
--- komodo/SciViews-K/defaults/svStart.R 2010-04-30 19:26:16 UTC (rev 259)
+++ komodo/SciViews-K/defaults/svStart.R 2010-05-01 14:39:36 UTC (rev 260)
@@ -1,41 +1,40 @@
### SciViews install begin ###
# SciViews-R installation and startup for running R with Komodo/SciViews-K
# Version 0.9.11, 2010-02-09 Ph. Grosjean (phgrosjean at sciviews.org)
+# Version 0.9.15, 2010-05-01 mod by K. Barton
-# 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
-# the beginning.
-# Since we try to install packages from within .Rprofile, this results in an endless loop,
-# and even sometimes crashes system (!!!).
-
# TODO: also use value in koDebug to debug server from within R!
"svStart" <-
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"),
+ # NOTE: minVersion is now also used as a list of required packages
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.
pkg.dir = ".",
- debug = Sys.getenv("koDebug") == "TRUE") {
+ debug = Sys.getenv("koDebug") == "TRUE",
+ pkgsLast = c("svGUI", "ellipse", "SciViews") # to be loaded at end
+ ) {
- # [KB]For some reason checking for existence of svStart or any other variable did not work
- # for me. Another try: create a semaphore file ("lock-file"), and if it exists jump out the function.
- # I put "the gatekeeper" code inside the function, because when it was in Rprofile and if
- # svStart exited prematurely due to some error, the lock-file remained.
- # Another way would be enclosing svStart in try(), but I think with on.exit
- # svStart is stand-alone, and can be even be run manually. Which is useful
- # if something goes wrong at the first run, so user does not have to restart
- # R, just run svStart again. For this reason svStart could be included in
- # svGUI rather than here. Philippe, what do you think?
+ # needed later for tryCatch'ing:
+ "err.null" <- function (e) return(NULL)
# 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)
+ # TODO: 00LOCK should be best deleted with StartR command from Komodo
+
path0 <- getwd()
lockfile <- file.path(path0, "00LOCK")
- if (file.exists(lockfile)) return (invisible(NULL))
+ if (file.exists(lockfile)) {
+ # We can safely assume that running svStart will not take more that 5 minutes,
+ # if 00LOCK is older, it means something went wrong previously, so we simply disregard it
+ if(difftime(Sys.time(), file.info(lockfile)[,"mtime"], units="mins") < 5) {
+ return (invisible(NULL))
+ } else {
+ file.remove(lockfile)
+ }
+ }
file.create(lockfile)
on.exit(file.remove(lockfile)) # Clean up
@@ -185,8 +184,9 @@
# 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
- # We now also need ellipse and SciViews
- pkgs <- c("svMisc", "svSocket", "svGUI", "ellipse", "SciViews")
+ pkgs <- names(minVersion)
+ pkgs <- pkgs[!(pkgs %in% "R")]
+
ext <- switch(.Platform$pkgType, # There is a problem on some Macs
# => always install from sources there! mac.binary = "\\.tgz",
win.binary = "\\.zip", "\\.tar\\.gz")
@@ -246,10 +246,10 @@
fields = "Version"), minVersion[pkgName]) < 0) {
if (!pkgIsInstalled) {
cat("Installing missing package", sQuote(pkgName),
- "into", lib, "\n")
+ "into", sQuote(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
@@ -261,13 +261,16 @@
}
})
+ # Split pkgs to primary and secondary
+ pkgsPrimary <- pkgs[!(pkgs %in% pkgsLast)]
+ pkgsSecondary <- pkgs[pkgs %in% pkgsLast]
+
# Do not load svGUI yet
- res <- sapply(c("svMisc", "svSocket"), function(pkgName)
+ res <- sapply(pkgsPrimary, function(pkgName)
require(pkgName, quietly = TRUE, character.only = TRUE))
if (!all(res)) {
- cat("Problem loading package(s):", paste(c("svMisc", "svSocket")[!res],
- collapse = ", "), "\n")
+ cat("Problem loading package(s):", paste(pkgsPrimary[!res], collapse = ", "), "\n")
} else {
# Try starting the R socket server now
res <- !inherits(try(startSocketServer(port = getOption("ko.serve")),
@@ -281,20 +284,19 @@
} else {
# Finally, load svGUI, MASS and SciViews
- res <- require("svGUI", quietly = TRUE)
- res[2] <- require("MASS", quietly = TRUE)
- res[3] <- require("SciViews", quietly = TRUE)
+ res <- sapply(pkgsSecondary, function(pkgName)
+ require(pkgName, quietly = TRUE, character.only = TRUE))
+
if (all(res)) {
cat("R is SciViews ready!\n")
assignTemp(".SciViewsReady", TRUE)
# Indicate what we have as default packages
- options(defaultPackages = c("datasets", "utils",
- "grDevices", "graphics", "stats", "methods", "tools",
- "tcltk", "svMisc", "svSocket", "svGUI", "MASS", "SciViews"))
+ options(defaultPackages =
+ unique(c(getOption("defaultPackages"), "tcltk", pkgs)))
} else {
- cat("R is not SciViews ready, install latest svMisc,",
- "svSocket, svGUI, ellipse & SciViews packages\n")
+ cat("R is not SciViews ready, install latest",
+ paste(pkgs, collapse=", "), "packages\n")
}
}
}
@@ -339,9 +341,6 @@
# from the Windows registry :-(
# Try several ways to get Komodo path from registry.
- # Tested only on XP. Most likely the keys are different on
- # Vista/Windows7!
- "err.null" <- function (e) return(NULL)
key <- "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\komodo.exe"
Komodo <-
tryCatch(readRegistry(key, hive = "HLM")[["(Default)"]],
@@ -427,9 +426,13 @@
assignTemp("getHelpURL", function(x, ...) {
file <- as.character(x)
if (length(file) == 0) return("")
+ # Extension ".html" may be missing
+ htmlfile <- basename(file)
+ if(substring(htmlfile, nchar(htmlfile) -4) != ".html")
+ htmlfile <- paste(htmlfile, ".html", sep="")
return(paste("http://127.0.0.1:", tools:::httpdPort,
"/library/", basename(dirname(dirname(file))),
- "/html/", basename(file), sep = ""))
+ "/html/", htmlfile, sep = ""))
})
# print method of object returned by help() is very unflexible for R.app and
@@ -515,7 +518,9 @@
# Update info in Komodo:
debugMsg("Contacting Komodo with koCmd")
invisible(koCmd("sv.socket.updateCharset();"))
- invisible(koCmd("sv.cmdout.message(\"R is started\", 2000);"))
+ invisible(koCmd("sv.cmdout.append('R is started');"))
+ invisible(koCmd("sv.command.updateRStatus(true);"))
+
}
return(invisible(res))
}
Modified: komodo/SciViews-K/install.rdf
===================================================================
--- komodo/SciViews-K/install.rdf 2010-04-30 19:26:16 UTC (rev 259)
+++ komodo/SciViews-K/install.rdf 2010-05-01 14:39:36 UTC (rev 260)
@@ -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.14</em:version>
+ <em:version>0.9.15</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>
@@ -16,16 +16,16 @@
<Description>
<!-- Komodo IDE's uuid -->
<em:id>{36E66FA0-F259-11D9-850E-000D935D3368}</em:id>
- <em:minVersion>4.1</em:minVersion>
- <em:maxVersion>5.*</em:maxVersion>
+ <em:minVersion>5.0</em:minVersion>
+ <em:maxVersion>6.*</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<!-- Komodo Edit's uuid -->
<em:id>{b1042fb5-9e9c-11db-b107-000d935d3368}</em:id>
- <em:minVersion>4.1</em:minVersion>
- <em:maxVersion>5.*</em:maxVersion>
+ <em:minVersion>5.0</em:minVersion>
+ <em:maxVersion>6.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
Added: komodo/SciViews-K/sciviewsk-0.9.15-slim-ko.xpi
===================================================================
(Binary files differ)
Property changes on: komodo/SciViews-K/sciviewsk-0.9.15-slim-ko.xpi
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
More information about the Sciviews-commits
mailing list