After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 300572 - set UMLClass operations/attributes from Python
set UMLClass operations/attributes from Python
Status: RESOLVED FIXED
Product: dia
Classification: Other
Component: python
unspecified
Other Linux
: Normal normal
: 0.95
Assigned To: Hans Breuer
Hans Breuer
Depends on:
Blocks:
 
 
Reported: 2005-04-14 03:53 UTC by Paolo Bernardi
Modified: 2005-06-01 20:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
set operations/attributes of UMLClass from Python (and other minor changes) (24.32 KB, patch)
2005-04-14 03:55 UTC, Paolo Bernardi
reviewed Details | Review

Description Paolo Bernardi 2005-04-14 03:53:21 UTC
- changes to set attributes/operations 
  (not formal-params) from python
- method update_connections for refresh UML objects after a move
- a "uid" property of UMLClass
Comment 1 Paolo Bernardi 2005-04-14 03:55:50 UTC
Created attachment 45236 [details] [review]
set operations/attributes of UMLClass from Python (and other minor changes)

...not sure the format of the patch can be easly applied
Please tell me.
Hi
Comment 2 Hans Breuer 2005-05-15 16:51:00 UTC
Although (or maybe because;) I originally added the hack your 
patch builds on, I'd rather like to *not* to extend it. 
But you have successfully pushed me to look deeper into this 
and start to resolve. The first step just landed in cvs:

2005-05-15  Hans Breuer  <hans@breuer.org>

	[
	 In preparation to make UML operations/attributes/parameters setable by Python
	 UML class became more StdProp conformant. A nice experience to be the first 
	 to use the PROP_TYPE_DARRAY stuff about four years after it was written ;-)  
	]
	* objects/UML/umlattribute.c objects/UML/umloperation.c 
	  objects/UML/umlparameter.c objects/UML/umlformalparameter.c : (new files) 
	split from objects/UML/uml.c and made StdProp aware
	* objects/UML/class.c : finally make "attributes", "operations", "templates"
	<template parameters> first class StdProps citizens.
	(umlclass_load) : removed hand-written parsing for the above, it is all done
	by object_load_props() now. The old write code is still in place, so be very
	careful when changing something - at the moment load/save it is 100% compatible 
	as it needs to be.
	* objects/UML/uml.c : now just type registration here, as it is supposed to be
	* objects/UML/Makefile.am objects/makefile.msc : build the new files

	* lib/properties.h(PropDescCommonAreaExtra) : need a place to store the 
	in-record offsets
	* lib/prop_sdarray.c : made the DARRAY case work, SARRAY still untested
	(darray_prop_adjust_object_records) : don't loop forever
	(whole file) : use the new (working) way to get on the second level offsets.
	Also resolved some abbreviations, it is complicated enough without them ;)
	* lib/proplist.c : even complete list contents may be optional

I'll start to work on the Python part right away.

Some gnereal remarks on your patch:
* C++ (C99) comments will not be commited, although I see the use of //XXX
* The 'uid' stuff seems to be your private addition to UML, IMO it
  should not go into the dia source
* Coding style in Dia already is a mess. Introducing one more indent 
  style should be avoided like plaque :

+    //XXX without this crashes when python sets oper/attribs
+    if( attr->left_connection )
+            {
+                    attr->left_connection->pos.x = x;
+                    attr->left_connection->pos.y = y;
+                    attr->left_connection->directions = DIR_WEST;
+            }

* "// hack diagonal" : hopefully my following pydia change will
  work without a hack. IMO an open source project can be killed
  by too much hacks - i.e. noone wants look into unmaintable 
  mess when not payed for it (and maybe not even there ;-)

* python stuff : I should comment on this later ...

Thanks anyway,
    Hans
Comment 3 Hans Breuer 2005-06-01 20:39:50 UTC
Hi Paolo,
the following should mostly resolve the issues raised in your patch.
If you think there is still something missing feel free to open
another bug report.

2005-06-01  Hans Breuer  <hans@breuer.org>

	* app/dia.def : export diagram_update_connections_object
	* plug-ins/python/pydia-diagram.c : wrap diagram_update_connections_object
	Patch from Paolo Bernardi, together with the property setting closes bug #300572

2005-06-01  Hans Breuer  <hans@breuer.org>

	* plug-ins/python/pydia-property.c : complete refactoring of property 
	setting, now also supports setting of property arrays
	* plug-ins/python/pydia-*.c plug-ins/python/diamodule.c : adapt to 
	Python namespacing conventions
	* plug-ins/python/pydiadoc.py : use the stuff above to produce more 
	complete UML Classes with attributes and operations
	* plug-ins/python/otypes.py : now also show the properties of the objects

	* objects/UML/class.c(umlclass_set_props) : need to update object::connections
	(pointers), they might be changed with attributes and opertions changing