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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Dec 13 13:57:21 UTC 2011


Revision: 4116
          http://rkward.svn.sourceforge.net/rkward/?rev=4116&view=rev
Author:   tfry
Date:     2011-12-13 13:57:20 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
Allow some markup inside <text>, and auto-add breaks only for duplicate newlines.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/misc/xmlhelper.cpp
    trunk/rkward/rkward/misc/xmlhelper.h
    trunk/rkward/rkward/plugin/rktext.cpp
    trunk/rkward/rkward/plugins/analysis/t_test.xml
    trunk/rkward/rkward/plugins/plots/scatterplot.xml

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2011-12-13 10:38:00 UTC (rev 4115)
+++ trunk/rkward/ChangeLog	2011-12-13 13:57:20 UTC (rev 4116)
@@ -1,3 +1,4 @@
+- Reorganized t-test plugin, and add support for single sample t-tests			TODO: adjust test(s)
 - Fixed: Function argument hints for the second half of the parameter list would not be quoted, correctly
 - Improve keypress handling issues in the R Console, when the cursor or a selection is outside the editable range
 - Fixed: Failure to open workspaces with non-latin1 filenames from the command line

Modified: trunk/rkward/rkward/misc/xmlhelper.cpp
===================================================================
--- trunk/rkward/rkward/misc/xmlhelper.cpp	2011-12-13 10:38:00 UTC (rev 4115)
+++ trunk/rkward/rkward/misc/xmlhelper.cpp	2011-12-13 13:57:20 UTC (rev 4116)
@@ -2,7 +2,7 @@
                           xmlhelper.cpp  -  description
                              -------------------
     begin                : Fri May 6 2005
-    copyright            : (C) 2005, 2007 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2007, 2011 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -23,6 +23,7 @@
 #include <qfile.h>
 #include <qfileinfo.h>
 #include <qdir.h>
+#include <QTextStream>
 
 #include "../debug.h"
 
@@ -309,6 +310,24 @@
 	return def;
 }
 
+QString XMLHelper::getRawContents (const QDomElement &element, int debug_level) {
+	RK_TRACE (XML);
+
+	QString ret;
+	QTextStream stream (&ret);
+
+	if (!element.isNull()) {
+		QTextStream stream (&ret, QIODevice::WriteOnly);
+		for (QDomNode node = element.firstChild (); !node.isNull (); node = node.nextSibling ()) {
+			node.save (stream, 0);
+		}
+	} else {
+		displayError (&element, i18n ("Trying to retrieve contents of invalid element"), debug_level);
+	}
+
+	return ret;
+}
+
 void XMLHelper::displayError (const QDomNode *in_node, const QString &message, int debug_level, int message_level) {
 	RK_TRACE (XML);
 

Modified: trunk/rkward/rkward/misc/xmlhelper.h
===================================================================
--- trunk/rkward/rkward/misc/xmlhelper.h	2011-12-13 10:38:00 UTC (rev 4115)
+++ trunk/rkward/rkward/misc/xmlhelper.h	2011-12-13 13:57:20 UTC (rev 4116)
@@ -2,7 +2,7 @@
                           xmlhelper.h  -  description
                              -------------------
     begin                : Fri May 6 2005
-    copyright            : (C) 2005, 2007 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2007, 2011 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -128,6 +128,12 @@
 @returns true or false based on the value of the given attribute or the given default */
 	bool getBoolAttribute (const QDomElement &element, const QString &name, bool def, int debug_level);
 
+/** Gets a string representation of whatever is *inside* the element. Contrary to QDomElement::text(), this includes child tags.
+ * @param element the element of interest
+ * @param debug_level level of debug message to generate in case of failure (i.e. the element is null)
+ * @returns the contents as a QString (may be empty) */
+	QString getRawContents (const QDomElement &element, int debug_level);
+
 /** @returns the level of the most severe error since the last call to openXMLFile () (based on the debug_level options passed to XMLHelper () */
 	int highestError () { return (highest_error); };
 

Modified: trunk/rkward/rkward/plugin/rktext.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rktext.cpp	2011-12-13 10:38:00 UTC (rev 4115)
+++ trunk/rkward/rkward/plugin/rktext.cpp	2011-12-13 13:57:20 UTC (rev 4116)
@@ -41,14 +41,9 @@
 	label->setWordWrap (true);
 	vbox->addWidget (label);
 
-	QString initial_text;
-	QStringList lines = element.text ().split ("\n");
-	for (int i=0; i < lines.count (); i++) {
-		QString line = lines[i].trimmed ();
-		if (!line.isEmpty ()) {
-			initial_text.append (line + '\n');
-		}
-	}
+	QString initial_text = xml->getRawContents (element, DL_ERROR);
+	if (!initial_text.isEmpty ()) initial_text = "<p>" + initial_text + "</p>";
+	initial_text.replace ("\n\n", "</p>\n<p>");
 
 	int type = xml->getMultiChoiceAttribute (element, "type", "normal;warning;error", 0, DL_INFO);
 	if (type != 0) {

Modified: trunk/rkward/rkward/plugins/analysis/t_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/t_test.xml	2011-12-13 10:38:00 UTC (rev 4115)
+++ trunk/rkward/rkward/plugins/analysis/t_test.xml	2011-12-13 13:57:20 UTC (rev 4116)
@@ -50,20 +50,26 @@
 		<page>
 			<text>
 				As a first step, select the type of test to conduct.
-				Select "Independent samples" when comparing data from two different populations (e.g. treatment group vs. control group). For comparing matched pairs or repeated measures on the same subject, select "Paired samples". Finally, you can also test a single sample against a constant value.</text>
+
+				Select "Independent samples" when comparing data from two different populations (e.g. treatment group
+				vs. control group). For comparing matched pairs or repeated measures on the same subject, select
+				"Paired samples". Finally, you can also test a single sample against a constant value.</text>
 			<copy id="test_form"/>
 			<stretch/>
 		</page>
 		<page>
 			<text>
-				Select the parameters of the t-test. If your hypothesis is directed, selecting a directional test hypothesis may increase test power.</text>
+				Select the parameters of the t-test. If your hypothesis is directed, selecting a directional test
+				hypothesis may increase test power.</text>
 			<copy id="basic_settings_row"/>
 			<stretch/>
 		</page>
 		<page>
 			<text>
 				Sometimes it's helpful to get an estimate of the confidence interval of the difference in means.
-				Below you can specify whether one should be shown, and which confidence-level should be applied (95% corresponds to a 5% level of significance).</text>
+
+				Below you can specify whether one should be shown, and which confidence-level should be applied (95%
+				corresponds to a 5% level of significance).</text>
 			<copy id="confint"/>
 			<stretch/>
 		</page>

Modified: trunk/rkward/rkward/plugins/plots/scatterplot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/scatterplot.xml	2011-12-13 10:38:00 UTC (rev 4115)
+++ trunk/rkward/rkward/plugins/plots/scatterplot.xml	2011-12-13 13:57:20 UTC (rev 4116)
@@ -58,8 +58,8 @@
 						</radio>
 						<column>
 							<text>
-					Enter value - for diff.col. enter a vector -
-					eg:  c(1,2) or c('red','green')
+						Enter value - for diff.col. enter a vector -<br/>
+						eg:  c(1,2) or c('red','green')
 							</text>
 							<input size="small" id="col" initial="'black'" label=" " />
 						</column>

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