[Sciviews-commits] r191 - komodo/SciViews-K komodo/SciViews-K/content/js pkg/svGUI pkg/svGUI/R pkg/svSocket pkg/svSocket/R pkg/svSocket/man pkg/svUnit pkg/svUnit/R pkg/svUnit/inst/doc

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Sep 18 01:20:28 CEST 2009


Author: phgrosjean
Date: 2009-09-18 01:20:28 +0200 (Fri, 18 Sep 2009)
New Revision: 191

Added:
   pkg/svSocket/R/svTaskCallbackManager.R
   pkg/svSocket/man/svTaskCallbackManager.Rd
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/robjects.js
   komodo/SciViews-K/content/js/socket.js
   komodo/SciViews-K/sciviewsk-0.8.1-ko.xpi
   pkg/svGUI/DESCRIPTION
   pkg/svGUI/NEWS
   pkg/svGUI/R/guiInstall.R
   pkg/svGUI/R/guiRefresh.R
   pkg/svGUI/R/guiUninstall.R
   pkg/svSocket/DESCRIPTION
   pkg/svSocket/NAMESPACE
   pkg/svSocket/NEWS
   pkg/svSocket/R/processSocket.R
   pkg/svSocket/R/svSocket-Internal.R
   pkg/svSocket/man/processSocket.Rd
   pkg/svUnit/DESCRIPTION
   pkg/svUnit/NEWS
   pkg/svUnit/R/svUnit-internal.R
   pkg/svUnit/inst/doc/svUnit.pdf
Log:
Final touch on task callbacks for autoupdate of R objects explorer and active data frame lists

Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js	2009-09-16 11:42:45 UTC (rev 190)
+++ komodo/SciViews-K/content/js/commands.js	2009-09-17 23:20:28 UTC (rev 191)
@@ -24,7 +24,7 @@
 	function _keepCheckingR (stopMe) {
 		clearInterval(sv.r.testInterval);
 		if (!stopMe) {
-			sv.r.testInterval = window.setInterval(sv.r.test, 10000);
+			sv.r.testInterval = window.setInterval(sv.r.test, 1000);
 		}
 		setTimeout(window.updateCommands, 1000, 'r_app_started_closed');
 	}
@@ -187,6 +187,10 @@
 			observerSvc.addObserver(this, 'status_message', false);
 			sv.log.debug("R has been started with command: " + command);
 			sv.r.running = true;
+			sv.socket.updateCharset(true);
+			// Possibly refresh the GUI by running SciViews-specific
+			// R task callbacks and make sure R Objects pane is updated
+			sv.r.evalHidden("try(guiRefresh(force = TRUE), silent = TRUE)");
 	
 			//xtk.domutils.fireEvent(window, 'r_app_started_closed');
 			window.updateCommands('r_app_started_closed');

Modified: komodo/SciViews-K/content/js/prefs.js
===================================================================
--- komodo/SciViews-K/content/js/prefs.js	2009-09-16 11:42:45 UTC (rev 190)
+++ komodo/SciViews-K/content/js/prefs.js	2009-09-17 23:20:28 UTC (rev 191)
@@ -106,9 +106,19 @@
 
 // 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", "df1", false);
-sv.prefs.setString("r.active.lm", "lm1", false);
+sv.prefs.setString("r.active.data.frame", "<df>", true);
+sv.prefs.setString("r.active.lm", "<lm>", true);
+ko.statusBar.AddMessage("Data: <none>, linear model: <none>", "Rref", 0, false);
+sv.prefs.mru("var", true, "", "|");
+sv.prefs.mru("var2", true, "", "|");
+sv.prefs.mru("x", true, "", "|");
+sv.prefs.mru("x2", true, "", "|");
+sv.prefs.mru("y", true, "", "|");
+sv.prefs.mru("factor", true, "", "|");
+sv.prefs.mru("factor2", true, "", "|");
+sv.prefs.mru("blockFactor", true, "", "|");
 
+
 //// (re)initialize a series of MRU for snippets' %ask constructs //////////////
 // TODO: defaultMRU for ts, data, table, ...
 

Modified: komodo/SciViews-K/content/js/r.js
===================================================================
--- komodo/SciViews-K/content/js/r.js	2009-09-16 11:42:45 UTC (rev 190)
+++ komodo/SciViews-K/content/js/r.js	2009-09-17 23:20:28 UTC (rev 191)
@@ -46,6 +46,7 @@
 // sv.r.obj(objClass); // Set active object for objClass (data.frame if omitted)
 // sv.r.obj_select(data); // The callback for sv.r.obj() to select an object
 // sv.r.obj_refresh_dataframe(data); // Refresh active data frame's MRUs
+// sv.r.obj_message(); // Refresh statusbar message about active df and lm
 // sv.r.initSession(dir, datadir, scriptdir, reportdir);
 // sv.r.setSession(dir, datadir, scriptdir, reportdir, saveOld, loadNew);
                     // Initialize R session with corresponding directories
@@ -135,7 +136,14 @@
 					} else { 				// Just run this command
 						sv.r.eval(cmd);
 					}
+				} else {
+					// Possibly refresh the GUI by running SciViews-specific
+					// R task callbacks and make sure R Objects pane is updated
+					sv.r.evalHidden("try(guiRefresh(force = TRUE), " +
+						"silent = TRUE)");
 				}
+				// Make sure the R Objects explorer is updated
+				
 			}
 			//xtk.domutils.fireEvent(window, 'r_app_started_closed');
 			window.updateCommands('r_app_started_closed');
@@ -895,6 +903,8 @@
 					//	"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(); 
 				}
 			}
 		}
@@ -902,13 +912,24 @@
 	return(res);
 }
 
+// Display which objects (data frame and lm model, as for Rcmdr) are currently
+// active in the Komodo statusbar
+sv.r.obj_message = function () {
+	var df = sv.prefs.getString("r.active.data.frame", "<none>");
+	if (df == "<df>") df = "<none>";
+	var lm = sv.prefs.getString("r.active.lm", "<none>")
+	if (lm == "<lm>") lm = "<none>";
+	ko.statusBar.AddMessage("Data: " + df + ", linear model: " + lm, "Rref", 0,
+		false);
+}
+
 // Callback for sv.r.obj_select to refresh the MRUs associated with data frames
 sv.r.obj_refresh_dataframe = function (data) {
 	ko.statusBar.AddMessage("", "R");
 	// If we got nothing, then the object does not exists any more... clear MRUs
 	if (data == "<<<data>>>") {
 		var oldobj = sv.prefs.getString("r.active.data.frame", "");
-		sv.prefs.setString("r.active.data.frame", "df1", true); // Default value
+		sv.prefs.setString("r.active.data.frame", "<df>", true); // Default value
 		sv.prefs.mru("var", true, "", "|");
 		sv.prefs.mru("var2", true, "", "|");
 		sv.prefs.mru("x", true, "", "|");
@@ -917,9 +938,8 @@
 		sv.prefs.mru("factor", true, "", "|");
 		sv.prefs.mru("factor2", true, "", "|");
 		sv.prefs.mru("blockFactor", true, "", "|");
-		// Display a message
-		ko.statusBar.AddMessage("Active data frame '" + oldobj + "' removed",
-			"R", 10000, true);
+		// Update message in the statusbar
+		sv.r.obj_message();
 		return(false);
 	}
 	
@@ -957,9 +977,8 @@
 	sv.prefs.mru("factor", true, facts, "|");
 	sv.prefs.mru("factor2", true, facts, "|");
 	sv.prefs.mru("blockFactor", true, facts, "|");
-	// Report which object is currently active (TODO: indicate this in obj explorer)
-	ko.statusBar.AddMessage("Active " + objclass +
-		": " + objname, "R", 20000, true);
+	// Update message in the statusbar
+	sv.r.obj_message();
 	return(true);
 }
 

Modified: komodo/SciViews-K/content/js/robjects.js
===================================================================
--- komodo/SciViews-K/content/js/robjects.js	2009-09-16 11:42:45 UTC (rev 190)
+++ komodo/SciViews-K/content/js/robjects.js	2009-09-17 23:20:28 UTC (rev 191)
@@ -1017,7 +1017,7 @@
 	}
 	
 	this.refreshGlobalEnv = function (data) {
-		this._parseObjectList(data);
+		_parseObjectList(data);
 	}
 	
 	//TODO: on package deletion -> remove it also from the search path

Modified: komodo/SciViews-K/content/js/socket.js
===================================================================
--- komodo/SciViews-K/content/js/socket.js	2009-09-16 11:42:45 UTC (rev 190)
+++ komodo/SciViews-K/content/js/socket.js	2009-09-17 23:20:28 UTC (rev 191)
@@ -307,7 +307,7 @@
 			sv.log.exception(e, "SciViews-K cannot open a server socket on port" +
 				port + ".\nMake sure the port is not already used by another" +
 					" Komodo instance" + "\nor choose another port in the" +
-					" preferences and restart Komdo", true);
+					" preferences and restart Komodo", false);
 			// If the port is already used, I got:
 			// "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
 			// chrome://sciviewsk/content/js/socket.js :: anonymous :: line 285
@@ -402,4 +402,5 @@
 }).apply(sv.socket);
 
 // [PhG] This raises an error on Komodo 5.1 on Mac OS X
-//addEventListener("load", sv.socket.serverStart, false);
\ No newline at end of file
+//addEventListener("load", sv.socket.serverStart, false);
+window.setTimeout(sv.socket.serverStart, 500);
\ No newline at end of file

Modified: komodo/SciViews-K/sciviewsk-0.8.1-ko.xpi
===================================================================
(Binary files differ)

Modified: pkg/svGUI/DESCRIPTION
===================================================================
--- pkg/svGUI/DESCRIPTION	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svGUI/DESCRIPTION	2009-09-17 23:20:28 UTC (rev 191)
@@ -2,12 +2,12 @@
 Type: Package
 Title: SciViews GUI API - Functions to manage GUI client
 Depends: R (>= 2.6.0)
-Imports: svMisc, svSocket
+Imports: svMisc, svSocket (>= 0.9-48)
 SystemRequirements: Komodo Edit (http://www.openkomodo.com), SciViews-K (http://www.sciviews.org/SciViews-K)
 Description: Functions to manage the GUI client, like Komodo with the
   SciViews-K extension
-Version: 0.9-45
-Date: 2009-09-16
+Version: 0.9-46
+Date: 2009-09-17
 Author: Philippe Grosjean
 Maintainer: Philippe Grosjean <phgrosjean at sciviews.org>
 License: GPL (>= 2)

Modified: pkg/svGUI/NEWS
===================================================================
--- pkg/svGUI/NEWS	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svGUI/NEWS	2009-09-17 23:20:28 UTC (rev 191)
@@ -1,5 +1,10 @@
 = svGUI News
 
+== Changes in svGUI 0.9-46
+* Use of svTaskCallbackManager() of svSocket >= 0.9-48 to register task
+  callback that are also executed after each R code send by socket clients.
+
+
 == Changes in svGUI 0.9-45
 
 * Added guiRefresh() and guiAutoRefresh() to refresh automatically the content

Modified: pkg/svGUI/R/guiInstall.R
===================================================================
--- pkg/svGUI/R/guiInstall.R	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svGUI/R/guiInstall.R	2009-09-17 23:20:28 UTC (rev 191)
@@ -33,17 +33,9 @@
 		koCmd(command, ...)
 	})
 
-	# Register a TaskCallback to generate automatically informations for an object browser
-	# Use  getTaskCallbackNames() to know if some tasks are registered
-#	assignTemp(".guiObjCallback", function(...) {
-#	    ob <- names(getTemp(".guiObjListCache", default = NULL))
-#	    if (!is.null(ob)) for (i in 1:length(ob)) objBrowse(id = ob[i])
-#		return(TRUE)   # Required to keep it in the TaskCallback list
-#	})
-	Callback <- getTemp(".guiObjCallbackId", default = NULL)
-	if (is.null(Callback)) {
-#	    n <- addTaskCallback(getTemp(".guiObjCallback"))
-		n <- addTaskCallback(guiAutoRefresh)
-	    if (!is.null(n)) assignTemp(".guiObjCallbackId", as.character(n))
-	}
+	# Register a TaskCallback to generate automatically informations for an
+	# object browser.
+	h <- getTemp(".svTaskCallbackManager", default = NULL, mode = "list")
+	if (!is.null(h))
+		h$add(guiAutoRefresh, name = "guiAutoRefresh")
 }

Modified: pkg/svGUI/R/guiRefresh.R
===================================================================
--- pkg/svGUI/R/guiRefresh.R	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svGUI/R/guiRefresh.R	2009-09-17 23:20:28 UTC (rev 191)
@@ -1,13 +1,13 @@
 .active.data.frame <- list(object = "",
     fun = function () {
         if (exists(.active.data.frame$object, envir = .GlobalEnv)) {
-            obj <- get(.active.data.frame$object, envir = .GlobalEnv)
-            res <- paste(names(obj), "\t", sapply(obj, class), "\n", sep = "")
-            return(.active.data.frame$cache <<- res)
+        	obj <- get(.active.data.frame$object, envir = .GlobalEnv)
+        	res <- paste(c(.active.data.frame$object, names(obj)), "\t",
+        	c(class(obj), sapply(obj, class)), "\n", sep = "")
+        	return(.active.data.frame$cache <<- res)
         } else return(.active.data.frame$cache <<- NULL)       
-    }, cache = "")
+	}, cache = "")
 
-
 guiRefresh <- function (force = FALSE) {    
     # Refresh active items and the R Objects explorer
     # If force == TRUE, do not compare with the cache
@@ -31,14 +31,16 @@
     }
     # Refresh object browser (only data from .GlobalEnv)
     lst <- objList(envir = .GlobalEnv, all.info = FALSE, compare = TRUE)
-    if (length(lst$Name) > 0)
-        koCmd('sv.r.objects.refreshGlobalEnv("<<<data>>>");',
-              data = print(lst, sep = ";;", raw.output = TRUE, header = TRUE))
-        
+    if (length(lst$Name) > 0) {
+        msg <- paste("Env=.GlobalEnv\nObj=\n", 
+            paste(t(sapply(lst, paste)), c(rep(";;", 4), "\n"), sep = "",
+            collapse = ""), sep = "")
+        koCmd('sv.r.objects.refreshGlobalEnv("<<<data>>>");', data = msg)
+    }
     return(TRUE)
 }
 
 guiAutoRefresh <- function (...) {
-    guiRefresh(force = FALSE)
-    return(TRUE)
+    try(guiRefresh(force = FALSE), silent = TRUE)
+    return(TRUE) # We need to return TRUE for callback reschedule
 }
\ No newline at end of file

Modified: pkg/svGUI/R/guiUninstall.R
===================================================================
--- pkg/svGUI/R/guiUninstall.R	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svGUI/R/guiUninstall.R	2009-09-17 23:20:28 UTC (rev 191)
@@ -9,11 +9,8 @@
 
 	rmTemp(".koCmd")
 
-	# Unregister the TaskCallback
-	# Use getTaskCallbackNames() to know if some tasks are registered
-	Callback.Id <- getTemp(".guiObjCallbackId", default = NULL)
-	if (!is.null(Callback.Id)) {
-	    if (removeTaskCallback(Callback.Id))
-			assignTemp(".guiObjCallbackId", NULL)
-	}
+	# Unregister our own TaskCallback
+	h <- getTemp(".svTaskCallbackManager", default = NULL, mode = "list")
+	if (!is.null(h))
+		h$remove("guiAutoRefresh")
 }

Modified: pkg/svSocket/DESCRIPTION
===================================================================
--- pkg/svSocket/DESCRIPTION	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svSocket/DESCRIPTION	2009-09-17 23:20:28 UTC (rev 191)
@@ -4,8 +4,8 @@
 Depends: R (>= 2.6.0)
 Imports: tcltk, svMisc
 Description: Implements a simple socket server allowing to connect GUI clients to R
-Version: 0.9-47
-Date: 2009-09-16
+Version: 0.9-48
+Date: 2009-09-17
 Author: Philippe Grosjean, Matthew Dowle
 Maintainer: Philippe Grosjean <phgrosjean at sciviews.org>
 License: GPL (>= 2)

Modified: pkg/svSocket/NAMESPACE
===================================================================
--- pkg/svSocket/NAMESPACE	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svSocket/NAMESPACE	2009-09-17 23:20:28 UTC (rev 191)
@@ -10,4 +10,5 @@
        sendSocketClients,
        closeSocketClients,
        startSocketServer,
-       stopSocketServer)
+       stopSocketServer,
+	   svTaskCallbackManager)

Modified: pkg/svSocket/NEWS
===================================================================
--- pkg/svSocket/NEWS	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svSocket/NEWS	2009-09-17 23:20:28 UTC (rev 191)
@@ -1,5 +1,12 @@
 = svSocket News
 
+== Changes in svSocket 0.9-48
+
+* svTaskCallbackManager() added to allow callbacks to be executed after each
+  (complete) R code send by a client to the server, as well as, any top-level
+  task run at the R console.
+
+
 == Changes in svSocket 0.9-47
 
 * The server now calls taskCallbacks on non-hidden mode after code evaluation

Modified: pkg/svSocket/R/processSocket.R
===================================================================
--- pkg/svSocket/R/processSocket.R	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svSocket/R/processSocket.R	2009-09-17 23:20:28 UTC (rev 191)
@@ -125,8 +125,10 @@
     # Correct code,... we evaluate it
     results <- captureAll(expr)
 	# Should we run taskCallbacks?
-	if (!hiddenMode)
-		results <- c(results, taskCallbackManager()$evaluate())
+	if (!hiddenMode) {
+		h <- getTemp(".svTaskCallbackManager", default = NULL, mode = "list")
+		if (!is.null(h)) h$evaluate()
+	}
     # Collapse and add last and the prompt at the end
     results <- paste(results, collapse = "\n")
     if (Echo) cat(results)

Modified: pkg/svSocket/R/svSocket-Internal.R
===================================================================
--- pkg/svSocket/R/svSocket-Internal.R	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svSocket/R/svSocket-Internal.R	2009-09-17 23:20:28 UTC (rev 191)
@@ -1,3 +1,17 @@
+".onLoad" <-
+function (lib, pkg)
+{
+	# Create our SciViews task callback manager
+	assignTemp(".svTaskCallbackManager", svTaskCallbackManager())
+}
+
+".onUnload" <-
+function (libpath)
+{
+	removeTaskCallback("SV-taskCallbackManager")
+	rmTemp(".svTaskCallbackManager")
+}
+
 ".Last.lib" <-
 function (libpath)
 {

Added: pkg/svSocket/R/svTaskCallbackManager.R
===================================================================
--- pkg/svSocket/R/svTaskCallbackManager.R	                        (rev 0)
+++ pkg/svSocket/R/svTaskCallbackManager.R	2009-09-17 23:20:28 UTC (rev 191)
@@ -0,0 +1,69 @@
+svTaskCallbackManager <-
+function (handlers = list(), registered = FALSE, verbose = FALSE) 
+{
+    suspended <- FALSE
+    .verbose <- verbose
+    add <- function(f, data = NULL, name = NULL, register = TRUE) {
+        if (is.null(name)) 
+            name <- as.character(length(handlers) + 1L)
+        handlers[[name]] <<- list(f = f)
+        if (!missing(data)) 
+            handlers[[name]][["data"]] <<- data
+        if (!registered && register) {
+            register()
+        }
+        name
+    }
+    remove <- function(which) {
+        if (is.character(which)) {
+            tmp <- (1L:length(handlers))[!is.na(match(which, 
+                names(handlers)))]
+            if (length(tmp)) 
+                stop(gettextf("no such element '%s'", which), 
+                  domain = NA)
+            which <- tmp
+        }
+        else which <- as.integer(which)
+        handlers <<- handlers[-which]
+        return(TRUE)
+    }
+    evaluate <- function(expr, value, ok, visible) {
+        if (suspended) 
+            return(TRUE)
+        discard <- character(0L)
+        for (i in names(handlers)) {
+            h <- handlers[[i]]
+            if (length(h) > 1L) {
+                val <- h[["f"]](expr, value, ok, visible, i[["data"]])
+            }
+            else {
+                val <- h[["f"]](expr, value, ok, visible)
+            }
+            if (!val) {
+                discard <- c(discard, i)
+            }
+        }
+        if (length(discard)) {
+            if (.verbose) 
+                cat(gettext("Removing"), paste(discard, collapse = ", "), 
+                  "\n")
+            idx <- is.na(match(names(handlers), discard))
+            if (length(idx)) 
+                handlers <<- handlers[idx]
+            else handlers <<- list()
+        }
+        return(TRUE)
+    }
+    suspend <- function(status = TRUE) {
+        suspended <<- status
+    }
+    register <- function(name = "SV-taskCallbackManager", verbose = .verbose) {
+        if (verbose) 
+            cat(gettext("Registering evaluate as low-level callback\n"))
+        id <- addTaskCallback(evaluate, name = name)
+        registered <<- TRUE
+        id
+    }
+    list(add = add, evaluate = evaluate, remove = remove, register = register, 
+        suspend = suspend, callbacks = function() handlers)
+}

Modified: pkg/svSocket/man/processSocket.Rd
===================================================================
--- pkg/svSocket/man/processSocket.Rd	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svSocket/man/processSocket.Rd	2009-09-17 23:20:28 UTC (rev 191)
@@ -73,8 +73,8 @@
 \author{Philippe Grosjean (\email{phgrosjean at sciviews.org})}
 
 \seealso{ \code{\link{startSocketServer}}, \code{\link{sendSocketClients}},
-  \code{\link[svMisc]{parSocket}}, \code{\link[svMisc]{Parse}},
-  \code{\link[svMisc]{captureAll}} }
+  \code{\link{svTaskCallbackManager}}, \code{\link[svMisc]{parSocket}},
+  \code{\link[svMisc]{Parse}}, \code{\link[svMisc]{captureAll}} }
 
 \examples{
 \dontrun{

Added: pkg/svSocket/man/svTaskCallbackManager.Rd
===================================================================
--- pkg/svSocket/man/svTaskCallbackManager.Rd	                        (rev 0)
+++ pkg/svSocket/man/svTaskCallbackManager.Rd	2009-09-17 23:20:28 UTC (rev 191)
@@ -0,0 +1,49 @@
+\name{svTaskCallbackManager}
+\alias{svTaskCallbackManager}
+
+\title{ Create task callbacks that are evaluated both from R and the socket server }
+
+\description{
+  \code{svTaskCallbackManager()} is a copy of \code{taskCallbackManager()} in
+  base package, as of version 2.9.2 of R. Two important differences: (1) the top
+  task created is named \code{SV-taskCallbackManager} instead of
+  \code{R-taskCallbackManager}, and its tasks are executed after each top-level
+  task in R console, or after execution of non-hidden R code from the socket
+  server (take care: only once per set of code, no mather the number of
+  top-level task in the R code send by the client in the second case). All
+  taskCallbacks defined by \code{addTaskCallback()} or
+  \code{taskCallbackManager$add()} from base package are not executed when code
+  is invoked from the R socket server!
+}
+
+\usage{
+svTaskCallbackManager(handlers = list(), registered = FALSE, verbose = FALSE)
+}
+
+\arguments{
+  \item{handlers}{ This can be a list of callbacks in which each element is a
+    list with an element named \code{f} which is a callback function, and an
+	optional element named \code{data} which is the 5-th argument to be supplied
+	to the callback when it is invoked. Typically this argument is not
+	specified, and one uses add to register callbacks after the manager is
+	created. }
+  \item{registered}{ A logical value indicating whether the \code{evaluate}
+    function has already been registered with the internal task callback
+	mechanism. This is usually \code{FALSE} and the first time a callback is
+	added via the add function, the evaluate function is automatically
+	registered. One can control when the function is registered by specifying
+	\code{TRUE} for this argument and calling \code{addTaskCallback()} manually. }
+  \item{verbose}{ A logical value, which if \code{TRUE}, causes information to
+    be printed to the console about certain activities this dispatch manager
+	performs. This is useful for debugging callbacks and the handler itself. }
+}
+
+\value{
+  See \code{?taskCallbackManager} for both the returned object and how to use it.
+}
+
+\author{Slightly modified from the original function by the R core team}
+
+\seealso{ \code{\link[base]{taskCallbackManager}}, \code{\link{processSocket}} }
+
+\keyword{ IO }


Property changes on: pkg/svSocket/man/svTaskCallbackManager.Rd
___________________________________________________________________
Name: svn:executable
   + *

Modified: pkg/svUnit/DESCRIPTION
===================================================================
--- pkg/svUnit/DESCRIPTION	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svUnit/DESCRIPTION	2009-09-17 23:20:28 UTC (rev 191)
@@ -4,8 +4,8 @@
 Depends: R (>= 1.9.0)
 Suggests: svGUI, datasets, utils
 Description: A complete unit test system and functions to implement its GUI part
-Version: 0.6-2
-Date: 2009-01-12
+Version: 0.6-3
+Date: 2009-09-17
 Author: Philippe Grosjean
 Maintainer: Philippe Grosjean <phgrosjean at sciviews.org>
 License: GPL (>= 2)

Modified: pkg/svUnit/NEWS
===================================================================
--- pkg/svUnit/NEWS	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svUnit/NEWS	2009-09-17 23:20:28 UTC (rev 191)
@@ -1,5 +1,11 @@
 = svUnit News
 
+== svUnit 0.6-3
+
+* The task callback mechanism introduced in svSocket 0.9-48 is now used to all
+  running the task after R code send by socket clients is executed.
+
+
 == svUnit 0.6-2
 
 * There is now a vignette for the svUnit package.

Modified: pkg/svUnit/R/svUnit-internal.R
===================================================================
--- pkg/svUnit/R/svUnit-internal.R	2009-09-16 11:42:45 UTC (rev 190)
+++ pkg/svUnit/R/svUnit-internal.R	2009-09-17 23:20:28 UTC (rev 191)
@@ -9,15 +9,20 @@
 	# Look if the SciViews-K Unit Komodo extension is installed
 	.installUpgradeKomodoExtension()
 	# Install a callback to update the list of units automatically in the GUI
-	.assignTemp(".taskCallbackId", addTaskCallback(guiSuiteAutoList))
+	# Use the mechanism introduced in svSocket 0.9-48 to allow execution of
+	# this task callback from a socket client too
+	h <- .getTemp(".svTaskCallbackManager", default = NULL)
+	if (!is.null(h))
+		h$add(guiSuiteAutoList, name = "guiSuiteAutoList")
 }
 
 ".onUnload" <-
 function (libpath)
 {
-	# Delete the taskCallback
-	taskCallbackId <- .getTemp(".taskCallbackId", NULL)
-	if (!is.null(taskCallbackId)) removeTaskCallback(taskCallbackId)
+	# Delete the task callback
+	h <- .getTemp(".svTaskCallbackManager", default = NULL)
+	if (!is.null(h))
+		h$remove("guiSuiteAutoList")
 	# and clear the list of units in the GUI client
 	if (exists("koCmd", mode = "function"))
 		get("koCmd")('sv.r.unit.getRUnitList_Callback("");')

Modified: pkg/svUnit/inst/doc/svUnit.pdf
===================================================================
(Binary files differ)



More information about the Sciviews-commits mailing list