[reportlab-users] Widgets as Flowables...

Dinu Gherman reportlab-users@reportlab.com
Sat, 28 Sep 2002 10:37:58 +0200

Andy Robinson:

>> Alas, they cannot render symbols or flags or markers, although
>> all of these are subclasses of Widget (they have a size attribute
>> but no width or height)...
> Exactly.  In principle you could make the renderer draw such a thing
> on a canvas, but couldn't easily use it in Platypus.

I can play ugly tricks in drawing wrappers to still render these
would-be widgets, but the clean way would be to mandate for all
widgets to have a width and height attribute and to set them for
symbols, etc. from their size attribute.

This would leave many other problems about reusing markers and
flags, say, but I have described those elsewhere...

>> What then, probably, is misleading is the fact that the code for
>> all renderers mentions only drawings as the things they are able
>> to render, where in fact they also can render shapes and widgets.
> That was not intended - by me, anyway :-)  I think that
> with better refactoring we could hide this extra behaviour.
> This should not be counted on in future and I should put
> a clear warning in the docco and maybe an isinstance test
> inside each renderer.

Undoing features?? ;-) As an aside, I've browsed the Graphics Guide
again and I found very sloppy and vague usage of the term "Drawing",
where it is often unclear if it means the Drawing class or just the
"idea" or concept of a drawing.

I've also seen examples of widgets returning a Drawing instance in
their demo() method, which I guess is not the way it should be (un-
less, of course, that was the proclaimed idea behind the demo method).

All this does contribute to a certain background confusion that should
really disappear if people are supposed to create reusable domain-
specific graphics collections. Actually I'd like Robin to post about
his own painful (?) experience with charts, here! :-)

What I really miss is a collection of stories explaining the intended
functionality, but then, this is a different school again... ;-)


Dinu C. Gherman
"Honest disagreement is often a good sign of progress." (Gandhi)