Re: Creating new shapes with "extra"properties



At 02.12.2009 21:45, Sarah Mount wrote:
Is it possible when creating a new shape to create new properties that
go with that shape?
Yes, documented in http://git.gnome.org/cgit/dia/tree/doc/custom-shapes

For example, would it have been possible to
implement the UML - Class shape in XML?

No, there are many shapes implemented in XML - where the above mentioned documentation does apply. Some other "shapes" are called objects, because they are implmented in C. UML - Class is one of them. (Actually the bare metal below the shape facility also is implemented in C. See objects/custom)

If not, is it possible to "give" a new shape extra properties by
defining a Python plugin which would pop up a dialog box asking the
user to enter values for each custom property?

It depends. If for your use case an extra menu entry and an extra dialog is acceptable, you could use the currently hidden facility to store arbitrary string dictionaries (key,value pairs) with the every Dia object.
See e.g.: http://mail.gnome.org/archives/dia-list/2009-March/msg00099.html

My dot2dia.py script makes some use of it, see: http://git.gnome.org/cgit/dia/tree/plug-ins/python/dot2dia.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]