[rkward] /: Also support gvis-objects via rk.print(). Allow opening links from Output Window (in a new window)

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Jan 21 19:21:02 UTC 2016


Git commit fffc25f0e88534f34e0bff0f60f9b32672caf650 by Thomas Friedrichsmeier.
Committed on 21/01/2016 at 19:20.
Pushed by tfry into branch 'master'.

Also support gvis-objects via rk.print(). Allow opening links from Output Window (in a new window)

M  +1    -1    ChangeLog
M  +3    -0    rkward/rbackend/rpackages/rkward/R/rk.print-functions.R
M  +2    -2    rkward/windows/rkhtmlwindow.cpp

http://commits.kde.org/rkward/fffc25f0e88534f34e0bff0f60f9b32672caf650

diff --git a/ChangeLog b/ChangeLog
index c94aefd..8ea0ed1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
-- Add support for adding "htmlwidget"-class objects to the output window via rk.print()
+- Add support for adding "htmlwidget"- and "gvis"-class objects to the output window via rk.print()
 - Add plugins for importing Excel files (.xls and .xlsx, Perl- and Java-based)
 - Add ability to extract <matrix> values row-wise in plugins
 - Add convenience JS-function "makeOption()" for use in plugins
diff --git a/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R b/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R
index 775cdb2..20f5644 100644
--- a/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R
+++ b/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R
@@ -98,6 +98,9 @@
 		dir <- rk.get.tempfile.name (name, "_data")
 		saveWidget (x, filename, selfcontained=FALSE, libdir=dir)
 		.rk.cat.output (paste0 ("<object width=\"100%\" height=\"100%\" data=\"file://", filename, "\" onload=\"this.style.height = this.contentWindow.document.body.scrollHeight + 'px';\"></object>"))
+	} else if (inherits (x, "gvis")) {
+		require ("googleVis")
+		print (x, file=rk.get.output.html.file(), append=TRUE)
 	} else {
 		htmlfile <- rk.get.output.html.file()
 		if(require("R2HTML")==TRUE) {
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index 4ab5f86..451c2c3 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -358,9 +358,9 @@ bool RKHTMLWindow::openURL (const KUrl &url) {
 
 	if (window_mode == HTMLOutputWindow) {
 		if (url != current_url) {
-			// output window should not change url after initialization
+			// output window should not change url after initialization open any links in new windows
 			if (!current_url.isEmpty ()) {
-				RK_ASSERT (false);
+				RKWorkplace::mainWorkplace ()->openAnyUrl (url);
 				return false;
 			}
 



More information about the rkward-tracker mailing list