[rkward-devel] a new approach to external plugins

meik michalke meik.michalke at uni-duesseldorf.de
Sat Aug 27 14:43:47 UTC 2011


hi,

Am Samstag, 27. August 2011, 12:54:07 schrieb Thomas Friedrichsmeier:
> On Friday 12 August 2011, meik michalke wrote:
> > i tried to make the XML paste function rather generic, although this is
> > just a first round... but with some tweaking we could later re-use it,
> > e.g., to write helpful functions like
> > 
> >  rk.create.tabbook(tabs=2, labels=c("Data", "Options"))
> >  ...

i was on a train yesterday, toying around with the idea. each time i start on 
a new plugin i find the first steps quite "boring", so i tried to come up with 
something like a shortcut. so this is the result of my travelling, as of now:

  test.dropdown <- rk.XML.dropdown("mydrop",
    opts=list("First Option"=c(val="val1"),
    "Second Option"=c(val="val2", chk=TRUE)))

  test.tabbook <- rk.XML.tabbook("My Tabbook", tab.labels=c("First Tab",
    "Second Tab"), children=list(test.dropdown, NULL))

  test.plugin <- rk.XML.plugin("MyPlugin", label="My Plugin", 
    children=list(test.tabbook))

if you then call

  cat(pasteXMLTree(test.plugin, shine=1))

this is what you get:

<!DOCTYPE rkplugin >
<document>
  <code file="MyPlugin.js" />
  <help file="MyPlugin.rkh" />
  <logic>
    <convert id="<edit>" mode="<edit>" sources="<edit>" standard="<edit>" />
    <connect client="<edit>" governor="<edit>" />
  </logic>
  <dialog label="My Plugin">
    <tabbook label="My Tabbook" id="tbk.MyTabbok">
      <tab label="First Tab" id="tab.FirstTab">
        <dropdown label="mydrop" id="drp.mydrop">
          <option label="First Option" value="val1" />
          <option label="Second Option" value="val2" checked="true" />
        </dropdown>
      </tab>
      <tab label="Second Tab" id="tab.SecondTb">
      </tab>
    </tabbook>
  </dialog>
</document>

i can't upload the new package to the repo while i'm not home, will do that 
tomorrow. i'll have another few hours of hacking time on train until then, so 
i think i'll add some other basic stuff as well. i know i'll use it for my 
next plugins ;-) it's really easy with the XiMpLe functions.

> For the moment, however, I see the most convincing use-case for a single
> function
>   rk.create.plugin.skeleton()
> (of which rk.write.about()) is the most complex part. (And possibly, later,
> an additional function which will update the meta information in an
> existing rkward plugin pack/package).

yes, all of that should be possible as well. btw., i've moved away from 
rk.write.about() in the XiMpLe package and replaced it with rk.XML.about(). in 
the end you get the same result, though.

> As long as that is all we offer, it can reasonably be included in the
> rkward package, IMO.

sure. i put the XML stuff into a package because i would like to be able to 
re-use it in other packages as well. right now it's a mess, with all the rk.-
functions in the package, but i can clean up later ;-)

> The helper functions (pasteXMLTag(), etc.) should probably be moved into
> rk.write.about() as local functions. Of course, I wouldn't mind depending
> on your XiMpLe package, for this purpose, once that is stable enough and
> on CRAN.

there's only one more thing which is so not working... it's reading XML nodes 
which have a text value with embedded other XML nodes. and non-empty tags 
without value or children turn into empty tags, i need to preserve that type 
info someway. but these are probably not issues for RKWard anyway.

compared to the XML package this one's really primitve, i don't know if it's 
meant for CRAN?


viele grüße :: m.eik

-- 
  dipl. psych. meik michalke
  abt. f"ur diagnostik und differentielle psychologie
  institut f"ur experimentelle psychologie
  heinrich-heine-universit"at d"usseldorf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20110827/809295a7/attachment.sig>


More information about the Rkward-devel mailing list