.. note:: **The information on this page is obsolete, incomplete or incorrect and left here only for reference and has not been ported to the new documentation wiki.** Please refer to the `TurboGears documentation wiki`_ for up-to-date documentation. .. _turbogears documentation wiki: http://docs.turbogears.org/
---
I started a proof of concept about another way to create and customize Widget. It's a work in progress, but feedback (goals/approach, style, tips,...) will be appreciated. The P.O.C include an API definition and implementation of part of it.
The result are Python packages (part are attached) and proposition about TG Widgets' futur (some proposition were based on idea found in mailing-list (Michele Cella,...)) :
Proposition
- define the simplest api that allow integration of widget with TG :
- the name of the method/attribute to retreive css js for a widget
- Resource and children class (don't need to be full widget)
- the methode to call to register static directory
- the signature/API of the method to display a value (value could be a dict)
- the signature/API of the method to validate/update values and error
- instead of render, source, sample, register, define an entry_points (like for template engine) use by Toolbox.
The advantages are:
class WidgetFamilySamples(toolbox.controllers.Root): """ Global description of the widget family """ def list(): """return the list of samples'name (string)""" pass def display(sample_name): """return the sample (like a call to widget.insert(...) or widget.display(...) (in my widgetit)""" pass def description(sample_name): """return the description of the sample as string (ReST format ?)""" pass def categories(sample_name): """return the list of categories (string)""" pass #define exposed methods used to illustrate some special features (validation/AJAX,...) #...
- provide sample are optionnal for widget developer
- several samples could be provide to illustrate usage of a widget
- sample could illustrate usage of a group/assemblage of widget
- sample could use server-side features
- don't force the internal implementation of widgets (with attribute like template, or method like creat_dict())
Attachments
- api.py (7.8 kB) - added by David Bernard <dwayne@java-fan.com> on 01/20/06 12:01:42.
- api.2.py (8.0 kB) - added by David Bernard <dwayne@java-fan.com> on 01/24/06 15:07:48.
- basicfield.py (10.4 kB) - added by David Bernard <dwayne@java-fan.com> on 01/24/06 15:08:22.
- decorator.py (4.0 kB) - added by David Bernard <dwayne@java-fan.com> on 01/24/06 15:08:48.
- deprecated.py (4.4 kB) - added by David Bernard <dwayne@java-fan.com> on 01/24/06 15:09:08.
- api.3.py (8.7 kB) - added by David Bernard <dwayne@java-fan.com> on 01/26/06 04:59:16.