Re: manipulating properties




From: "Bernd Rößl" <bernd roessl telesis at>
Date: Tue, 26 Apr 2005 00:02:59 +0200


hello list,

i tryed to create DiaObjects by python which works fine. but when i try to set
some properties like 'name' it seams all properties are readonly.

o = dia.get_object_type("UML - Class").create(10,10)
dia.active_display().diagram.active_layer.add_object(o[0])
o[0].properties.get('name').value = "MyClass"
[...]
TypeError: 'DiaProperty' object has only read-only attributes (assign
to .value)

is there a special methode to set properties or another way to build models by
python?

Yes. o[0].properties['name'] = "MyClass"

See: http://cvs.gnome.org/viewcvs/dia/plug-ins/python/otypes.py?rev=1.2&view=markup

But only simple properties can be set, i.e. no lists like the "operations" yet.

    Hans




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