Re: Python-Scripting in Dia



At 02.08.2010 23:13, Florian Sittel wrote:
Hi Guys,

I am building an application for storing data as semantic network.
I would like to use Dia as of front-end.
(ie, a gui for a semantic database)

For that purpose, I wanted to write a python script that asks the
backend for data and creates a diagram representing the network.

Unfortunately, after hours of searching,
documentation/faq/mailing-list-archive reading I couldnt find a way, how
to create diagram objects via the python interface.

If it is just creating objects via the python interface you should find something like
  obj, h1, h2 = dia.get_object_type(oname).create (0, 0)
in every other PyDia sample. It is also kind of documnted in http://git.gnome.org/browse/dia/plain/samples/Self/PyDiaObjects.dia

I know, how to get information from the diagram, but not how to add new
objects (like a flowchart-box, etc).

  obj, h1, h2 = dia.get_object_type ("Flowchart - Box").create (0, 0)
  layer.add_object (obj)

perhaps I am blind...

Maybe I'm too ;) At first I thought you wanted to implement Dia object types in Python. That indeed is not possible at the moment. And doing so would probably require to restructure a lot of the object interface and related objects, because an object's implmentation has to maintain a lot of internal state in 'public' variables, e.g. Object::position, Object::bounding_box, etc.

If so, I'd appreciate some help / information on how to do this.

With a Python-enabled Dia you should take a closer look into the help menu. There are some diagrams and html created to help developing with PyDia.

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