[rkward-cvs] SF.net SVN: rkward: [812] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu Oct 5 14:39:35 UTC 2006
Revision: 812
http://svn.sourceforge.net/rkward/?rev=812&view=rev
Author: tfry
Date: 2006-10-05 07:39:26 -0700 (Thu, 05 Oct 2006)
Log Message:
-----------
Objectlist auto updates part 3: Add flag RCommand::ObjectListUpdate for application level commands that may change the list
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/TODO
trunk/rkward/rkward/agents/rkloadagent.cpp
trunk/rkward/rkward/dialogs/rkloadlibsdialog.cpp
trunk/rkward/rkward/rbackend/rcommand.h
trunk/rkward/rkward/rbackend/rthread.cpp
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2006-10-05 14:25:23 UTC (rev 811)
+++ trunk/rkward/ChangeLog 2006-10-05 14:39:26 UTC (rev 812)
@@ -1,3 +1,4 @@
+- the object browser is updated automatically when needed
- allow some more configuration in object browser
- include all package environments in object list
- use more efficient data passing to synchronize object list
Modified: trunk/rkward/TODO
===================================================================
--- trunk/rkward/TODO 2006-10-05 14:25:23 UTC (rev 811)
+++ trunk/rkward/TODO 2006-10-05 14:39:26 UTC (rev 812)
@@ -75,19 +75,14 @@
- probably it would be smarter to use a reverse map, as item->object should be mostly GUI bound
- also use a QHash (Qt4)
Detecting object modifications inside R:
- - RObjectTables sounds highly interesing. Maybe we can use a transparent table to find out about assignments?
- - Problem: we can't add this on top of the globalenv () (or at least we're not supposed to)
- - can we dare to replace R_GlobalEnv with a fake environment which redirects to the real thing?
- - R_MakeActiveBinding sounds even more interesting. Maybe we can use this to "watch" symbols?!?
- - can't track removal or creation of new objects this way
- - seems to work only for top-level objects (elements in a list are not discernable, though we do catch the access to the list itself)
- - function rk.watch.symbol (), and friends already in public.R seem to do the trick
- - The plan:
- - use makeActiveBinding (rk.watch.symbol ()) to track changes in existing objects
- - after each user or plugin command, simply update the list of toplevel objects in .GlobalEnv
- - if new objects are found, instantiate them
- - if objects are missing, remove them
- - should be fast enough, if done close to the backend
+ - left TODO:
+ - detection hole:
+ x is 1
+ user does
+ rm (x); x <- function () {}
+ (object list remains the same, watch was not active, but symbol changed)
+ - will need to put an extra notification inside .rk.watch.globalenv ()
+ - deal with data changes in edited objects
- REnvironmentObjects:
- Fetching the tree of all environments using the current method is slooooooow, and has hard to fix bugs, so far
- Should have getCommandAsStructure first, and update whole trees in a single command
Modified: trunk/rkward/rkward/agents/rkloadagent.cpp
===================================================================
--- trunk/rkward/rkward/agents/rkloadagent.cpp 2006-10-05 14:25:23 UTC (rev 811)
+++ trunk/rkward/rkward/agents/rkloadagent.cpp 2006-10-05 14:39:26 UTC (rev 812)
@@ -49,12 +49,11 @@
if (!merge) {
RKwardApp::getApp ()->slotCloseAllEditors ();
update_was_delete = true;
- command = new RCommand ("remove (list=ls (all.names=TRUE))", RCommand::App);
+ command = new RCommand ("remove (list=ls (all.names=TRUE))", RCommand::App | RCommand::ObjectListUpdate);
RKGlobals::rInterface ()->issueCommand (command);
- RObjectList::getObjectList ()->updateFromR ();
}
- command = new RCommand ("load (\"" + url.path () + "\")", RCommand::App, QString::null, this, WORKSPACE_LOAD_COMMAND);
+ command = new RCommand ("load (\"" + url.path () + "\")", RCommand::App | RCommand::ObjectListUpdate, QString::null, this, WORKSPACE_LOAD_COMMAND);
RKGlobals::rInterface ()->issueCommand (command);
connect (RObjectList::getObjectList (), SIGNAL (updateComplete ()), this, SLOT (listUpdateComplete ()));
Modified: trunk/rkward/rkward/dialogs/rkloadlibsdialog.cpp
===================================================================
--- trunk/rkward/rkward/dialogs/rkloadlibsdialog.cpp 2006-10-05 14:25:23 UTC (rev 811)
+++ trunk/rkward/rkward/dialogs/rkloadlibsdialog.cpp 2006-10-05 14:39:26 UTC (rev 812)
@@ -369,7 +369,7 @@
QListViewItem *loaded = loaded_view->firstChild ();
while (loaded) {
if (!prev_packages.contains (loaded->text (0))) {
- RCommand *command = new RCommand ("library (\"" + loaded->text (0) + "\")", RCommand::App, QString::null, this, LOAD_PACKAGE_COMMAND);
+ RCommand *command = new RCommand ("library (\"" + loaded->text (0) + "\")", RCommand::App | RCommand::ObjectListUpdate, QString::null, this, LOAD_PACKAGE_COMMAND);
control->addRCommand (command);
RKGlobals::rInterface ()->issueCommand (command, parent->chain);
}
@@ -389,14 +389,13 @@
loaded = next;
}
if (!found) {
- RCommand *command = new RCommand ("detach (package:" + (*it) + ")", RCommand::App, QString::null, this, LOAD_PACKAGE_COMMAND);
+ RCommand *command = new RCommand ("detach (package:" + (*it) + ")", RCommand::App | RCommand::ObjectListUpdate, QString::null, this, LOAD_PACKAGE_COMMAND);
control->addRCommand (command);
RKGlobals::rInterface ()->issueCommand (command, parent->chain);
}
}
control->doNonModal (true);
- RObjectList::getObjectList ()->updateFromR ();
}
void LoadUnloadWidget::apply () {
Modified: trunk/rkward/rkward/rbackend/rcommand.h
===================================================================
--- trunk/rkward/rkward/rbackend/rcommand.h 2006-10-05 14:25:23 UTC (rev 811)
+++ trunk/rkward/rkward/rbackend/rcommand.h 2006-10-05 14:39:26 UTC (rev 812)
@@ -161,7 +161,8 @@
GetStringVector=1024, /**< Try to fetch result as an array of chars */
GetRealVector=2048, /**< Try to fetch result as an array of doubles */
GetStructuredData=4096, /**< Try to fetch result as an RData structure */
- DirectToOutput=8192 /**< Append command output to the HTML-output file */
+ DirectToOutput=8192, /**< Append command output to the HTML-output file */
+ ObjectListUpdate=16384 /**< The command may change the list of objects available. Do an update */
};
enum CommandStatus {
WasTried=1, /**< the command has been passed to the backend. */
Modified: trunk/rkward/rkward/rbackend/rthread.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rthread.cpp 2006-10-05 14:25:23 UTC (rev 811)
+++ trunk/rkward/rkward/rbackend/rthread.cpp 2006-10-05 14:39:26 UTC (rev 812)
@@ -213,7 +213,7 @@
}
// step 3: cleanup
- checkObjectUpdatesNeeded (command->type () & RCommand::User);
+ checkObjectUpdatesNeeded (command->type () & (RCommand::User | RCommand::ObjectListUpdate));
// notify GUI-thread that command was finished
event = new QCustomEvent (RCOMMAND_OUT_EVENT);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list