[rkward] packages/rkwarddev: merging changes (rkwarddev) into master

m.eik michalke meik.michalke at uni-duesseldorf.de
Wed Dec 9 13:22:21 UTC 2015


Git commit 221a3d0dd585e4877d152224920f73b4b029bf9b by m.eik michalke.
Committed on 09/12/2015 at 13:24.
Pushed by meikm into branch 'master'.

merging changes (rkwarddev) into master

  - was updated in releases/0.6.4

M  +1    -3    packages/rkwarddev/ChangeLog
M  +6    -6    packages/rkwarddev/R/01_methods_01_plugin2script.R
M  +1    -1    packages/rkwarddev/R/rk.JS.options.R
M  +1    -5    packages/rkwarddev/R/rk.XML.valueslot.R
M  +1    -5    packages/rkwarddev/R/rk.XML.varslot.R
M  +2    -67   packages/rkwarddev/inst/doc/rkwarddev_vignette.Rnw
M  +-    --    packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
M  +2    -67   packages/rkwarddev/vignettes/rkwarddev_vignette.Rnw

http://commits.kde.org/rkward/221a3d0dd585e4877d152224920f73b4b029bf9b

diff --git a/packages/rkwarddev/ChangeLog b/packages/rkwarddev/ChangeLog
index 74878d3..d6128ab 100644
--- a/packages/rkwarddev/ChangeLog
+++ b/packages/rkwarddev/ChangeLog
@@ -18,8 +18,6 @@ fixed:
     lines
   - the "i18n" attribute in lists e.g. for rk.XML.radio() didn't really work
   - improved indetation for rk.JS.oset objects
-  - rk.XML.varslot() and rk.XML.valueslot() didn't correctly add sources if
-    they were character strings (which is valid)
   - R.comment() didn't correctly paste indentation levels > 2
 added:
   - new methods plugin2script() to try to translate raw plugin XML into
@@ -55,7 +53,7 @@ changed:
   - improved error handling in rk.JS.header(), error messages are more
     informative now
   - rk.uniqueIDs() now checks "dialog" and "wizard" sections separately
-  - updated the vignette with information on js(), plugin2script(), and how to add help pages
+  - updated the vignette with information on js() and how to add help pages
   - internal function modif.validity() now calls modifiers() to give more
     useful feedback
   - all functions offering "intent.by" as an option now fetch the default
diff --git a/packages/rkwarddev/R/01_methods_01_plugin2script.R b/packages/rkwarddev/R/01_methods_01_plugin2script.R
index 9b5b3f3..a09c995 100644
--- a/packages/rkwarddev/R/01_methods_01_plugin2script.R
+++ b/packages/rkwarddev/R/01_methods_01_plugin2script.R
@@ -77,7 +77,7 @@
 #' identical(rkdev.row.row_clmndc1212, test.checkboxes)
 setGeneric(
   "plugin2script",
-  function(obj, prefix="", indent=TRUE, level=1, drop.defaults=TRUE, node.names=FALSE, collapse="."){
+  function(obj, prefix="rkdev", indent=TRUE, level=1, drop.defaults=TRUE, node.names=TRUE, collapse="."){
     standardGeneric("plugin2script")
   }
 )
@@ -89,7 +89,7 @@ setGeneric(
 #' @import XiMpLe
 setMethod("plugin2script",
   signature(obj="XiMpLe.doc"),
-  function(obj, prefix="", indent=TRUE, level=1, drop.defaults=TRUE, node.names=FALSE, collapse=".") {
+  function(obj, prefix="rkdev", indent=TRUE, level=1, drop.defaults=TRUE, node.names=TRUE, collapse=".") {
     # search for logic, dialog and wizard sections
     secLogic <- XMLScan(obj, "logic")
     secDialog <- XMLScan(obj, "dialog")
@@ -132,7 +132,7 @@ setMethod("plugin2script",
 #' @import XiMpLe
 setMethod("plugin2script",
   signature(obj="XiMpLe.node"),
-  function(obj, prefix="", indent=TRUE, level=1, drop.defaults=TRUE, node.names=FALSE, collapse=".") {
+  function(obj, prefix="rkdev", indent=TRUE, level=1, drop.defaults=TRUE, node.names=TRUE, collapse=".") {
     return(p2s(node=obj, indent=indent, level=level, prefix=prefix, drop.defaults=drop.defaults, node.names=node.names, collapse=collapse))
   }
 )
@@ -144,7 +144,7 @@ setMethod("plugin2script",
 #' @import XiMpLe
 setMethod("plugin2script",
   signature(obj="character"),
-  function(obj, prefix="", indent=TRUE, level=1, drop.defaults=TRUE, node.names=FALSE, collapse=".") {
+  function(obj, prefix="rkdev", indent=TRUE, level=1, drop.defaults=TRUE, node.names=TRUE, collapse=".") {
     XML.tree <- parseXMLTree(obj)
     return(
       plugin2script(
@@ -167,7 +167,7 @@ setMethod("plugin2script",
 #' @import XiMpLe
 setMethod("plugin2script",
   signature(obj="connection"),
-  function(obj, prefix="", indent=TRUE, level=1, drop.defaults=TRUE, node.names=FALSE, collapse=".") {
+  function(obj, prefix="rkdev", indent=TRUE, level=1, drop.defaults=TRUE, node.names=TRUE, collapse=".") {
     XML.tree <- parseXMLTree(obj)
     return(
       plugin2script(
@@ -411,7 +411,7 @@ p2s.checkTabIDs <- function(node){
 ## function p2s()
 # this is the main work horse, going through nested XML nodes recursively
 # called by the actual methods
-p2s <- function(node, indent=TRUE, level=1, prefix="", drop.defaults=TRUE, node.names=FALSE, collapse="."){
+p2s <- function(node, indent=TRUE, level=1, prefix="rkdev", drop.defaults=TRUE, node.names=TRUE, collapse="."){
   nodeName <- XMLName(node)
   nodeAttrs <- XMLAttrs(node)
   # fail if we don't know this node type
diff --git a/packages/rkwarddev/R/rk.JS.options.R b/packages/rkwarddev/R/rk.JS.options.R
index 1fbe15a..b741640 100644
--- a/packages/rkwarddev/R/rk.JS.options.R
+++ b/packages/rkwarddev/R/rk.JS.options.R
@@ -24,7 +24,7 @@
 #'    (e.g., \code{"paired=TRUE"} or \code{qp("conf.level=\"", conflevel, "\"")}.
 #' @param collapse Character string, how all options should be concatenated on the R code level
 #'    (if \code{array=FALSE}), or how \code{option} should be added to the generated R code. Hint:
-#'    To place each option in a new line with tab indentation, set \code{collapse=",\\\\n\\\\t"}.
+#'    To place each option in a new line with tab indentation, set \code{collapse=",\\n\\t"}.
 #' @param option A character string, naming, e.g., an option of an R function which should be
 #'    constructed from several variables. Only used if \code{array=TRUE}.
 #' @param funct Character string, name of the R function to be called to combine the options,
diff --git a/packages/rkwarddev/R/rk.XML.valueslot.R b/packages/rkwarddev/R/rk.XML.valueslot.R
index 67a3eb8..5a5f5b7 100644
--- a/packages/rkwarddev/R/rk.XML.valueslot.R
+++ b/packages/rkwarddev/R/rk.XML.valueslot.R
@@ -78,11 +78,7 @@ rk.XML.valueslot <- function(label, source, property=NULL, required=FALSE, multi
         value.slot.attr[["source_property"]] <- paste(check.ID(source), property, sep=".")
       } else {}
     }
-  } else if(is.character(source)){
-    var.slot.attr[["source"]] <- check.ID(source)
-  } else {
-    stop(simpleError("No valid 'source' value given!"))
-  }
+  } else {}
 
   if(isTRUE(required)){
     value.slot.attr[["required"]] <- "true"
diff --git a/packages/rkwarddev/R/rk.XML.varslot.R b/packages/rkwarddev/R/rk.XML.varslot.R
index 87a825b..0fae276 100644
--- a/packages/rkwarddev/R/rk.XML.varslot.R
+++ b/packages/rkwarddev/R/rk.XML.varslot.R
@@ -88,11 +88,7 @@ rk.XML.varslot <- function(label, source, property=NULL, required=FALSE, multi=F
         var.slot.attr[["source_property"]] <- paste(check.ID(source), property, sep=".")
       } else {}
     }
-  } else if(is.character(source)){
-    var.slot.attr[["source"]] <- check.ID(source)
-  } else {
-    stop(simpleError("No valid 'source' value given!"))
-  }
+  } else {}
 
   if(!is.null(classes)){
     var.slot.attr[["classes"]] <- paste(classes, collapse=" ")
diff --git a/packages/rkwarddev/inst/doc/rkwarddev_vignette.Rnw b/packages/rkwarddev/inst/doc/rkwarddev_vignette.Rnw
index fa4c346..72879b6 100644
--- a/packages/rkwarddev/inst/doc/rkwarddev_vignette.Rnw
+++ b/packages/rkwarddev/inst/doc/rkwarddev_vignette.Rnw
@@ -91,7 +91,6 @@ how you use them will also be explained later on:
 \begin{itemize}
   \item  \texttt{echo()}: Produces an equivalent of the JavaScript \texttt{echo()} function
   \item  \texttt{id()}: Similar to paste, but replaces \texttt{rkwarddev} objects with their ID value
-  \item  \texttt{idq()}: Like \texttt{id}, but also quotes the ID value
   \item  \texttt{js()}: Short for JavaScript, like \texttt{id()}, but will translate \texttt{if} control structures and some operands directly from R to JavaScript
   \item  \texttt{qp()}: Short for ''\textbf{q}uote \& \textbf{p}lus``, like \texttt{id()}, but with different replacement defaults
   \item  \texttt{ite()}: Short for ''\textbf{i}f, \textbf{t}hen, \textbf{e}lse``, a shortcut to generate JavaScript \texttt{if() \{\} else \{\}} conditions
@@ -479,7 +478,7 @@ the condition but translate it into JavaScript code:
 As you can see, the resulting JavaScript code is very similar to the \texttt{R} code that created it, so using \texttt{js()} is probably preferable
 over \texttt{ite()}. Notice the \texttt{cat()} call here? In contrast to \texttt{ite()} the output of \texttt{js()} is already a character string.
 
-But \texttt{js()} can do more: It also preserves some often used operators from evaluation, so for instance you can do comparisons in your \texttt{if}
+But \texttt{js()} can do more: It also preserves some ofeten used operators from evaluation, so for instance you can do comparisons in your \texttt{if}
 clause:
 
   \begin{Schunk}
@@ -556,7 +555,7 @@ Now the plugin actually changes the generated code if you select an object from
 
 \subsection{Adding help pages}
 
-To help users understanding your plugin, it is a good practice to add a help page to it, allthough it is optional, technically.
+To help users understanding your plugin, it is a good practice to add a help page to it, allthoug it is optional, technically.
 A help starts with a summary and global usage information, and then usually has detailed information on each GUI element of the
 plugin dialog. It is very easy to add a help page with \texttt{rkwarddev}, so there is literally no excuse.
 
@@ -612,70 +611,6 @@ Now the plugin has a working \textit{Help} button which opens a page in the help
  \includegraphics{./RKWard_vign_example_help_page.png}
 \end{center}
 
-\section{Turning existing plugins into \texttt{rkwarddev} scripts}
-
-Imagine you already have your (manually written) \texttt{RKWard} plugin, and now would like to continue its development using
-an \texttt{rkwarddev} script. Do you have to rewrite everything from scratch? Fortunately, you don't. And even if you don't want
-to use \texttt{rkwarddev} for further development, the following might still be helpful for you, as it can be used to check
-your plugin code for undetected errors.
-
-The function \texttt{plugin2script()} can be used to go the other way around and generate \texttt{rkwarddev} script code from
-plugin XML code. It is capable of parsing *.xml files or \texttt{XiMpLe} objects. If the parsed code contains invalid
-syntax, you should get a warning, otherwise it returns a character string that can be used in a script to generate the equivalent
-XML code:
-
-  \begin{Schunk}
-    \begin{Sinput}
-> cat(plugin2script(myDialog))
-    \end{Sinput}
-    \begin{Soutput}
-rk.XML.dialog(
-  row_vCCEXMLEXM <- rk.XML.row(
-    my_vars <- rk.XML.varselector(
-      id.name="my_vars"
-    ),
-    clm_vCCEXMLEXM <- rk.XML.col(
-      vrsl_Chosvrbl <- rk.XML.varslot(
-        label="Chose a variable",
-        source="my_vars",
-        id.name="vrsl_Chosvrbl"
-      ),
-      frm_ExmplXML <- rk.XML.frame(
-        chc_Checkme <- rk.XML.cbox(
-          label="Check me!",
-          id.name="chc_Checkme"
-        ),
-        chc_Nocheckm <- rk.XML.cbox(
-          label="No, check me!!!",
-          chk=TRUE,
-          id.name="chc_Nocheckm"
-        ),
-        label="Example XML object",
-        id.name="frm_ExmplXML"
-      ),
-      id.name="clm_vCCEXMLEXM"
-    ),
-    id.name="row_vCCEXMLEXM"
-  ),
-  label="Example dialog"
-)
-    \end{Soutput}
-  \end{Schunk}
-
-This can be optimized, e.\,g., by re-ordering the object defintions without all the nesting,
-replacing the character string \texttt{source="my\_vars"} in \texttt{rk.XML.varslot()} with the varselector object etc.
-But it sure is a good start and saves a lot of typing. Most importantly, the generated XML
-object of this script code is identical to the analyzed object:
-
- \begin{Schunk}
-   \begin{Sinput}
->  identical(eval(parse(text=plugin2script(myDialog))), myDialog)
-   \end{Sinput}
-   \begin{Soutput}
-[1] TRUE
-   \end{Soutput}
- \end{Schunk}
-
 % \subsection{The whole is more than the sum of its parts}
 % 
 % 
diff --git a/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf b/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
index 57cb5aa..c6456a5 100644
Binary files a/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf and b/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf differ
diff --git a/packages/rkwarddev/vignettes/rkwarddev_vignette.Rnw b/packages/rkwarddev/vignettes/rkwarddev_vignette.Rnw
index fa4c346..72879b6 100644
--- a/packages/rkwarddev/vignettes/rkwarddev_vignette.Rnw
+++ b/packages/rkwarddev/vignettes/rkwarddev_vignette.Rnw
@@ -91,7 +91,6 @@ how you use them will also be explained later on:
 \begin{itemize}
   \item  \texttt{echo()}: Produces an equivalent of the JavaScript \texttt{echo()} function
   \item  \texttt{id()}: Similar to paste, but replaces \texttt{rkwarddev} objects with their ID value
-  \item  \texttt{idq()}: Like \texttt{id}, but also quotes the ID value
   \item  \texttt{js()}: Short for JavaScript, like \texttt{id()}, but will translate \texttt{if} control structures and some operands directly from R to JavaScript
   \item  \texttt{qp()}: Short for ''\textbf{q}uote \& \textbf{p}lus``, like \texttt{id()}, but with different replacement defaults
   \item  \texttt{ite()}: Short for ''\textbf{i}f, \textbf{t}hen, \textbf{e}lse``, a shortcut to generate JavaScript \texttt{if() \{\} else \{\}} conditions
@@ -479,7 +478,7 @@ the condition but translate it into JavaScript code:
 As you can see, the resulting JavaScript code is very similar to the \texttt{R} code that created it, so using \texttt{js()} is probably preferable
 over \texttt{ite()}. Notice the \texttt{cat()} call here? In contrast to \texttt{ite()} the output of \texttt{js()} is already a character string.
 
-But \texttt{js()} can do more: It also preserves some often used operators from evaluation, so for instance you can do comparisons in your \texttt{if}
+But \texttt{js()} can do more: It also preserves some ofeten used operators from evaluation, so for instance you can do comparisons in your \texttt{if}
 clause:
 
   \begin{Schunk}
@@ -556,7 +555,7 @@ Now the plugin actually changes the generated code if you select an object from
 
 \subsection{Adding help pages}
 
-To help users understanding your plugin, it is a good practice to add a help page to it, allthough it is optional, technically.
+To help users understanding your plugin, it is a good practice to add a help page to it, allthoug it is optional, technically.
 A help starts with a summary and global usage information, and then usually has detailed information on each GUI element of the
 plugin dialog. It is very easy to add a help page with \texttt{rkwarddev}, so there is literally no excuse.
 
@@ -612,70 +611,6 @@ Now the plugin has a working \textit{Help} button which opens a page in the help
  \includegraphics{./RKWard_vign_example_help_page.png}
 \end{center}
 
-\section{Turning existing plugins into \texttt{rkwarddev} scripts}
-
-Imagine you already have your (manually written) \texttt{RKWard} plugin, and now would like to continue its development using
-an \texttt{rkwarddev} script. Do you have to rewrite everything from scratch? Fortunately, you don't. And even if you don't want
-to use \texttt{rkwarddev} for further development, the following might still be helpful for you, as it can be used to check
-your plugin code for undetected errors.
-
-The function \texttt{plugin2script()} can be used to go the other way around and generate \texttt{rkwarddev} script code from
-plugin XML code. It is capable of parsing *.xml files or \texttt{XiMpLe} objects. If the parsed code contains invalid
-syntax, you should get a warning, otherwise it returns a character string that can be used in a script to generate the equivalent
-XML code:
-
-  \begin{Schunk}
-    \begin{Sinput}
-> cat(plugin2script(myDialog))
-    \end{Sinput}
-    \begin{Soutput}
-rk.XML.dialog(
-  row_vCCEXMLEXM <- rk.XML.row(
-    my_vars <- rk.XML.varselector(
-      id.name="my_vars"
-    ),
-    clm_vCCEXMLEXM <- rk.XML.col(
-      vrsl_Chosvrbl <- rk.XML.varslot(
-        label="Chose a variable",
-        source="my_vars",
-        id.name="vrsl_Chosvrbl"
-      ),
-      frm_ExmplXML <- rk.XML.frame(
-        chc_Checkme <- rk.XML.cbox(
-          label="Check me!",
-          id.name="chc_Checkme"
-        ),
-        chc_Nocheckm <- rk.XML.cbox(
-          label="No, check me!!!",
-          chk=TRUE,
-          id.name="chc_Nocheckm"
-        ),
-        label="Example XML object",
-        id.name="frm_ExmplXML"
-      ),
-      id.name="clm_vCCEXMLEXM"
-    ),
-    id.name="row_vCCEXMLEXM"
-  ),
-  label="Example dialog"
-)
-    \end{Soutput}
-  \end{Schunk}
-
-This can be optimized, e.\,g., by re-ordering the object defintions without all the nesting,
-replacing the character string \texttt{source="my\_vars"} in \texttt{rk.XML.varslot()} with the varselector object etc.
-But it sure is a good start and saves a lot of typing. Most importantly, the generated XML
-object of this script code is identical to the analyzed object:
-
- \begin{Schunk}
-   \begin{Sinput}
->  identical(eval(parse(text=plugin2script(myDialog))), myDialog)
-   \end{Sinput}
-   \begin{Soutput}
-[1] TRUE
-   \end{Soutput}
- \end{Schunk}
-
 % \subsection{The whole is more than the sum of its parts}
 % 
 % 



More information about the rkward-tracker mailing list