本文整理汇总了Python中spyderlib.qt.QtGui.QHBoxLayout.addLayout方法的典型用法代码示例。如果您正苦于以下问题:Python QHBoxLayout.addLayout方法的具体用法?Python QHBoxLayout.addLayout怎么用?Python QHBoxLayout.addLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.qt.QtGui.QHBoxLayout
的用法示例。
在下文中一共展示了QHBoxLayout.addLayout方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_scedit
# 需要导入模块: from spyderlib.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from spyderlib.qt.QtGui.QHBoxLayout import addLayout [as 别名]
def create_scedit(self, text, option, default=NoDefault, tip=None,
without_layout=False):
label = QLabel(text)
clayout = ColorLayout(QColor(Qt.black), self)
clayout.lineedit.setMaximumWidth(80)
if tip is not None:
clayout.setToolTip(tip)
cb_bold = QCheckBox()
cb_bold.setIcon(ima.icon('bold'))
cb_bold.setToolTip(_("Bold"))
cb_italic = QCheckBox()
cb_italic.setIcon(ima.icon('italic'))
cb_italic.setToolTip(_("Italic"))
self.scedits[(clayout, cb_bold, cb_italic)] = (option, default)
if without_layout:
return label, clayout, cb_bold, cb_italic
layout = QHBoxLayout()
layout.addWidget(label)
layout.addLayout(clayout)
layout.addSpacing(10)
layout.addWidget(cb_bold)
layout.addWidget(cb_italic)
layout.addStretch(1)
layout.setContentsMargins(0, 0, 0, 0)
widget = QWidget(self)
widget.setLayout(layout)
return widget
示例2: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from spyderlib.qt.QtGui.QHBoxLayout import addLayout [as 别名]
def __init__(self, parent,
search_text = r"# ?TODO|# ?FIXME|# ?XXX",
search_text_regexp=True, search_path=None,
include=[".", ".py"], include_idx=None, include_regexp=True,
exclude=r"\.pyc$|\.orig$|\.hg|\.svn", exclude_idx=None,
exclude_regexp=True,
supported_encodings=("utf-8", "iso-8859-1", "cp1252"),
in_python_path=False, more_options=False):
QWidget.__init__(self, parent)
self.setWindowTitle(_('Find in files'))
self.search_thread = None
self.get_pythonpath_callback = None
self.find_options = FindOptions(self, search_text, search_text_regexp,
search_path,
include, include_idx, include_regexp,
exclude, exclude_idx, exclude_regexp,
supported_encodings, in_python_path,
more_options)
self.connect(self.find_options, SIGNAL('find()'), self.find)
self.connect(self.find_options, SIGNAL('stop()'),
self.stop_and_reset_thread)
self.result_browser = ResultsBrowser(self)
collapse_btn = create_toolbutton(self)
collapse_btn.setDefaultAction(self.result_browser.collapse_all_action)
expand_btn = create_toolbutton(self)
expand_btn.setDefaultAction(self.result_browser.expand_all_action)
restore_btn = create_toolbutton(self)
restore_btn.setDefaultAction(self.result_browser.restore_action)
# collapse_sel_btn = create_toolbutton(self)
# collapse_sel_btn.setDefaultAction(
# self.result_browser.collapse_selection_action)
# expand_sel_btn = create_toolbutton(self)
# expand_sel_btn.setDefaultAction(
# self.result_browser.expand_selection_action)
btn_layout = QVBoxLayout()
btn_layout.setAlignment(Qt.AlignTop)
for widget in [collapse_btn, expand_btn, restore_btn]:
# collapse_sel_btn, expand_sel_btn]:
btn_layout.addWidget(widget)
hlayout = QHBoxLayout()
hlayout.addWidget(self.result_browser)
hlayout.addLayout(btn_layout)
layout = QVBoxLayout()
left, _x, right, bottom = layout.getContentsMargins()
layout.setContentsMargins(left, 0, right, bottom)
layout.addWidget(self.find_options)
layout.addLayout(hlayout)
self.setLayout(layout)
示例3: create_coloredit
# 需要导入模块: from spyderlib.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from spyderlib.qt.QtGui.QHBoxLayout import addLayout [as 别名]
def create_coloredit(self, text, option, default=NoDefault, tip=None,
without_layout=False):
label = QLabel(text)
clayout = ColorLayout(QColor(Qt.black), self)
clayout.lineedit.setMaximumWidth(80)
if tip is not None:
clayout.setToolTip(tip)
self.coloredits[clayout] = (option, default)
if without_layout:
return label, clayout
layout = QHBoxLayout()
layout.addWidget(label)
layout.addLayout(clayout)
layout.addStretch(1)
layout.setContentsMargins(0, 0, 0, 0)
widget = QWidget(self)
widget.setLayout(layout)
return widget
示例4: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from spyderlib.qt.QtGui.QHBoxLayout import addLayout [as 别名]
def __init__(self, parent):
QWidget.__init__(self, parent)
layout = QHBoxLayout()
row_nb = 14
cindex = 0
for child in dir(QStyle):
if child.startswith('SP_'):
if cindex == 0:
col_layout = QVBoxLayout()
icon_layout = QHBoxLayout()
icon = get_std_icon(child)
label = QLabel()
label.setPixmap(icon.pixmap(32, 32))
icon_layout.addWidget( label )
icon_layout.addWidget( QLineEdit(child.replace('SP_', '')) )
col_layout.addLayout(icon_layout)
cindex = (cindex+1) % row_nb
if cindex == 0:
layout.addLayout(col_layout)
self.setLayout(layout)
self.setWindowTitle('Standard Platform Icons')
self.setWindowIcon(get_std_icon('TitleBarMenuButton'))
示例5: setup
# 需要导入模块: from spyderlib.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from spyderlib.qt.QtGui.QHBoxLayout import addLayout [as 别名]
def setup(self, check_all=None, exclude_private=None,
exclude_uppercase=None, exclude_capitalized=None,
exclude_unsupported=None, excluded_names=None,
truncate=None, minmax=None, remote_editing=None,
autorefresh=None):
"""Setup the namespace browser"""
assert self.shellwidget is not None
self.check_all = check_all
self.exclude_private = exclude_private
self.exclude_uppercase = exclude_uppercase
self.exclude_capitalized = exclude_capitalized
self.exclude_unsupported = exclude_unsupported
self.excluded_names = excluded_names
self.truncate = truncate
self.minmax = minmax
self.remote_editing = remote_editing
self.autorefresh = autorefresh
if self.editor is not None:
self.editor.setup_menu(truncate, minmax)
self.exclude_private_action.setChecked(exclude_private)
self.exclude_uppercase_action.setChecked(exclude_uppercase)
self.exclude_capitalized_action.setChecked(exclude_capitalized)
self.exclude_unsupported_action.setChecked(exclude_unsupported)
# Don't turn autorefresh on for IPython kernels
# See Issue 1450
if not self.is_ipykernel:
self.auto_refresh_button.setChecked(autorefresh)
self.refresh_table()
return
# Dict editor:
if self.is_internal_shell:
self.editor = DictEditorTableView(self, None, truncate=truncate,
minmax=minmax)
else:
self.editor = RemoteDictEditorTableView(self, None,
truncate=truncate, minmax=minmax,
remote_editing=remote_editing,
get_value_func=self.get_value,
set_value_func=self.set_value,
new_value_func=self.set_value,
remove_values_func=self.remove_values,
copy_value_func=self.copy_value,
is_list_func=self.is_list,
get_len_func=self.get_len,
is_array_func=self.is_array,
is_image_func=self.is_image,
is_dict_func=self.is_dict,
is_data_frame_func=self.is_data_frame,
is_time_series_func=self.is_time_series,
get_array_shape_func=self.get_array_shape,
get_array_ndim_func=self.get_array_ndim,
oedit_func=self.oedit,
plot_func=self.plot, imshow_func=self.imshow,
show_image_func=self.show_image)
self.editor.sig_option_changed.connect(self.sig_option_changed.emit)
self.editor.sig_files_dropped.connect(self.import_data)
# Setup layout
hlayout = QHBoxLayout()
vlayout = QVBoxLayout()
toolbar = self.setup_toolbar(exclude_private, exclude_uppercase,
exclude_capitalized, exclude_unsupported,
autorefresh)
vlayout.setAlignment(Qt.AlignTop)
for widget in toolbar:
vlayout.addWidget(widget)
hlayout.addWidget(self.editor)
hlayout.addLayout(vlayout)
self.setLayout(hlayout)
hlayout.setContentsMargins(0, 0, 0, 0)
self.sig_option_changed.connect(self.option_changed)
示例6: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from spyderlib.qt.QtGui.QHBoxLayout import addLayout [as 别名]
def setup_page(self):
newcb = self.create_checkbox
# --- Interface
interface_group = QGroupBox(_("Interface"))
styles = [str(txt) for txt in list(QStyleFactory.keys())]
# Don't offer users the possibility to change to a different
# style in Gtk-based desktops
# Fixes Issue 2036
if is_gtk_desktop() and ('GTK+' in styles):
styles = ['GTK+']
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)
languages = LANGUAGE_CODES.items()
language_choices = sorted([(val, key) for key, val in languages])
language_combo = self.create_combobox(_('Language'), language_choices,
'interface_language',
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')
# Decide if it's possible to activate or not single instance mode
if running_in_mac_app():
self.set_option("single_instance", True)
single_instance_box.setEnabled(False)
# Layout interface
comboboxes_layout = QHBoxLayout()
cbs_layout = QGridLayout()
cbs_layout.addWidget(style_combo.label, 0, 0)
cbs_layout.addWidget(style_combo.combobox, 0, 1)
cbs_layout.addWidget(icons_combo.label, 1, 0)
cbs_layout.addWidget(icons_combo.combobox, 1, 1)
cbs_layout.addWidget(language_combo.label, 2, 0)
cbs_layout.addWidget(language_combo.combobox, 2, 1)
comboboxes_layout.addLayout(cbs_layout)
comboboxes_layout.addStretch(1)
interface_layout = QVBoxLayout()
interface_layout.addLayout(comboboxes_layout)
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_box.setEnabled(self.main.mem_status.is_supported())
memory_spin.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'))
#.........这里部分代码省略.........
示例7: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from spyderlib.qt.QtGui.QHBoxLayout import addLayout [as 别名]
def __init__(self, parent, names, order, active):
super(LayoutSettingsDialog, self).__init__(parent)
# variables
self._parent = parent
self._selection_model = None
self.names = names
self.order = order
self.active = active
# widgets
self.button_move_up = QPushButton(_('Move Up'))
self.button_move_down = QPushButton(_('Move Down'))
self.button_delete = QPushButton(_('Delete Layout'))
self.button_box = QDialogButtonBox(QDialogButtonBox.Ok |
QDialogButtonBox.Cancel,
Qt.Horizontal, self)
self.group_box = QGroupBox(_("Layout Dispay and Order"))
self.table = QTableView(self)
self.ok_button = self.button_box.button(QDialogButtonBox.Ok)
self.cancel_button = self.button_box.button(QDialogButtonBox.Cancel)
self.cancel_button.setDefault(True)
self.cancel_button.setAutoDefault(True)
# widget setup
self.dialog_size = QSize(300, 200)
self.setMinimumSize(self.dialog_size)
self.setFixedSize(self.dialog_size)
self.setWindowTitle('Layout Settings')
self.table.setModel(LayoutModel(self.table, order, active))
self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
self.table.setSelectionMode(QAbstractItemView.SingleSelection)
self.table.verticalHeader().hide()
self.table.horizontalHeader().hide()
self.table.setAlternatingRowColors(True)
self.table.setShowGrid(False)
self.table.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.table.horizontalHeader().setStretchLastSection(True)
self.table.setColumnHidden(1, True)
# need to keep a reference for pyside not to segfault!
self._selection_model = self.table.selectionModel()
# layout
buttons_layout = QVBoxLayout()
buttons_layout.addWidget(self.button_move_up)
buttons_layout.addWidget(self.button_move_down)
buttons_layout.addStretch()
buttons_layout.addWidget(self.button_delete)
group_layout = QHBoxLayout()
group_layout.addWidget(self.table)
group_layout.addLayout(buttons_layout)
self.group_box.setLayout(group_layout)
layout = QVBoxLayout()
layout.addWidget(self.group_box)
layout.addWidget(self.button_box)
self.setLayout(layout)
# signals and slots
self.button_box.accepted.connect(self.accept)
self.button_box.rejected.connect(self.close)
self.button_delete.clicked.connect(self.delete_layout)
self.button_move_up.clicked.connect(lambda: self.move_layout(True))
self.button_move_down.clicked.connect(lambda: self.move_layout(False))
self.table.model().dataChanged.connect(
lambda: self.selection_changed(None, None))
self._selection_model.selectionChanged.connect(
lambda: self.selection_changed(None, None))
# focus table
index = self.table.model().index(0, 0)
self.table.setCurrentIndex(index)
self.table.setFocus()