Re: Re: Extensions with python
- From: Albert <albert zuurbier gmail com>
- To: dia-list gnome org
- Subject: Re: Re: Extensions with python
- Date: Mon, 19 Sep 2011 13:56:29 -0500
Pierre-Louis,
Pitty.
So, my options are: work in C?
Am I correct in the assumption that there is no event forwarding to the
Python API? That would explain quite a bit of what is possible and not
possible with the API. I.e. You can retrieve information and set the
data, but there is no live interaction.
Thanks, the examples of use of the Python console are interesting.
Regards,
Albert
Op 1:59 PM, Pierre-Louis Bonicoli schreef:
On 18/09/2011 21:05, Albert Zuurbier wrote:
Hello,
I would like to make an extension to Dia with Python (so I can learn
that language along the way). However, I need a bit more documentation.
Which I am willing to write, if you give me a chance.
I want to make a new diagram type. From the C code I have a rough idea
of what I need to do (shouldn't be too difficult). But there are no
Python examples I can use as a start. Pydiadoc.py gives the classes,
attributes and methods, but not the parameters of the methods. I tried
to follow the logic of pydiadoc, to see if I can continue along that
line to get parameter information, but I don't know how Python can
provide me more information. So, I turn here to the real experts.
This is the deal: if someone gets me started on creating a new diagram
type, then I write a tutorial and/or a contribution to the documentation
of dia.
Regards,
Albert
Hi !
Python documentation is available here:
http://live.gnome.org/Dia/Python
It's not possible to create a new dia object type with python (see the
second link from the page above "how to use Python to create objects in
a diagram").
Maybe the custom shape module will suit your needs, documentation is
available here:
http://dia-installer.de/doc/en/custom-shapes-chapter.html
http://git.gnome.org/browse/dia/tree/doc/custom-shapes
The diasvg_import.py script shows how to "instantiate" known
diagrams/objects, it's an import filter. The export filter codegen.py is
also interesting.
You could use the python console of Dia and the python builtin "dir":
dia.active_display().diagram.data.layers[0].objects[0]
<DiaObject of type "UML - Class" at 2fb8a30>
obj = dia.active_display().diagram.data.layers[0].objects[0]
dir(obj)
['bounding_box', 'connections', 'copy', 'destroy', 'distance_from',
'draw', 'get_object_menu', 'handles', 'move', 'move_handle', 'parent',
'properties']
dir(obj.properties)
['get', 'has_key', 'keys']
obj.properties.keys()
['obj_pos', 'obj_bb', 'meta', 'elem_corner', 'elem_width', ...]
Pierre-Louis
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]