On Tue, Jan 20, 2009 at 3:11 PM, Nitro <[email protected]> wrote:
> 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

My idea is to provide a popup menu to change the properties of the
selected object and the shown menu items will depend of the type of
object. I think your solution will do fine.

Thanks.

Marcos
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to