Am 20.01.2009, 17:22 Uhr, schrieb Marcos Duarte <[email protected]>:
> another question:
> is there a method to determine the type of the object?
> e.g., such function should return 'circle' or 'arrow' if i input the
> node object.
You can do something like
def getNodeType(node):
return type(node.model).__name__.replace('Observable','')
node.model returns always the data model associated with the node.
type(node.model) returns the model class, e.g. ObservableCircle. The
replace part just strips 'Observable' from the name, leaving only 'Circle'
as the result.
Note that this is rather hacky. If you need this only for printing, it's
probably ok. But if you want to dispatch on the node type name, it's
probably a bad idea to use it.
-Matthias
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas