Currently, plot selector is recursively looking for IView objects:
def flatten_traitobject(traitobject, *types, **kwargs):
""" Flatten a trait object, return dictionary. Use ignore keyword
to pass over trait names that might cause recursion errors. For example,
the mview trait has a reference back to model. This will cause recursion
loop between Material and Mview, so ignore it.
"""
node_map = {}
node_path = []
ignore = kwargs.pop('ignore', [])
def nodeRecursiveMap(traitobject, node_path):
for key in traitobject.editable_traits():
val = traitobject.get(key)[key]
for type in types:
if isinstance(val, types[0]):
node_map['.'.join(node_path + [key])] = val
try:
print traitobject, key
if key not in ignore:
nodeRecursiveMap(val, node_path + [key])
except (AttributeError, TypeError):
pass
nodeRecursiveMap(traitobject, node_path)
return node_map
This is slow and also falling into recursion errors. Would be faster, and less error prone for materials themselves to offer an organized layout of their view. For basic materials, something like:
Currently, plot selector is recursively looking for IView objects:
This is slow and also falling into recursion errors. Would be faster, and less error prone for materials themselves to offer an organized layout of their view. For basic materials, something like:
'materail': mview
But for composite mateiral
'material1': Material1.mview 'material2': Material2.mview
Then for nanomaterials, can customize in alphabetical order (SHOULD BE ORDERED DICT)
'corematerial':... 'mie thoery':...
Then if all materials have this, plot selector can easily call something on the
selected_layer.material
. EGselected_layer.material.viewdict()