translateablecanvas
Arnd Baecker venit, vidit, dixit 2006-06-28 22:25:
> Hi Andre,
>
> some time ago you sent me the ``translateablecanvas.py``,
> http://sourceforge.net/mailarchive/message.php?msg_id=
9364374
>
>
> Unfortunately, it does not work anymore with a recent PyX
> (at some point you already sent me an updated version
> compared to the one at the link,
> but I can't find it in the archive.
> This - updated one - makes use of base.canvasitem, which
> presently should be canvas.canvasitem, I'd guess.
> Still, my attempts at a conversion failed as
> quite a few things seem to have changed since then
> and I don't understand the details well enough.
That code worked around the time of PyX 0.6.3 but not much longer, I
guess. Back then there was only PS which is why getting the PS fragment
in translate_pt() worked that way. Now the canvas doesn't know whether
it's going to be output as PS or PDF (or SVG...).
I couldn't resist taking a shot at this. The attached code derives an
insertstyle from graph.style.symbol which can be used in exactly the
same way (this is different from the original code you mention) but
inserts references in the PS instead of repeating the paths (following
Andre's ideas). The savings are only on the PS side, not in python
(there are canvas instances for each symbol being drawn).
insertstyle should be able to handle changeable attributes but I haven't
tried.