def select_selected(self, initialized): """ Force the tree editor to select the current engine selection, and eventually collapse other scenes. """ # We need to explore the editors to find the one we are # interested in, and to switch its selection to None, and then # back to what we are interested in. editors = self.info.ui._editors if editors is not None: for editor in editors: if editor.factory is self.info.object.tree_editor: tree_editor = editor break else: return else: return # We switch the selection to None, but we avoid # trait callback, to avoid changing the engine's # current_selection. tree_editor.set(selected=None, trait_change_notify=False) current_selection = self.info.object.engine.current_selection GUI.set_trait_later(tree_editor, 'selected', current_selection) # If we are selecting a scene, collapse the others if isinstance(current_selection, Scene) and \ hasattr(tree_editor._tree, 'Collapse'): # The wx editor can collapse, dunno for the Qt for scene in self.info.object.engine.scenes: if scene is not current_selection: tree_editor._tree.Collapse( tree_editor._get_object_nid(scene))
def _make_active(self, obj): """Make the object given, `obj`, the current selection of the engine.""" engine = get_engine(obj) if engine is not None: # This is required when running mayavi in envisage. GUI.set_trait_later(engine, 'current_selection', obj) else: print "No engine"
def update_table_editor(self, object, name, old, new): if isinstance(object, ListItem): self.tabular_editor.adapter.columns[object.column_number] = \ (new, object.column_number) GUI.set_trait_later(self.info.ui, 'updated', True)
def update_table_editor(self, object, name, old, new): if isinstance(object, ListItem): self.tabular_editor.adapter.columns[object.column_number] = \ (new, object.column_number) GUI.set_trait_later(self.info.ui, 'updated', True)