本文整理汇总了Python中MainWindow.MainWindow.set_focus方法的典型用法代码示例。如果您正苦于以下问题:Python MainWindow.set_focus方法的具体用法?Python MainWindow.set_focus怎么用?Python MainWindow.set_focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWindow.MainWindow
的用法示例。
在下文中一共展示了MainWindow.set_focus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from MainWindow import MainWindow [as 别名]
# 或者: from MainWindow.MainWindow import set_focus [as 别名]
#.........这里部分代码省略.........
# Gen/Exec/Stop
##################################################
elif action == Actions.FLOW_GRAPH_GEN:
if not self.get_page().get_proc():
if not self.get_page().get_saved() or not self.get_page().get_file_path():
Actions.FLOW_GRAPH_SAVE() #only save if file path missing or not saved
if self.get_page().get_saved() and self.get_page().get_file_path():
generator = self.get_page().get_generator()
try:
Messages.send_start_gen(generator.get_file_path())
generator.write()
except Exception,e: Messages.send_fail_gen(e)
else: self.generator = None
elif action == Actions.FLOW_GRAPH_EXEC:
if not self.get_page().get_proc():
Actions.FLOW_GRAPH_GEN()
if self.get_page().get_saved() and self.get_page().get_file_path():
ExecFlowGraphThread(self)
elif action == Actions.FLOW_GRAPH_KILL:
if self.get_page().get_proc():
try: self.get_page().get_proc().kill()
except: print "could not kill process: %d"%self.get_page().get_proc().pid
elif action == Actions.PAGE_CHANGE: #pass and run the global actions
pass
elif action == Actions.RELOAD_BLOCKS:
self.platform.load_blocks()
self.main_window.btwin.clear()
self.platform.load_block_tree(self.main_window.btwin)
Actions.XML_PARSER_ERRORS_DISPLAY.set_sensitive(bool(ParseXML.xml_failures))
Messages.send_xml_errors_if_any(ParseXML.xml_failures)
elif action == Actions.FIND_BLOCKS:
self.main_window.btwin.show()
self.main_window.btwin.search_entry.show()
self.main_window.set_focus(self.main_window.btwin.search_entry)
elif action == Actions.OPEN_HIER:
bn = [];
for b in self.get_flow_graph().get_selected_blocks():
if b._grc_source:
self.main_window.new_page(b._grc_source, show=True);
elif action == Actions.BUSSIFY_SOURCES:
n = {'name':'bus', 'type':'bus'}
for b in self.get_flow_graph().get_selected_blocks():
b.bussify(n, 'source');
self.get_flow_graph()._old_selected_port = None;
self.get_flow_graph()._new_selected_port = None;
Actions.ELEMENT_CREATE();
elif action == Actions.BUSSIFY_SINKS:
n = {'name':'bus', 'type':'bus'}
for b in self.get_flow_graph().get_selected_blocks():
b.bussify(n, 'sink')
self.get_flow_graph()._old_selected_port = None;
self.get_flow_graph()._new_selected_port = None;
Actions.ELEMENT_CREATE();
else: print '!!! Action "%s" not handled !!!'%action
##################################################
# Global Actions for all States
##################################################
#update general buttons
Actions.ERRORS_WINDOW_DISPLAY.set_sensitive(not self.get_flow_graph().is_valid())
Actions.ELEMENT_DELETE.set_sensitive(bool(self.get_flow_graph().get_selected_elements()))
Actions.BLOCK_PARAM_MODIFY.set_sensitive(bool(self.get_flow_graph().get_selected_block()))
Actions.BLOCK_ROTATE_CCW.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
Actions.BLOCK_ROTATE_CW.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
#update cut/copy/paste
Actions.BLOCK_CUT.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))