|
From: Joerg L. <jo...@us...> - 2003-10-16 11:42:26
|
Hi André, Fernando, and *,
On 16.10.03, Andre Wobst wrote:
> On 15.10.03, Fernando Perez wrote:
> > 'import pyx' doesn't provide access to pyx's modules. The examples provided
> > all use 'from pyx import *', which is bad form for larger scripts, where this
> > kind of blanket import is bound to cause nasty name collisions.
> >
> > FIX: trivial. In __init__.py, add after __all__ is defined:
> >
> > # Load __all__ in pyx namespace so that a simple 'import pyx' gives
> > # access to them via pyx.<name>
> > for name in __all__:
> > __import__(name,globals(),locals(),[])
>
> Right now you can do the following:
>
> wobsta@mbo:~$ python
> Python 2.3.2 (#1, Oct 6 2003, 16:59:47)
> [GCC 2.95.4 20011002 (Debian prerelease)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import pyx
> >>> import pyx.canvas
> >>> c = pyx.canvas.canvas()
> >>> c.text(0, 0, "Hello, world!")
> <pyx.text._textbox instance at 0x4030f86c>
> >>> c.writetofile("hello")
>
> Yes, you have to do the second import statement. But is that really a
> crucial point? I'm interested in Jörgs response to that as well.
I'm not sure about that. Of course, at the moment an "import pyx"
doesn't do anything (expect providing access to pyx.__version__ and
pyx.__all__) and using the code given above it would at least do
something reasonable. On the other hand, the behaviour seems to
be rather implicit than explicit to me. So, as I said, I don't know.
> I quickly want to summarize my impression (also in order to tell Jörg
> about my point of what we should do):
>
> 1) We need some runtime configuration possibility (like a pyxrc). We
> had discussed it in terms of the mapping files before already. There
> are two further use-cases: the timeout configuration (suggested above)
> and the TeX --ipc option (I've done some tests working nicely, but now
> I have to work in the direction of a pagewise dvi-reading inside PyX).
Ok.
> 2) I have to address the share/data_files search path issue.
Maybe also something for a pyxrc?
Greetings,
Jörg
--
JOERG LEHMANN | PyX - High quality PostScript figures with Python & TeX
jo...@lu... | Visit http://pyx.sourceforge.net/
|