本文整理汇总了Python中QProgEdit.QTabManager.tab方法的典型用法代码示例。如果您正苦于以下问题:Python QTabManager.tab方法的具体用法?Python QTabManager.tab怎么用?Python QTabManager.tab使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProgEdit.QTabManager
的用法示例。
在下文中一共展示了QTabManager.tab方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: inline_script
# 需要导入模块: from QProgEdit import QTabManager [as 别名]
# 或者: from QProgEdit.QTabManager import tab [as 别名]
class inline_script(inline_script_runtime, qtplugin):
"""The inline_script GUI controls"""
def __init__(self, name, experiment, string=None):
"""See item."""
inline_script_runtime.__init__(self, name, experiment, string)
qtplugin.__init__(self)
def apply_edit_changes(self):
"""See qtitem."""
super(inline_script, self).apply_edit_changes(self)
sp = self.qprogedit.text(index=0)
sr = self.qprogedit.text(index=1)
self.var._prepare = sp
self.var._run = sr
self.update_item_icon()
def set_focus(self):
"""
desc:
Allows the item to focus the most important widget.
"""
self.qprogedit.setFocus()
def item_icon(self):
"""
desc:
Determines the icon, based on whether the scripts are syntactically
correct.
returns:
desc: An icon name.
type: unicode
"""
status = max(
self.experiment.python_workspace.check_syntax(
self.var.get(u'_prepare', _eval=False)),
self.experiment.python_workspace.check_syntax(
self.var.get(u'_run', _eval=False)))
if status == 2:
return u'os-inline_script-syntax-error'
if status == 1:
return u'os-inline_script-syntax-warning'
return u'os-inline_script'
def build_item_tree(self, toplevel=None, items=[], max_depth=-1,
extra_info=None):
"""See qtitem."""
widget = tree_inline_script_item(self, extra_info=extra_info,
symbols=(max_depth < 0 or max_depth > 1))
items.append(self.name)
if toplevel is not None:
toplevel.addChild(widget)
return widget
def init_edit_widget(self):
"""See qtitem."""
from QProgEdit import QTabManager
super(inline_script, self).init_edit_widget(stretch=False)
self.qprogedit = QTabManager(cfg=cfg, runButton=True)
self.qprogedit.execute.connect(self.main_window.console.execute)
self.qprogedit.handlerButtonClicked.connect(self.apply_edit_changes)
self.qprogedit.focusLost.connect(self.apply_edit_changes)
self.qprogedit.cursorRowChanged.connect(self.apply_edit_changes)
self.qprogedit.addTab(u'Prepare').setLang(u'Python')
self.qprogedit.addTab(u'Run').setLang(u'Python')
# Switch to the run phase, unless there is only content for the prepare
# phase.
if self.var._run == u'' and self.var._prepare != u'':
self.qprogedit.setCurrentIndex(0)
else:
self.qprogedit.setCurrentIndex(1)
self.edit_vbox.addWidget(self.qprogedit)
def edit_widget(self):
"""See qtitem."""
super(inline_script, self).edit_widget()
self.qprogedit.tab(0).setText(safe_decode(self.var._prepare))
self.qprogedit.tab(1).setText(safe_decode(self.var._run))
def get_ready(self):
"""See qtitem."""
if self.qprogedit.isAnyModified():
#.........这里部分代码省略.........