Re: Loading dia module in python



At 21.01.2009 13:52, Philip Cavaco wrote:
> [...]
I would like to load a .dia image in python outside of the Dia python
console.
You could write a plug-in for Dia in Python - see http://projects.gnome.org/dia/python.html but currently a script using

import dia

will only work inside of Dia. The first Dia Python bindings are based on Python running embedded in Dia. See: http://docs.python.org/extending/embedding.html

I have downloaded the source but can't find any clear
documentation about how to build Dia using the --with-python flag.
Huh? You pass in the flag and the python plug-in gets build. For more information just use the souce ;)

But indeed there is no dedicated documentation about how Dia is embedding Python - can't even point you to the documentation that it does.

Some more information available with the announcement of my effort to create stand-alone bindings:

http://mail.gnome.org/archives/dia-list/2007-March/msg00092.html

But even if you can make it work the requested functionality to load a .dia file is not available there yet, because that is implemented in app/load_save.c - but just part of lib/ is accessible with the second binding effort. All import/export formats implemented as pug-ins should work from the standalone bindings, see: http://svn.gnome.org/viewvc/dia/trunk/bindings/test.py?view=log

If I
can get this working would it install the dia module into pythons
site-packages so that it can be loaded easily in python?

No, see above.

        Hans

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]