translateablecanvas
commita33b8583278409434bb885eecc21b7294a570647
authorMichael J Gruber <michaeljgruber@users.sourceforge.net>
Thu, 29 Jun 2006 16:33:06 +0000 (29 18:33 +0200)
committerMichael J Gruber <michaeljgruber@users.sourceforge.net>
Thu, 29 Jun 2006 16:33:06 +0000 (29 18:33 +0200)
tree958489e6c55de3fb880f39a12f1109c653a31f78
parenta1e7c85bd970f4c07784a70fa18792d4fa31524c
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.
examples/graphstyles/INDEX
examples/graphstyles/insert.py [new file with mode: 0644]
examples/graphstyles/insert.txt [new file with mode: 0644]
pyx/canvas.py