[rkward-cvs] SF.net SVN: rkward:[4421] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Nov 8 10:20:54 UTC 2012


Revision: 4421
          http://rkward.svn.sourceforge.net/rkward/?rev=4421&view=rev
Author:   tfry
Date:     2012-11-08 10:20:54 +0000 (Thu, 08 Nov 2012)
Log Message:
-----------
Flush output using rk.flush.output()

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/misc/rkprogresscontrol.h
    trunk/rkward/rkward/rbackend/rcommand.cpp
    trunk/rkward/rkward/rbackend/rcommand.h
    trunk/rkward/rkward/windows/rkhtmlwindow.cpp

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2012-11-08 09:52:24 UTC (rev 4420)
+++ trunk/rkward/ChangeLog	2012-11-08 10:20:54 UTC (rev 4421)
@@ -2,7 +2,7 @@
 - Fixed: If none of the previous plugin maps could be found on startup, re-add the default
 - Added GUI element for entering matrix or vector data in plugins
 - Improve key handling while editing factor levels in a data.frame
-- Added utiltity function rk.flush.output()			TODO: Output Window->Flush Output should use this
+- Added utiltity function rk.flush.output()
 - RKWard is now categorized as Science/Math/Numerical Analysis in its .desktop file
 - Fixed: Device history was not working with more recent versions of ggplot2 		(TODO: find out, which version broke it, exactly)
 - Fixed: Option to include suggested packages in install was mis-labelled "install dependencies"

Modified: trunk/rkward/rkward/misc/rkprogresscontrol.h
===================================================================
--- trunk/rkward/rkward/misc/rkprogresscontrol.h	2012-11-08 09:52:24 UTC (rev 4420)
+++ trunk/rkward/rkward/misc/rkprogresscontrol.h	2012-11-08 10:20:54 UTC (rev 4421)
@@ -2,7 +2,7 @@
                           rkprogresscontol  -  description
                              -------------------
     begin                : Sun Sep 10 2006
-    copyright            : (C) 2006, 2007, 2009, 2011 by Thomas Friedrichsmeier
+    copyright            : (C) 2006, 2007, 2009, 2011, 2012 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -65,7 +65,8 @@
 		DetailedError=StandardError | IncludeRegularOutput,
 		StandardProgress=DetailedError | OutputSwitchable | RaiseOnRegularOutput,
 		CancellableProgress=(StandardProgress | AllowCancel | AutoCancelCommands | PreventClose | ShowAtOnce) - (RaiseOnRegularOutput | OutputShownByDefault),
-		CancellableNoProgress=CancellableProgress - OutputSwitchable
+		CancellableNoProgress=CancellableProgress - OutputSwitchable,
+		SimpleSplash=(StandardProgress | PreventClose | ShowAtOnce) - (RaiseOnRegularOutput | OutputShownByDefault | OutputSwitchable)
 	};
 
 /** show the dialog modal. This will always show the dialog right away

Modified: trunk/rkward/rkward/rbackend/rcommand.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rcommand.cpp	2012-11-08 09:52:24 UTC (rev 4420)
+++ trunk/rkward/rkward/rbackend/rcommand.cpp	2012-11-08 10:20:54 UTC (rev 4421)
@@ -20,6 +20,7 @@
 #include "rinterface.h"
 #include "../windows/rkcommandlog.h"
 #include "rkrbackendprotocol_shared.h"
+#include "../core/robject.h"
 
 #include "../debug.h"
 #include "../rkglobals.h"
@@ -233,4 +234,8 @@
 	return ret;
 }
 
+QString RCommand::rQuote (const QString &quoted) {
+	return RObject::rQuote (quoted);
+}
+
 #include "rcommand.moc"

Modified: trunk/rkward/rkward/rbackend/rcommand.h
===================================================================
--- trunk/rkward/rkward/rbackend/rcommand.h	2012-11-08 09:52:24 UTC (rev 4420)
+++ trunk/rkward/rkward/rbackend/rcommand.h	2012-11-08 10:20:54 UTC (rev 4421)
@@ -215,6 +215,8 @@
 
 /** returns a notifier for this command (creating it, if needed). You can connect to the notifiers signals. */
 	RCommandNotifier* notifier ();
+/** same as RObject::rQuote */
+	static QString rQuote (const QString &quoted);
 private:
 friend class RInterface;
 friend class RCommandStack;

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2012-11-08 09:52:24 UTC (rev 4420)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2012-11-08 10:20:54 UTC (rev 4421)
@@ -49,6 +49,7 @@
 #include "../misc/rkstandardicons.h"
 #include "../misc/xmlhelper.h"
 #include "../misc/rkxmlguisyncer.h"
+#include "../misc/rkprogresscontrol.h"
 #include "../plugin/rkcomponentmap.h"
 #include "../windows/rkworkplace.h"
 #include "../windows/rkworkplaceview.h"
@@ -461,23 +462,15 @@
 void RKHTMLWindow::flushOutput () {
 	RK_TRACE (APP);
 
-	int res = KMessageBox::questionYesNo (this, i18n ("Do you really want to flush the output? It will not be possible to restore it."), i18n ("Flush output?"));
+	int res = KMessageBox::questionYesNo (this, i18n ("Do you really want to clear the output? This will also remove all image files used in the output. It will not be possible to restore it."), i18n ("Flush output?"));
 	if (res==KMessageBox::Yes) {
 		QFile out_file (current_url.toLocalFile ());
-		QDir out_dir = QFileInfo (out_file).absoluteDir ();
-		out_file.remove ();
-
-		// remove all the graphs
-		out_dir.setNameFilters (QStringList ("graph*.png"));
-		QStringList graph_files = out_dir.entryList ();
-		for (QStringList::const_iterator it = graph_files.constBegin (); it != graph_files.constEnd (); ++it) {
-			QFile file (out_dir.absoluteFilePath (*it));
-			file.remove ();
-		}
-
-		// initialize the now empty file
-		RKGlobals::rInterface ()->issueCommand ("rk.set.output.html.file (\"" + out_file.fileName () + "\")\n", RCommand::App);
-		refresh ();
+		RCommand *c = new RCommand ("rk.flush.output (" + RCommand::rQuote (out_file.fileName ()) + ", ask=FALSE)\n", RCommand::App);
+		connect (c->notifier (), SIGNAL (commandFinished(RCommand*)), this, SLOT (refresh()));
+		RKProgressControl *status = new RKProgressControl (this, i18n ("Flushing output"), i18n ("Flushing output"), RKProgressControl::CancellableNoProgress);
+		status->addRCommand (c, true);
+		status->doNonModal (true);
+		RKGlobals::rInterface ()->issueCommand (c);
 	}
 }
 

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