[reportlab-users] Widgets as Flowables...
Andy Robinson
reportlab-users@reportlab.com
Thu, 26 Sep 2002 21:47:40 +0100
I don't see how you can say responsibilities are
confused. The intended use is well documented and I have
explained it many times. Right now we have two loosely
coupled subsystems and some freedom to develop each
independently. I like it that way. It is very, very hard
to design systems where you can do anything, anywhere.
Let me try one more time to explain the intended use:
Drawings are the boundary of the graphics package.
A Drawing instance represents, ermmm, a rectangular
drawing: a chart, a flowchart, diagram. This is
something which you often want to include in the middle
of a long document, but also might want as a standalone
GIF, or an EPS. We did it that way because our first
customer said "That's a cool network status diagram,
but can I have it on the web as well as on page 3 of that
report?". Nobody we dealt with was or is interested in
rendering whole documents as GIFs or TIFFs, but we managed
to solve the problem well for drawings.
Shapes and Widgets are what Drawings contain. Widgets
are intended for things like an 'x-axis': they have
properties a user might want to set, and they can be
decomposed into primitive shapes. There was never
any intention that they should be usable outside of
the Drawing.
You can put a Drawing in a story, or draw it on
the canvas, because it's a flowable with a known
size. If you want to use a widget in PDF, you are
supposed to put it in a drawing first e.g.
myCanvas = Canvas('encapsulation.pdf')
myWidget = Rect(0,0,200,100,fillColor=red)
1. myDrawing = Drawing(300,200)
2. myDrawing.add(myWidget)
myDrawing.drawOn(myCanvas, 100,500)
myCanvas.save()
Please explain to me why lines (1) and (2) are so much
trouble, or what the encapsulation stops you from
doing....
Regards,
Andy