本文整理汇总了Python中pyface.api.GUI.set_trait_later方法的典型用法代码示例。如果您正苦于以下问题:Python GUI.set_trait_later方法的具体用法?Python GUI.set_trait_later怎么用?Python GUI.set_trait_later使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyface.api.GUI
的用法示例。
在下文中一共展示了GUI.set_trait_later方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: select_selected
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import set_trait_later [as 别名]
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.trait_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))
示例2: SimpleApplication
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import set_trait_later [as 别名]
class SimpleApplication(HasStrictTraits):
"""
Simple application that attempts to set a trait at start time,
and immediately exits in response to that trait.
"""
# The GUI instance underlying this app.
gui = Instance(IGUI)
# Event fired after the event loop starts.
application_running = Event
def __init__(self):
super(HasStrictTraits, self).__init__()
self.gui = GUI()
def start(self):
"""
Start the application.
"""
# This shouldn't be executed until after the event loop is running.
self.gui.set_trait_later(self, 'application_running', True)
self.gui.start_event_loop()
def stop(self):
self.gui.stop_event_loop()
示例3: _make_active
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import set_trait_later [as 别名]
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"
示例4: run
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import set_trait_later [as 别名]
def run(self):
while True:
frame = self.queue.get() # blocks until a frame is available
if self.abort_flag:
break
if self.queue.qsize() > 2:
continue # drop frame if there is a backlog
# Do any transformations on the frame
for plugin in self.controller.transform_plugins:
frame = plugin.process_frame(frame)
# Display the frame on screen
GUI.set_trait_later(self.controller.screen, 'data', frame)
# Send the frame to the analysis components
for plugin in self.controller.display_plugins:
plugin.process_frame(frame)
time.sleep(1.0 / self.update_frequency)
示例5: update_table_editor
# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import set_trait_later [as 别名]
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)