[rkward-cvs] SF.net SVN: rkward:[2677] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu Oct 1 11:13:08 UTC 2009
Revision: 2677
http://rkward.svn.sourceforge.net/rkward/?rev=2677&view=rev
Author: tfry
Date: 2009-10-01 11:13:08 +0000 (Thu, 01 Oct 2009)
Log Message:
-----------
Support for preservering dynamically served help pages across sessions. Bump version number due to new function in internal.R
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
trunk/rkward/rkward/rbackend/rpackages/rkward/R/ver.R
trunk/rkward/rkward/rbackend/rthread.cpp
trunk/rkward/rkward/resource.ver
trunk/rkward/rkward/settings/rksettingsmoduler.cpp
trunk/rkward/rkward/settings/rksettingsmoduler.h
trunk/rkward/rkward/version.h
trunk/rkward/rkward/windows/rkhtmlwindow.cpp
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2009-10-01 09:36:29 UTC (rev 2676)
+++ trunk/rkward/ChangeLog 2009-10-01 11:13:08 UTC (rev 2677)
@@ -1,4 +1,5 @@
TODO: We need to fix the output detection properly, after all. Otherwise, if the plugin produces an error, no re-run link is shown.
+- Add support for the dynamic help server introduced in R 2.10.0 TODO: backport (r2672, r2676)
- Assorted minor fixes and improvments to several plugins
- Fix deadlock while handling some Tcl events TODO: much more (stress-)testing, backport? (r2649)
- Plugin dialogs close automatically after submitting (by default)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R 2009-10-01 09:36:29 UTC (rev 2676)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R 2009-10-01 11:13:08 UTC (rev 2677)
@@ -410,3 +410,22 @@
invisible (FALSE)
}
}
+
+# retrieve the (expected) "base" url of help files. Most importantly this will be a local port for R 2.10.0 and above, but a local directory for 2.9.x and below. As a side effect, in R 2.10.0 and above, the dynamic help server is started.
+".rk.getHelpBaseUrl" <- function () {
+ port <- NA
+ if (compareVersion (as.character (getRversion()), "2.10.0") >= 0) {
+ try ({
+ port <- tools::startDynamicHelp ()
+ })
+ if (is.na (port)) {
+ try ({
+ port <- tools:::httpdPort
+ })
+ }
+ }
+ if (is.na (port)) {
+ return (paste ("file://", R.home (), sep=""))
+ }
+ return (paste ("http://127.0.0.1", port, sep=":"))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/ver.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/ver.R 2009-10-01 09:36:29 UTC (rev 2676)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/ver.R 2009-10-01 11:13:08 UTC (rev 2677)
@@ -1 +1 @@
-".rk.app.version" <- "0.5.2-windows_pre1"
+".rk.app.version" <- "0.5.2-svn1"
Modified: trunk/rkward/rkward/rbackend/rthread.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rthread.cpp 2009-10-01 09:36:29 UTC (rev 2676)
+++ trunk/rkward/rkward/rbackend/rthread.cpp 2009-10-01 11:13:08 UTC (rev 2677)
@@ -528,6 +528,15 @@
}
delete [] standardliblocs;
+// start help server / determined help base url
+ QString *help_base_url = getCommandAsStringVector (".rk.getHelpBaseUrl ()\n", &c, &error);
+ if (error) status |= OtherFail;
+ else {
+ RK_ASSERT (c == 1);
+ RKSettingsModuleR::help_base_url = help_base_url[0];
+ }
+ delete [] help_base_url;
+
// apply user configurable run time options
QStringList commands = RKSettingsModuleR::makeRRunTimeOptionCommands () + RKSettingsModuleRPackages::makeRRunTimeOptionCommands ();
for (QStringList::const_iterator it = commands.begin (); it != commands.end (); ++it) {
Modified: trunk/rkward/rkward/resource.ver
===================================================================
--- trunk/rkward/rkward/resource.ver 2009-10-01 09:36:29 UTC (rev 2676)
+++ trunk/rkward/rkward/resource.ver 2009-10-01 11:13:08 UTC (rev 2677)
@@ -1 +1 @@
-0.5.2-windows_pre1
+0.5.2-svn1
Modified: trunk/rkward/rkward/settings/rksettingsmoduler.cpp
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduler.cpp 2009-10-01 09:36:29 UTC (rev 2676)
+++ trunk/rkward/rkward/settings/rksettingsmoduler.cpp 2009-10-01 11:13:08 UTC (rev 2677)
@@ -51,6 +51,8 @@
QString RKSettingsModuleR::options_pager;
// static constants
QString RKSettingsModuleR::builtin_editor = "<rkward>";
+// session constants
+QString RKSettingsModuleR::help_base_url;
RKSettingsModuleR::RKSettingsModuleR (RKSettings *gui, QWidget *parent) : RKSettingsModule(gui, parent) {
RK_TRACE (SETTINGS);
@@ -257,7 +259,8 @@
list.append ("options (device=\"rk.screen.device\")\n");
// register as interactive
list.append ("try (deviceIsInteractive(name=\"rk.screen.device\"))\n");
- list.append ("options (htmlhelp=TRUE); options (chmhelp=FALSE)\n");
+ list.append ("options (help_type=\"html\")\n"); // for R 2.10.0 and above
+ list.append ("options (htmlhelp=TRUE); options (chmhelp=FALSE)\n"); // COMPAT: for R 2.9.x and below
list.append ("options (browser=rk.show.html)\n");
return list;
Modified: trunk/rkward/rkward/settings/rksettingsmoduler.h
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduler.h 2009-10-01 09:36:29 UTC (rev 2676)
+++ trunk/rkward/rkward/settings/rksettingsmoduler.h 2009-10-01 11:13:08 UTC (rev 2677)
@@ -52,6 +52,9 @@
/** generate the commands needed to set the R run time options */
static QStringList makeRRunTimeOptionCommands ();
+/** retrieve the (probable) base url of help pages. May change across R sessions */
+ static QString helpBaseUrl () { return help_base_url; };
+
static int getDefaultWidth () { return options_width; };
public slots:
void boxChanged (int);
@@ -88,6 +91,10 @@
// constants
static QString builtin_editor;
+
+// session constants
+ friend class RThread;
+ static QString help_base_url;
};
/**
Modified: trunk/rkward/rkward/version.h
===================================================================
--- trunk/rkward/rkward/version.h 2009-10-01 09:36:29 UTC (rev 2676)
+++ trunk/rkward/rkward/version.h 2009-10-01 11:13:08 UTC (rev 2677)
@@ -1,2 +1,2 @@
/* Version number of package */
-#define VERSION "0.5.2-windows_pre1"
+#define VERSION "0.5.2-svn1"
Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp 2009-10-01 09:36:29 UTC (rev 2676)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp 2009-10-01 11:13:08 UTC (rev 2677)
@@ -40,6 +40,7 @@
#include "../rkward.h"
#include "../rkconsole.h"
#include "../settings/rksettingsmodulegeneral.h"
+#include "../settings/rksettingsmoduler.h"
#include "../misc/rkcommonfunctions.h"
#include "../misc/rkstandardactions.h"
#include "../misc/rkstandardicons.h"
@@ -109,7 +110,8 @@
return ("output:" + current_url.url ());
} else {
- return ("help:" + current_url.url ());
+ QString fixed_url = current_url.url ().replace (RKSettingsModuleR::helpBaseUrl(), "rkward://RHELPBASE");
+ return ("help:" + fixed_url);
}
}
@@ -236,6 +238,13 @@
return true;
} else if (url.host () == "page") {
ok = renderRKHelp (url);
+ } else if (url.host ().toUpper () == "RHELPBASE") { // NOTE: QUrl () may lowercase the host part, internally
+ KUrl fixed_url = KUrl (RKSettingsModuleR::helpBaseUrl ());
+ fixed_url.setPath (url.path ());
+ if (url.hasQuery ()) fixed_url.setQuery (url.query ());
+ if (url.hasFragment ()) fixed_url.setFragment (url.fragment ());
+qDebug ("%s -> %s", qPrintable (url.url ()), qPrintable (fixed_url.url ()));
+ ok = openURL (fixed_url);
}
if (!ok) {
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