本文整理汇总了Python中spyderlib.qt.QtGui.QHBoxLayout.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QHBoxLayout.setEnabled方法的具体用法?Python QHBoxLayout.setEnabled怎么用?Python QHBoxLayout.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.qt.QtGui.QHBoxLayout
的用法示例。
在下文中一共展示了QHBoxLayout.setEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from spyderlib.qt.QtGui.QHBoxLayout import setEnabled [as 别名]
def setup_page(self):
newcb = self.create_checkbox
# --- Interface
interface_group = QGroupBox(_("Interface"))
styles = [str(txt) for txt in list(QStyleFactory.keys())]
choices = list(zip(styles, [style.lower() for style in styles]))
style_combo = self.create_combobox(_('Qt windows style'), choices,
'windows_style',
default=self.main.default_style)
single_instance_box = newcb(_("Use a single instance"),
'single_instance',
tip=_("Set this to open external<br> "
"Python files in an already running "
"instance (Requires a restart)"))
vertdock_box = newcb(_("Vertical dockwidget title bars"),
'vertical_dockwidget_titlebars')
verttabs_box = newcb(_("Vertical dockwidget tabs"),
'vertical_tabs')
animated_box = newcb(_("Animated toolbars and dockwidgets"),
'animated_docks')
tear_off_box = newcb(_("Tear off menus"), 'tear_off_menus',
tip=_("Set this to detach any<br> "
"menu from the main window"))
margin_box = newcb(_("Custom dockwidget margin:"),
'use_custom_margin')
margin_spin = self.create_spinbox("", "pixels", 'custom_margin',
0, 0, 30)
self.connect(margin_box, SIGNAL("toggled(bool)"),
margin_spin.setEnabled)
margin_spin.setEnabled(self.get_option('use_custom_margin'))
margins_layout = QHBoxLayout()
margins_layout.addWidget(margin_box)
margins_layout.addWidget(margin_spin)
# Decide if it's possible to activate or not singie instance mode
if sys.platform == "darwin" and 'Spyder.app' in __file__:
self.set_option("single_instance", True)
single_instance_box.setEnabled(False)
interface_layout = QVBoxLayout()
interface_layout.addWidget(style_combo)
interface_layout.addWidget(single_instance_box)
interface_layout.addWidget(vertdock_box)
interface_layout.addWidget(verttabs_box)
interface_layout.addWidget(animated_box)
interface_layout.addWidget(tear_off_box)
interface_layout.addLayout(margins_layout)
interface_group.setLayout(interface_layout)
# --- Status bar
sbar_group = QGroupBox(_("Status bar"))
memory_box = newcb(_("Show memory usage every"), 'memory_usage/enable',
tip=self.main.mem_status.toolTip())
memory_spin = self.create_spinbox("", " ms", 'memory_usage/timeout',
min_=100, max_=1000000, step=100)
self.connect(memory_box, SIGNAL("toggled(bool)"),
memory_spin.setEnabled)
memory_spin.setEnabled(self.get_option('memory_usage/enable'))
memory_layout = QHBoxLayout()
memory_layout.addWidget(memory_box)
memory_layout.addWidget(memory_spin)
memory_layout.setEnabled(self.main.mem_status.is_supported())
cpu_box = newcb(_("Show CPU usage every"), 'cpu_usage/enable',
tip=self.main.cpu_status.toolTip())
cpu_spin = self.create_spinbox("", " ms", 'cpu_usage/timeout',
min_=100, max_=1000000, step=100)
self.connect(cpu_box, SIGNAL("toggled(bool)"), cpu_spin.setEnabled)
cpu_spin.setEnabled(self.get_option('cpu_usage/enable'))
cpu_layout = QHBoxLayout()
cpu_layout.addWidget(cpu_box)
cpu_layout.addWidget(cpu_spin)
cpu_layout.setEnabled(self.main.cpu_status.is_supported())
sbar_layout = QVBoxLayout()
sbar_layout.addLayout(memory_layout)
sbar_layout.addLayout(cpu_layout)
sbar_group.setLayout(sbar_layout)
# --- Debugging
debug_group = QGroupBox(_("Debugging"))
popup_console_box = newcb(_("Pop up internal console when internal "
"errors appear"),
'show_internal_console_if_traceback')
debug_layout = QVBoxLayout()
debug_layout.addWidget(popup_console_box)
debug_group.setLayout(debug_layout)
vlayout = QVBoxLayout()
vlayout.addWidget(interface_group)
vlayout.addWidget(sbar_group)
vlayout.addWidget(debug_group)
vlayout.addStretch(1)
self.setLayout(vlayout)
示例2: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from spyderlib.qt.QtGui.QHBoxLayout import setEnabled [as 别名]
def setup_page(self):
newcb = self.create_checkbox
# --- Interface
interface_group = QGroupBox(_("Interface"))
styles = [str(txt) for txt in list(QStyleFactory.keys())]
choices = list(zip(styles, [style.lower() for style in styles]))
style_combo = self.create_combobox(_('Qt windows style'), choices,
'windows_style',
default=self.main.default_style)
themes = ['Spyder 2', 'Spyder 3']
icon_choices = list(zip(themes, [theme.lower() for theme in themes]))
icons_combo = self.create_combobox(_('Icon theme'), icon_choices,
'icon_theme', restart=True)
single_instance_box = newcb(_("Use a single instance"),
'single_instance',
tip=_("Set this to open external<br> "
"Python files in an already running "
"instance (Requires a restart)"))
vertdock_box = newcb(_("Vertical title bars in panes"),
'vertical_dockwidget_titlebars')
verttabs_box = newcb(_("Vertical tabs in panes"),
'vertical_tabs')
animated_box = newcb(_("Animated toolbars and panes"),
'animated_docks')
tear_off_box = newcb(_("Tear off menus"), 'tear_off_menus',
tip=_("Set this to detach any<br> "
"menu from the main window"))
margin_box = newcb(_("Custom margin for panes:"),
'use_custom_margin')
margin_spin = self.create_spinbox("", "pixels", 'custom_margin',
0, 0, 30)
margin_box.toggled.connect(margin_spin.setEnabled)
margin_spin.setEnabled(self.get_option('use_custom_margin'))
margins_layout = QHBoxLayout()
margins_layout.addWidget(margin_box)
margins_layout.addWidget(margin_spin)
prompt_box = newcb(_("Prompt when exiting"), 'prompt_on_exit')
# Language chooser
choices = sorted([(val, key) for key, val in LANGUAGE_CODES.items()])
language_combo = self.create_combobox(_('Language'), choices,
'interface_language',
restart=True)
# Decide if it's possible to activate or not singie instance mode
if running_in_mac_app():
self.set_option("single_instance", True)
single_instance_box.setEnabled(False)
interface_layout = QVBoxLayout()
interface_layout.addWidget(style_combo)
interface_layout.addWidget(icons_combo)
interface_layout.addWidget(language_combo)
interface_layout.addWidget(single_instance_box)
interface_layout.addWidget(vertdock_box)
interface_layout.addWidget(verttabs_box)
interface_layout.addWidget(animated_box)
interface_layout.addWidget(tear_off_box)
interface_layout.addLayout(margins_layout)
interface_layout.addWidget(prompt_box)
interface_group.setLayout(interface_layout)
# --- Status bar
sbar_group = QGroupBox(_("Status bar"))
show_status_bar = newcb(_("Show status bar"), 'show_status_bar')
memory_box = newcb(_("Show memory usage every"), 'memory_usage/enable',
tip=self.main.mem_status.toolTip())
memory_spin = self.create_spinbox("", " ms", 'memory_usage/timeout',
min_=100, max_=1000000, step=100)
memory_box.toggled.connect(memory_spin.setEnabled)
memory_spin.setEnabled(self.get_option('memory_usage/enable'))
memory_layout = QHBoxLayout()
memory_layout.addWidget(memory_box)
memory_layout.addWidget(memory_spin)
memory_layout.setEnabled(self.main.mem_status.is_supported())
cpu_box = newcb(_("Show CPU usage every"), 'cpu_usage/enable',
tip=self.main.cpu_status.toolTip())
cpu_spin = self.create_spinbox("", " ms", 'cpu_usage/timeout',
min_=100, max_=1000000, step=100)
cpu_box.toggled.connect(cpu_spin.setEnabled)
cpu_spin.setEnabled(self.get_option('cpu_usage/enable'))
cpu_layout = QHBoxLayout()
cpu_layout.addWidget(cpu_box)
cpu_layout.addWidget(cpu_spin)
cpu_layout.setEnabled(self.main.cpu_status.is_supported())
status_bar_o = self.get_option('show_status_bar')
show_status_bar.toggled.connect(memory_box.setEnabled)
show_status_bar.toggled.connect(memory_spin.setEnabled)
show_status_bar.toggled.connect(cpu_box.setEnabled)
show_status_bar.toggled.connect(cpu_spin.setEnabled)
memory_box.setEnabled(status_bar_o)
memory_spin.setEnabled(status_bar_o)
cpu_box.setEnabled(status_bar_o)
cpu_spin.setEnabled(status_bar_o)
#.........这里部分代码省略.........