[reportlab-users] Widget Libraries, anywhere??

Dinu Gherman reportlab-users@reportlab.com
Wed, 8 Oct 2003 10:10:48 +0200


Tim Roberts:

> Widgets?  In what sense?  Can you give me an example of what you would
> picture as a ReportLab "widget"?

Tim, have you read the Graphics Guide? In chapter 4.1 "Shapes vs.
Widgets" it says:

   We want to build reusable graphic objects, including a powerful
   chart library. To do this we need to reuse more tangible things
   than rectangles and circles. We should be able to write objects
   for other to reuse - arrows, gears, text boxes, UML diagram nodes,
   even fully fledged charts.
   [...] The Widget standard is a standard built on top of the
   shapes module. Anyone can write new widgets, and we can build up
   libraries of them.

> Platypus, which is part of ReportLab, is probably the closest thing to 
> a
> widget set in the current product.  So far, I have had only a small 
> number
> of instances where I felt that the standard set did not work, and in 
> those
> cases I found it surprisingly easy to create my own.

Platypus is a layouting "engine", a bit like many others emboddied
by document generation applications including your favourite "text
processor." I regard the flowables it places somewhere as widgets
if they are some kind of *graphic* things, a diagram, drawing, an
image or any combination of all that, plus some optional text. If
you regard a pure text paragraph as widget, fine, but this is un-
common and the general category in this context is a flowable.

>> Or is the "standard" too confusing and/or vague?
>
> If I may exaggerate just a bit, when the standard IS the source code,
> vagueness is not an issue.  If the code says so, that's the standard.

The issue with that kind of statement is that you might have to re-
code your sources as soon as the next release comes out, without
having much of a clue of how to do it. I'm not saying this is the
very reason for why I cannot find any real widget sets, I'm just
raising the issue for others to come up with other possible expla-
nations.

>> Or maybe the sample widget collections? I personally feel very 
>> confused
>> by the flags stuff which is far away from what it should be like in an
>> OO world, but YMMV, of course.
>
> Perhaps you should give some specific examples.  Code contributions are
> always welcome, of course!

Sure! I wrote some grids you might already know:

   reportlab/graphics/widgets/grids.py

and some parts of the chart widgets you are perhaps using:

   reportlab/graphics/charts

You can also use svglib to render SVG into RL drawings (widgets):

   http://python.net/~gherman/svglib.html

And there is an increasing body of so far publically largely unre-
leased stuff like:

   http://python.net/~gherman/CircularString.html
   http://python.net/~gherman/tmp/TelcoInvoice.pdf
   http://python.net/~gherman/tmp/PyPy.pdf

I'm happy to contribute stuff, but I wonder how much others are
contributing?

Regards,

Dinu

--
Dinu C. Gherman
......................................................................
"The whole point of brainwashing, is that those being brainwashed
don't know it." (Graham Haley)