本文整理汇总了Python中Output.Output.execute方法的典型用法代码示例。如果您正苦于以下问题:Python Output.execute方法的具体用法?Python Output.execute怎么用?Python Output.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output.Output
的用法示例。
在下文中一共展示了Output.execute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Output import Output [as 别名]
# 或者: from Output.Output import execute [as 别名]
#.........这里部分代码省略.........
def _generate_output(self, get_cmd_func, rootdir):
self._l.debug("Entered")
bp = self._window.get_bottom_panel()
bp.activate_item(self._console.widget())
bp.set_property("visible", True)
doc = self._window.get_active_document()
active_tab = self._window.get_active_tab()
unsaved = self._window.get_unsaved_documents()
self._l.info("There are %d unsaved documents" % len(unsaved))
self._doc_handler_ids = {}
self._state = self._EXECUTE
if unsaved:
self._state = self._SAVING
md = self._ui('dlg_unsaved_file')
resp = 0
for us_doc in unsaved:
self._l.info('Makeing %s active' % us_doc.get_uri_for_display())
tab = self._window.get_tab_from_uri(us_doc.get_uri())
# Make doc the active doc because the only reliable way to save
# a document is to activate the save action attached to the File
# menu which, of course, works on the active document. Plus it
# is always good to show the doc you are asking if they want to
# save.
self._window.set_active_tab(tab)
if resp != 3: # yes_to_all
md.format_secondary_text(us_doc.get_uri_for_display())
resp = md.run()
self._l.debug("User responded with %d" % resp)
if resp == 1 or resp == 3: # yes OR yes_to_all
self._doc_handler_ids[us_doc] = us_doc.connect(
'saved', self._execute_command, get_cmd_func, rootdir, doc)
#us_doc.save(0) generates critical errors
self._l.info('Saving active doc')
self._save_action.activate()
elif resp == 2: # no
self._l.info('Not saving %s' % us_doc.get_uri_for_display())
pass
elif resp == 4: # no_to_all
self._l.info('No more docs to save before compile/build')
break
else: # cancel (or closed)
self._l.info('User canceled compile/build')
self._state = self._READY
break
self._window.set_active_tab(active_tab)
md.hide()
if self._state == self._SAVING:
self._state = self._EXECUTE
if len(self._doc_handler_ids) == 0:
self._execute_command(doc, None, get_cmd_func, rootdir, doc)
else:
self._execute_command(doc, None, get_cmd_func, rootdir, doc)
def _execute_command(self, us_doc, arg1, get_cmd_func, rootdir, doc):
""" Executes the compile or build command once all documents have been saved.
doc - the active documents when the build/compile was initiated
get_cmd_func - returns the build or compile command
rootdir - for compile this is the doc dir, for build it comes from config
"""
self._l.debug('Entered')