Wrapping JQuery plugins for ToscaWidgets/TurboGears

Continuing my explorations of JQuery + TurboGears today, I started working on a simple RTE-light wrapper widget.  RTE-light is an extremely small, simple analogue to TinyMCE, so I figured it would be easy to set it up with the tw.tinymce project as reference.

There's a paster script to auto-start a widget project, so that went easily.  The things I ran into that I'll have to look into updating the docs regarding:

  • who should show up as author for a "wrapper" project?  Need to add packager stuff at some point.
  • it is *only* the "javascript" directory which is shared from the "static" subdirectory in the /toscawidgets path.  I spent quite a while trying to use static/rte-light for my javascript, icons and the like
  • there must be a way to say "what URL will this file show up at" within the toscawidgets resource tree, but I didn't find it.  I wound up hard-coding the reference (rte-light wants a base URL from which to load its icons).
  • I got stuck for quite a while trying to use the default template in the class... of course a rte-light widget needs a TextArea, not a Div, and until I switched to a tw.forms.TextArea as the base class I had no luck with anything.
  • would be nice to have some way to just say "include this string as a javascript script" other than calling self.add_call() on the widget (i.e. be able to just add a string to the javascript attribute).

Given the sheer number of JQuery plugins, I don't think this kind of project is going to be done for all of them.  My "abstraction" itch is telling me to write some kind of automated wrapping mechanism or a "hack" way to use X extension without any packaging/wrapping.  My "concretism" itch is saying "just wrap the ones people actually want to use, and wrap them properly".

Which reminds me, I have to get that PyCon presentation written up...

Comments

  1. Ed Valentine

    Ed Valentine on 10/09/2009 2:52 p.m. #

    I have been looking at several grid tools and am really impressed with the jqGrid and the features. Also, it is being supported and improved. Flexigrid looks good but support seems to be lacking.

    I am trying to use jqGrid with Turbogears 2.0/2.1 and am looking for some relevant code sample to use as a starting place.

    I am new to TG and python and am trying to climb the learning curve.

    Any suggestions or pointers will be appreciated.

    Thanks.

Comments are closed.

Pingbacks

Pingbacks are closed.