本文整理汇总了Python中spyderlib.qt.QtGui.QLabel.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QLabel.setEnabled方法的具体用法?Python QLabel.setEnabled怎么用?Python QLabel.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.qt.QtGui.QLabel
的用法示例。
在下文中一共展示了QLabel.setEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setEnabled [as 别名]
def setup_page(self):
if ERR_MSG:
label = QLabel(_("Could not load plugin:\n{0}".format(ERR_MSG)))
layout = QVBoxLayout()
layout.addWidget(label)
self.setLayout(layout)
return
# Layout parameter
indent = QCheckBox().sizeHint().width()
# General options
options_group = QGroupBox(_("Options"))
# Hack : the spinbox widget will be added to self.spinboxes
spinboxes_before = set(self.spinboxes)
passes_spin = self.create_spinbox(
_("Number of pep8 passes: "), "", 'passes',
default=0, min_=0, max_=1000000, step=1)
spinbox = set(self.spinboxes) - spinboxes_before
spinbox = spinbox.pop()
spinbox.setSpecialValueText(_("Infinite"))
aggressive1_checkbox = self.create_checkbox(
"Aggressivity level 1", "aggressive1", default=False)
aggressive1_label = QLabel(_(
"Allow possibly unsafe fixes (E711 and W6), shorten lines"
" and remove trailing whitespace more aggressively (in"
" docstrings and multiline strings)."))
aggressive1_label.setWordWrap(True)
aggressive1_label.setIndent(indent)
font_description = aggressive1_label.font()
font_description.setPointSizeF(font_description.pointSize() * 0.9)
aggressive1_label.setFont(font_description)
aggressive2_checkbox = self.create_checkbox(
"Aggressivity level 2", "aggressive2", default=False)
aggressive2_label = QLabel(_(
"Allow more possibly unsafe fixes (E712) and shorten lines."))
aggressive2_label.setWordWrap(True)
aggressive2_label.setIndent(indent)
aggressive2_label.setFont(font_description)
self.connect(aggressive1_checkbox, SIGNAL("toggled(bool)"),
aggressive2_checkbox.setEnabled)
self.connect(aggressive1_checkbox, SIGNAL("toggled(bool)"),
aggressive2_label.setEnabled)
aggressive2_checkbox.setEnabled(aggressive1_checkbox.isChecked())
aggressive2_label.setEnabled(aggressive1_checkbox.isChecked())
# Enable/disable error codes
fix_layout = QVBoxLayout()
last_group = ""
FIX_LIST.sort(key=lambda item: item[0][1])
for code, description in FIX_LIST:
# Create a new group if necessary
if code[1] != last_group:
last_group = code[1]
group = QGroupBox(_(self.GROUPS.get(code[1], "")))
fix_layout.addWidget(group)
group_layout = QVBoxLayout(group)
# Checkbox for the option
text = code
default = True
if code in DEFAULT_IGNORE:
text += _(" (UNSAFE)")
default = False
option = self.create_checkbox(text, code, default=default)
# Label for description
if code in self.CODES:
label = QLabel("{autopep8} ({pep8}).".format(
autopep8=_(description).rstrip("."),
pep8=self.CODES[code]))
else:
label = QLabel(_(description))
label.setWordWrap(True)
label.setIndent(indent)
label.setFont(font_description)
# Add widgets to layout
option_layout = QVBoxLayout()
option_layout.setSpacing(0)
option_layout.addWidget(option)
option_layout.addWidget(label)
group_layout.addLayout(option_layout)
# Special cases
if code in ("E711", "W6"):
self.connect(aggressive1_checkbox, SIGNAL("toggled(bool)"),
option.setEnabled)
self.connect(aggressive1_checkbox, SIGNAL("toggled(bool)"),
label.setEnabled)
option.setEnabled(aggressive1_checkbox.isChecked())
label.setEnabled(aggressive1_checkbox.isChecked())
if code == "E712":
def e712_enabled():
enabled = (aggressive1_checkbox.isChecked()
and aggressive2_checkbox.isChecked())
option.setEnabled(enabled)
label.setEnabled(enabled)
self.connect(aggressive1_checkbox, SIGNAL("toggled(bool)"),
#.........这里部分代码省略.........