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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Nov 2 11:34:21 UTC 2012


Revision: 4407
          http://rkward.svn.sourceforge.net/rkward/?rev=4407&view=rev
Author:   tfry
Date:     2012-11-02 11:34:20 +0000 (Fri, 02 Nov 2012)
Log Message:
-----------
Document matrix element

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/doc/rkwardplugins/index.docbook
    trunk/rkward/rkward/plugin/rkmatrixinput.cpp

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2012-11-02 10:08:57 UTC (rev 4406)
+++ trunk/rkward/ChangeLog	2012-11-02 11:34:20 UTC (rev 4407)
@@ -1,3 +1,4 @@
+- Added GUI element for entering matrix or vector data in plugins		TODO: cut / copy / paste, cursor placement
 - Added utiltity function rk.flush.output()			TODO: Output Window->Flush Output should use this
 - 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)

Modified: trunk/rkward/doc/rkwardplugins/index.docbook
===================================================================
--- trunk/rkward/doc/rkwardplugins/index.docbook	2012-11-02 10:08:57 UTC (rev 4406)
+++ trunk/rkward/doc/rkwardplugins/index.docbook	2012-11-02 11:34:20 UTC (rev 4407)
@@ -76,7 +76,7 @@
 
 	<note>
 		<para>
-			Documentation as of &rkward; release 0.5.8.
+			Documentation as of &rkward; release 0.6.1.
 		</para>
 	</note>
 	<para>
@@ -2255,6 +2255,7 @@
 <sect2 id="activeelements"><title>Active elements</title>
 <para>All elements in this section accept an attribute id="identifierstring". This attribute is required for all elements. Only the additional attributes are listed. The id-string may not contain "." (dots).</para>
 <variablelist>
+
 <varlistentry>
 <term><varselector></term>
 <listitem><para>Provides a list of available objects from which the user can select one or more. Requires one or more <varslot>s as a counterpart to be useful. Attributes:
@@ -2265,6 +2266,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><varslot></term>
 <listitem><para>Used in conjunction with a "varselector" to allow the user to select one or more variables. Attributes:
@@ -2319,6 +2321,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><radio></term>
 <listitem><para>Defines a group of radio-exclusive buttons (only one can be selected at a time). Requires at least two <option>-tags as direct children. No other tags are allowed as children. Attributes:
@@ -2329,6 +2332,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><dropdown></term>
 <listitem><para>Defines a group of options of which one and only one can be selected at the same time, using a dropdown list. This is functionally equivalent to a <radio>, but looks different. Requires at least two <option>-tags as direct children. No other tags are allowed as children. Attributes:
@@ -2339,6 +2343,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><option></term>
 <listitem><para>Can only be used as a direct child of a <radio> or <dropdown> element. Represents one selectable option in a radio control or dropdown list. Specifying the "id" parameter for the <option> elements is optional (and in fact it's recommended, not to set an "id", unless you plan to really use it to disable single options). Only the parent element (<radio> or <dropdown>) needs one. Attributes:
@@ -2357,6 +2362,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><checkbox></term>
 <listitem><para>Defines a checkbox, i.e. a single option that can either be set to on or off. Attributes:
@@ -2379,12 +2385,14 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><frame></term>
 <listitem><para>The frame element is generally used as a pure layout element, and is listed in the section on <link linkend="layoutelements">layout elements</link>. However, it can also be
 made checkable, thus acting like a simple checkbox at the same time.
 </para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><input></term>
 <listitem><para>Defines a free text input field. Attributes:
@@ -2407,7 +2415,67 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
+<term><matrix></term>
+<listitem><para>A table for entering matrix data (or vectors) in the GUI. <note><para>This input element is <emphasis>not</emphasis> optimized for entering editing large amounts of data. While there is no strict limit on the size of a <matrix>, in general it should not exceed around ten rows / columns. If you expect larger data, allow users to select it as an R object (which may be a good idea as an alternative option, in almost <emphasis>every</emphasis> instance where you use a matrix element).</para></note> Attributes:
+	<variablelist>
+	<varlistentry>
+	<term><label></term>
+	<listitem><para>Label for the table (required)</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><mode></term>
+	<listitem><para>One of "integer", "real", or "string". The type of data that will be accepted in the table (required)</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><min></term>
+	<listitem><para>Minimum acceptable value (for matrices of type "integer" or "real") (optional, defaults to the smallest representable value)</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><max></term>
+	<listitem><para>Maximum acceptable value (for matrices of type "integer" or "real") (optional, defaults to the largest representable value)</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><allow_missings></term>
+	<listitem><para>Whether missing (empty) values are allowed in the matrix. This is implied for matrices or mode "string"  (optional, defaults to false).</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><allow_user_resize_columns></term>
+	<listitem><para>When set to true, the user can add columns by typing on the rightmost (inactive) cells  (optional, defaults to true).</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><allow_user_resize_rows></term>
+	<listitem><para>When set to true, the user can add rows by typing on the bottommost (inactive) cells  (optional, defaults to true).</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><rows></term>
+	<listitem><para>Number of rows in the matrix. Has no effect for allow_user_resize_rows="true". <note><para>This can also be controlled by setting the "rows" property".</para></note> (optional, defaults to 2).</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><columns></term>
+	<listitem><para>Number of columns in the matrix. Has no effect for allow_user_resize_columns="true". <note><para>This can also be controlled by setting the "columns" property".</para></note> (optional, defaults to 2).</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><fixed_width></term>
+	<listitem><para>Force the GUI element to stay at its initial width. Do not use in combindation with matrices, where the number of columns may change in any way. Useful, esp. when creating a vector input element (rows="1"). (optional, defaults to false).</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><fixed_height></term>
+	<listitem><para>Force the GUI element to stay at its initial height. Do not use in combindation with matrices, where the number of rows may change in any way. Useful, esp. when creating a vector input element (columns="1"). (optional, defaults to false).</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><horiz_headers></term>
+	<listitem><para>Strings to ues for the horiztonal header, separated by ";". (optional, defaults to column number).</para></listitem>
+	</varlistentry>
+	<varlistentry>
+	<term><vert_headers></term>
+	<listitem><para>Strings to ues for the vertical header, separated by ";". (optional, defaults to row number).</para></listitem>
+	</varlistentry>
+	</variablelist></para></listitem>
+</varlistentry>
+
+<varlistentry>
 <term><browser></term>
 <listitem><para>An element designed to select a single filename (or directory name). Note that this field will take any string, even though it is meant to be used for files, only:
 	<variablelist>
@@ -2437,6 +2505,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><saveobject></term>
 <listitem><para>An element designed to select the name of an &r; object to save to (i.e. generally not already existing, in contrast to a varslot):
@@ -2463,6 +2532,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><spinbox></term>
 <listitem><para>A spinbox in which the user can select a numeric value, using either direct keyboard input or small up/down arrows. Attributes:
@@ -2497,6 +2567,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><formula></term>
 <listitem><para>This advanced element allows the user to select a formula/set of interactions from selected variables. For instance for a GLM, this element can be used to allow the user to specify the interaction-terms in the model. Attributes:
@@ -2511,6 +2582,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><embed></term>
 <listitem><para>Embed a different plugin into this one (see <link linkend="embedding">chapter on embedding</link>). Attributes:
@@ -2529,6 +2601,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><preview></term>
 <listitem><para>Checkbox to toggle preview functionality (see <link linkend="preview_plots">chapter on graph previews</link>). Attributes:
@@ -2658,6 +2731,7 @@
 <para>
 In addition to this, some elements have additional properties you can connect to. Most active elements also have a "default" property whose value will be returned on calls to getValue ("..."), if no specific property was named, as described below.
 </para>
+
 <variablelist>
 <varlistentry>
 <term><text></term>
@@ -2669,6 +2743,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><varselector></term>
 <listitem><para>No default property
@@ -2683,6 +2758,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><varslot></term>
 <listitem><para>Default property is "available"
@@ -2701,6 +2777,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><radio></term>
 <listitem><para>Default property is "string"
@@ -2715,6 +2792,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><dropdown></term>
 <listitem><para>Default property is "string"
@@ -2729,6 +2807,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><option></term>
 <listitem><para>No default property. "enabled" is the *only* property. It does not have the "visible" or "required" properties.
@@ -2739,6 +2818,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><checkbox></term>
 <listitem><para>Default property is "state"
@@ -2749,6 +2829,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><frame></term>
 <listitem><para>Default property is "checked", if - and only if - the frame is checkable. For non-checkable frames, there is no default property.
@@ -2759,6 +2840,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><input></term>
 <listitem><para>Default property is "text"
@@ -2769,7 +2851,35 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
+	<term><matrix></term>
+	<listitem><para>Default property is "cbind".
+	<variablelist>
+		<varlistentry>
+			<term>rows</term>
+			<listitem><para>Number of rows in the matrix (integer). If the matrix allows the user to add / remove rows, this property should be treated as read-only. Otherwise, changing it, will change the size of the matrix.</para></listitem>
+		</varlistentry>
+		<varlistentry>
+			<term>columns</term>
+			<listitem><para>Number of columns in the matrix (integer). If the matrix allows the user to add / remove columns, this property should be treated as read-only. Otherwise, changing it, will change the size of the matrix.</para></listitem>
+		</varlistentry>
+		<varlistentry>
+			<term>tsv</term>
+			<listitem><para>Data in the matrix in tsv format (string). Note that compared to the usual tsv layout, <emphasis>columns</emphasis>, not rows, are separated by newline characters, and cells within a column are separated by tabulator characters.</para></listitem>
+		</varlistentry>
+		<varlistentry>
+			<term>0,1,2...</term>
+			<listitem><para>The data from a single column (0 for leftmost column), separated by tabulator characters (string).</para></listitem>
+		</varlistentry>
+		<varlistentry>
+			<term>cbind</term>
+			<listitem><para>Data in a format suitable for pasting to R, wrapped in a cbind statement (string).</para></listitem>
+		</varlistentry>
+	</variablelist></para></listitem>
+</varlistentry>
+
+<varlistentry>
 <term><browser></term>
 <listitem><para>Default property is "selection"
 	<variablelist>
@@ -2779,6 +2889,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><saveobject></term>
 <listitem><para>Default property is "selection"
@@ -2801,6 +2912,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><spinbox></term>
 <listitem><para>Default property is either "int" or "real" depending on the spinbox's mode
@@ -2815,6 +2927,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><formula></term>
 <listitem><para>Default property is "model"
@@ -2841,6 +2954,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><embed></term>
 <listitem><para>No default property
@@ -2851,6 +2965,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><preview></term>
 <listitem><para>Default property is "state"
@@ -2861,6 +2976,7 @@
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
+
 <varlistentry>
 <term><convert></term>
 <listitem><para>This element (used in the <logic> section) is special, in that is technically *is* a property, instead of just holding one or more properties. It is of boolean kind. Note that useful modifiers of this property (as of all boolean properties) are "not" and "numeric" (see <link linkend="propertytypes">types of properties</link>)</para></listitem>

Modified: trunk/rkward/rkward/plugin/rkmatrixinput.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkmatrixinput.cpp	2012-11-02 10:08:57 UTC (rev 4406)
+++ trunk/rkward/rkward/plugin/rkmatrixinput.cpp	2012-11-02 11:34:20 UTC (rev 4407)
@@ -99,7 +99,7 @@
 }
 
 QString RKMatrixInput::value (const QString& modifier) {
-	if (modifier == "cbind") {
+	if (modifier.isEmpty () || (modifier == "cbind")) {
 		QStringList ret;
 		for (int i = 0; i < column_count->intValue (); ++i) {
 			ret.append ("\tc (" + makeColumnString (i, ", ") + ")");
@@ -110,7 +110,7 @@
 	bool ok;
 	int col = modifier.toInt (&ok);
 	if ((col >= 0) && ok) return makeColumnString (col, "\t", false);
-	return tsv_data->value (modifier);
+	return ("Modifier '" + modifier + "' not recognized\n"); 
 }
 
 bool RKMatrixInput::expandStorageForColumn (int 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