Re: does Dia have a Python script interface?



Hi,
if you just need to export a diagram to PNG or JPG file, you can do it from shell (or by system or similar in python) with this command line:

    dia -e my_diagram.jpg -t jpg my_diagram.dia

This doesn't start dia in interactive mode, "-e" option let you set destination file name, "-t" option let you chose the exported file format. With a "-L" option you can chose which layers to show. From command line try a "dia --help" to have a look at more options.

Dia has a python plugin too; launch Dia and in diagram menu "Dialogs" you can find a python console (for sure in dia v 0.97).
You can write python scripts and  put them in "~/.dia/python" directory. You can call them via dia python console or map them in dia menu entries.
Have a look at http://projects.gnome.org/dia/python.html and python scripts that come with dia package for more info and examples.

I can suggest you this script http://code.activestate.com/recipes/137951-dump-all-the-attributes-of-an-object/ that can help you to investigate the dia python class (i'm not much experienced at python but i found it very usefull):
- download and save it in "~/.dia/python/dumpObj.py"
- launch Dia and open python console
- in console import the file with "import dumpObj" 
- in console do "dumpObj.dumpObj(dia)" to examine the main dia class or its methods and subclasses

I hope to be useful

Carlo




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