Re: Importing Dia from outside of the embedded python



At 04.09.2009 03:59, Alexander Fairley wrote:
Hi guys,

Is it possible to import the dia module from outside of a running dia
instance?
Short answer: no. Longer answer:
        http://mail.gnome.org/archives/dia-list/2007-March/msg00092.html

It would make sense to me that this is impossible, but I just
wanted to get confirmation that I wasn't building dia incorrectly.
The Dia python *plug-in* embedds Python, it only allows to write Dia plug-ins.

It would of course be very cool to be able to drive dia from external python
scripts.
Depending on your use case this might be possible still be possible by os.popen ("dia --..."), aka. as command line driven.

How can I run the python plugins that come with dia?
They all have either a call to dia.register_action() passing in a menu path where to register or

dia.register_export() or dia.register_import() to register the for fileio.

I've tried things like
import pydiadoc
inside of a running dia instance's embedded shell, but it doesn't seem to
result in any pretty pictures being drawn.

This is not any longer PyDia specific. Very few Python modules already do much (beside registering/initializing) during import. You usually need to call some function from the module.

Some very minimal examples for "reusing" Dia python plug-ins are the test script in the second bindings
        http://git.gnome.org/cgit/dia/tree/bindings/test.py

-------- 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]