Please note: this project is inactive since early 2006

 
5.3 Miscellaneous developer's hints

How to dynamically identify a nested EditingContext?
Simply invoke parentObjectStore() on it ; if the result is another EditingContext, it is nested. Otherwise it is a regular EditingContext.
>>> from Modeling.EditingContext import EditingContext
>>> parent_ec=EditingContext()
>>> ec=EditingContext(parent_ec)
>>> ec.parentObjectStore().__class__==EditingContext
1
>>> parent_ec.parentObjectStore().__class__==EditingContext
0

How to determine whether a given EditingContext is a (grand-)child of an other one?

Use the method isaChildOf, which examines the parent/children hierarchy and answers appropriately:

>>> from Modeling.EditingContext import EditingContext
>>> grand_parent_ec=EditingContext()
>>> parent_ec=EditingContext(grand_parent_ec)
>>> ec=EditingContext(parent_ec)
>>> ec.isaChildOf(parent_ec)
1
>>> ec.isaChildOf(grand_parent_ec)
1

Is it possible to get the children of a given EditingContext?

No.

Comments are welcome: Sebastien Bigaret / Modeling Home Page
Hosted by:SourceForge.net Logo