本文整理汇总了Python中guidata.qt.QtGui.QHBoxLayout.addWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QHBoxLayout.addWidget方法的具体用法?Python QHBoxLayout.addWidget怎么用?Python QHBoxLayout.addWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类guidata.qt.QtGui.QHBoxLayout
的用法示例。
在下文中一共展示了QHBoxLayout.addWidget方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FitDialog
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
class FitDialog(QDialog, FitWidgetMixin):
def __init__(self, wintitle=None, icon="guiqwt.svg", edit=True,
toolbar=False, options=None, parent=None, panels=None,
param_cols=1, legend_anchor='TR', auto_fit=False):
QDialog.__init__(self, parent)
self.edit = edit
self.button_layout = None
FitWidgetMixin.__init__(self, wintitle, icon, toolbar, options, panels,
param_cols, legend_anchor, auto_fit)
self.setWindowFlags(Qt.Window)
def setup_widget_layout(self):
FitWidgetMixin.setup_widget_layout(self)
if self.edit:
self.install_button_layout()
def install_button_layout(self):
bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()"))
self.connect(bbox, SIGNAL("rejected()"), SLOT("reject()"))
self.button_list += [bbox.button(QDialogButtonBox.Ok)]
self.button_layout = QHBoxLayout()
self.button_layout.addStretch()
self.button_layout.addWidget(bbox)
vlayout = self.layout()
vlayout.addSpacing(10)
vlayout.addLayout(self.button_layout)
示例2: __init__
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
def __init__(self):
QWidget.__init__(self)
self.setWindowTitle( 'Biofeedback' )
self.button_start = QPushButton()
self.button_start.setText("START")
self.button_stop = QPushButton()
self.button_stop.setText("STOP")
layout = QHBoxLayout(self)
layout.addWidget(self.button_start)
layout.addWidget(self.button_stop)
self.connect(self.button_start, SIGNAL("clicked(bool)"), self.start_session)
self.connect(self.button_stop, SIGNAL("clicked(bool)"), self.stop_session)
self.setLayout(layout)
self.setGeometry(300,100,250,100)
self.show()
#self.datastorage = DataStorage()
#settings = {'db_host':'amber','db_user':'root','db_pwd':'dbrootpass','db_dbname':'biodb'}
#self.datastorage.enableDbStorage(settings)
self.thread = ConnectionThread()
示例3: CurveDialog
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
class CurveDialog(QDialog, CurveWidgetMixin):
"""
Construct a CurveDialog object: plotting dialog box with integrated
plot manager
* wintitle: window title
* icon: window icon
* edit: editable state
* toolbar: show/hide toolbar
* options: options sent to the :py:class:`guiqwt.curve.CurvePlot` object
(dictionary)
* parent: parent widget
* panels (optional): additionnal panels (list, tuple)
"""
def __init__(self, wintitle="guiqwt plot", icon="guiqwt.svg", edit=False,
toolbar=False, options=None, parent=None, panels=None):
if not PYQT5:
QDialog.__init__(self, parent)
self.edit = edit
self.button_box = None
self.button_layout = None
if PYQT5:
super(CurveDialog, self).__init__(parent, wintitle=wintitle,
icon=icon, toolbar=toolbar, options=options, panels=panels)
else:
CurveWidgetMixin.__init__(self, wintitle=wintitle, icon=icon,
toolbar=toolbar, options=options,
panels=panels)
self.setWindowFlags(Qt.Window)
def setup_widget_layout(self):
vlayout = QVBoxLayout(self)
vlayout.addWidget(self.toolbar)
vlayout.addLayout(self.plot_layout)
self.setLayout(vlayout)
if self.edit:
self.button_layout = QHBoxLayout()
self.install_button_layout()
vlayout.addLayout(self.button_layout)
def install_button_layout(self):
"""
Install standard buttons (OK, Cancel) in dialog button box layout
(:py:attr:`guiqwt.plot.CurveDialog.button_layout`)
This method may be overriden to customize the button box
"""
bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
bbox.accepted.connect(self.accept)
bbox.rejected.connect(self.reject)
self.button_layout.addWidget(bbox)
self.button_box = bbox
示例4: get_image_layout
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
def get_image_layout(imagename, text="", tooltip="", alignment=Qt.AlignLeft):
"""
Construct a QHBoxLayout including image from the file with specified name,
left-aligned text [with specified tooltip]
Return (layout, label)
"""
layout = QHBoxLayout()
if alignment in (Qt.AlignCenter, Qt.AlignRight):
layout.addStretch()
layout.addWidget(get_image_label(imagename))
label = QLabel(text)
label.setToolTip(tooltip)
layout.addWidget(label)
if alignment in (Qt.AlignCenter, Qt.AlignLeft):
layout.addStretch()
return (layout, label)
示例5: __init__
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
def __init__(self, parent=None):
super(ContrastAdjustment, self).__init__(parent)
self.local_manager = None # local manager for the histogram plot
self.manager = None # manager for the associated image plot
# Storing min/max markers for each active image
self.min_markers = {}
self.max_markers = {}
# Select point tools
self.min_select_tool = None
self.max_select_tool = None
style = "<span style=\'color: #444444\'><b>%s</b></span>"
layout, _label = get_image_layout(self.PANEL_ICON,
style % self.PANEL_TITLE,
alignment=Qt.AlignCenter)
layout.setAlignment(Qt.AlignCenter)
vlayout = QVBoxLayout()
vlayout.addLayout(layout)
self.local_manager = PlotManager(self)
self.histogram = LevelsHistogram(parent)
vlayout.addWidget(self.histogram)
self.local_manager.add_plot(self.histogram)
hlayout = QHBoxLayout()
self.setLayout(hlayout)
hlayout.addLayout(vlayout)
self.toolbar = toolbar = QToolBar(self)
toolbar.setOrientation(Qt.Vertical)
# toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
hlayout.addWidget(toolbar)
# Add standard plot-related tools to the local manager
lman = self.local_manager
lman.add_tool(SelectTool)
lman.add_tool(BasePlotMenuTool, "item")
lman.add_tool(BasePlotMenuTool, "axes")
lman.add_tool(BasePlotMenuTool, "grid")
lman.add_tool(AntiAliasingTool)
lman.get_default_tool().activate()
self.outliers_param = EliminateOutliersParam(self.PANEL_TITLE)
示例6: _generateFrame
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
def _generateFrame(self):
'''
Return the frame containing the presentation, check if the frame was created, otherwise it is created
:return:
'''
# generate the frame if necessary
if self._frame is None:
# Generate frame and define the layout based on the frame
self._frame = QFrame(self._parentFrame)
_layout = QVBoxLayout()
self._frame.setLayout(_layout)
# Add the "Main" group box for this view, if present. It is rendered in foreground
if self._generateGroupBox() is not None:
_layout.addWidget(self._groupbox)
else:
self._frame.setFrameStyle(QFrame.Panel|QFrame.Raised)
self._frame.setLineWidth(1)
# Add to layout eventually the other subview
if self._viewtype == 'Tabs':
_tabs = QTabWidget()
_layout.addWidget(_tabs)
elif self._viewtype == 'Splitter':
_splitter =QSplitter()
_layout.addWidget(_splitter)
else:
_sub_frame = QFrame()
_sub_frame_layout = QHBoxLayout()
_sub_frame.setLayout(_sub_frame_layout)
_layout.addWidget(_sub_frame)
# Add all the sub view as sub frames in the layout
for sw in self._subViewDictionary.values():
sw.setParentView(self._frame)
if self._viewtype == 'Tabs':
_tabs.addTab(sw.getFrame(), sw.viewname)
elif self._viewtype == 'Splitter':
_splitter.addWidget(sw.getFrame())
else:
_sub_frame_layout.addWidget(sw.getFrame())
return self._frame
示例7: __init__
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
def __init__(self, parent):
QWidget.__init__(self, parent)
font = QFont(get_family(MONOSPACE), 10, QFont.Normal)
info_icon = QLabel()
icon = get_std_icon('MessageBoxInformation').pixmap(24, 24)
info_icon.setPixmap(icon)
info_icon.setFixedWidth(32)
info_icon.setAlignment(Qt.AlignTop)
self.desc_label = QLabel()
self.desc_label.setWordWrap(True)
self.desc_label.setAlignment(Qt.AlignTop)
self.desc_label.setFont(font)
group_desc = QGroupBox(_("Description"), self)
layout = QHBoxLayout()
layout.addWidget(info_icon)
layout.addWidget(self.desc_label)
group_desc.setLayout(layout)
self.editor = CodeEditor(self)
self.editor.setup_editor(linenumbers=True, font=font)
self.editor.setReadOnly(True)
group_code = QGroupBox(_("Source code"), self)
layout = QVBoxLayout()
layout.addWidget(self.editor)
group_code.setLayout(layout)
self.run_button = QPushButton(get_icon("apply.png"),
_("Run this script"), self)
self.quit_button = QPushButton(get_icon("exit.png"), _("Quit"), self)
hlayout = QHBoxLayout()
hlayout.addWidget(self.run_button)
hlayout.addStretch()
hlayout.addWidget(self.quit_button)
vlayout = QVBoxLayout()
vlayout.addWidget(group_desc)
vlayout.addWidget(group_code)
vlayout.addLayout(hlayout)
self.setLayout(vlayout)
示例8: __init__
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [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'))
示例9: FitDialog
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
class FitDialog(QDialog, FitWidgetMixin):
def __init__(self, wintitle=None, icon="guiqwt.svg", edit=True,
toolbar=False, options=None, parent=None, panels=None,
param_cols=1, legend_anchor='TR', auto_fit=False):
if not PYQT5:
QDialog.__init__(self, parent)
self.edit = edit
self.button_layout = None
if PYQT5:
super(FitDialog, self).__init__(parent, wintitle=wintitle,
icon=icon, toolbar=toolbar, options=options, panels=panels,
param_cols=param_cols, legend_anchor=legend_anchor,
auto_fit=auto_fit)
else:
FitWidgetMixin.__init__(self, wintitle, icon, toolbar, options,
panels, param_cols, legend_anchor,
auto_fit)
self.setWindowFlags(Qt.Window)
def setup_widget_layout(self):
FitWidgetMixin.setup_widget_layout(self)
if self.edit:
self.install_button_layout()
def install_button_layout(self):
bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
bbox.accepted.connect(self.accept)
bbox.rejected.connect(self.reject)
self.button_list += [bbox.button(QDialogButtonBox.Ok)]
self.button_layout = QHBoxLayout()
self.button_layout.addStretch()
self.button_layout.addWidget(bbox)
vlayout = self.layout()
vlayout.addSpacing(10)
vlayout.addLayout(self.button_layout)
示例10: setup_widget
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
def setup_widget(self):
layout = QHBoxLayout()
layout.addWidget(self.cs_plot)
layout.addWidget(self.toolbar)
layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
示例11: __init__
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
def __init__(self, parent):
QWidget.__init__(self, parent)
font = QFont(get_family(MONOSPACE), 10, QFont.Normal)
info_icon = QLabel()
icon = get_std_icon('MessageBoxInformation').pixmap(24, 24)
info_icon.setPixmap(icon)
info_icon.setFixedWidth(32)
info_icon.setAlignment(Qt.AlignTop)
self.service_status_label = QLabel()
self.service_status_label.setWordWrap(True)
self.service_status_label.setAlignment(Qt.AlignTop)
self.service_status_label.setFont(font)
self.desc_label = QLabel()
self.desc_label.setWordWrap(True)
self.desc_label.setAlignment(Qt.AlignTop)
self.desc_label.setFont(font)
group_desc = QGroupBox("Description", self)
layout = QHBoxLayout()
layout.addWidget(info_icon)
layout.addWidget(self.desc_label)
layout.addStretch()
layout.addWidget(self.service_status_label )
group_desc.setLayout(layout)
self.editor = CodeEditor(self)
self.editor.setup_editor(linenumbers=True, font=font)
self.editor.setReadOnly(False)
group_code = QGroupBox("Source code", self)
layout = QVBoxLayout()
layout.addWidget(self.editor)
group_code.setLayout(layout)
self.enable_button = QPushButton(get_icon("apply.png"),
"Enable", self)
self.save_button = QPushButton(get_icon("filesave.png"),
"Save", self)
self.edit_datadog_conf_button = QPushButton(get_icon("edit.png"),
"Edit agent settings", self)
self.disable_button = QPushButton(get_icon("delete.png"),
"Disable", self)
self.view_log_button = QPushButton(get_icon("txt.png"),
"View log", self)
self.menu_button = QPushButton(get_icon("settings.png"),
"Manager", self)
hlayout = QHBoxLayout()
hlayout.addWidget(self.save_button)
hlayout.addStretch()
hlayout.addWidget(self.enable_button)
hlayout.addStretch()
hlayout.addWidget(self.disable_button)
hlayout.addStretch()
hlayout.addWidget(self.edit_datadog_conf_button)
hlayout.addStretch()
hlayout.addWidget(self.view_log_button)
hlayout.addStretch()
hlayout.addWidget(self.menu_button)
vlayout = QVBoxLayout()
vlayout.addWidget(group_desc)
vlayout.addWidget(group_code)
vlayout.addLayout(hlayout)
self.setLayout(vlayout)
self.current_file = None
示例12: __init__
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
def __init__(self, parent):
QWidget.__init__(self, parent)
font = QFont(get_family(MONOSPACE), 10, QFont.Normal)
info_icon = QLabel()
icon = get_std_icon("MessageBoxInformation").pixmap(24, 24)
info_icon.setPixmap(icon)
info_icon.setFixedWidth(32)
info_icon.setAlignment(Qt.AlignTop)
self.service_status_label = QLabel()
self.service_status_label.setWordWrap(True)
self.service_status_label.setAlignment(Qt.AlignTop)
self.service_status_label.setFont(font)
self.desc_label = QLabel()
self.desc_label.setWordWrap(True)
self.desc_label.setAlignment(Qt.AlignTop)
self.desc_label.setFont(font)
self.group_desc = QGroupBox("Description", self)
layout = QHBoxLayout()
layout.addWidget(info_icon)
layout.addWidget(self.desc_label)
layout.addStretch()
layout.addWidget(self.service_status_label)
self.group_desc.setLayout(layout)
self.editor = CodeEditor(self)
self.editor.setup_editor(linenumbers=True, font=font)
self.editor.setReadOnly(False)
self.group_code = QGroupBox("Source code", self)
layout = QVBoxLayout()
layout.addWidget(self.editor)
self.group_code.setLayout(layout)
self.enable_button = QPushButton(get_icon("apply.png"), "Enable", self)
self.save_button = QPushButton(get_icon("filesave.png"), "Save", self)
self.disable_button = QPushButton(get_icon("delete.png"), "Disable", self)
self.refresh_button = QPushButton(get_icon("restart.png"), "Refresh", self)
hlayout = QHBoxLayout()
hlayout.addWidget(self.save_button)
hlayout.addWidget(self.enable_button)
hlayout.addWidget(self.disable_button)
hlayout.addWidget(self.refresh_button)
vlayout = QVBoxLayout()
vlayout.addWidget(self.group_desc)
vlayout.addWidget(self.group_code)
self.html_window = HTMLWindow()
vlayout.addWidget(self.html_window)
vlayout.addLayout(hlayout)
self.setLayout(vlayout)
self.current_file = None
示例13: addWidget
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
def addWidget(self, widget):
QHBoxLayout.addWidget(self, widget)
self.widgets.append(widget)
示例14: FitWidgetMixin
# 需要导入模块: from guidata.qt.QtGui import QHBoxLayout [as 别名]
# 或者: from guidata.qt.QtGui.QHBoxLayout import addWidget [as 别名]
class FitWidgetMixin(CurveWidgetMixin):
def __init__(self, wintitle="guiqwt plot", icon="guiqwt.svg",
toolbar=False, options=None, panels=None, param_cols=1,
legend_anchor='TR', auto_fit=True):
if wintitle is None:
wintitle = _('Curve fitting')
self.x = None
self.y = None
self.fitfunc = None
self.fitargs = None
self.fitkwargs = None
self.fitparams = None
self.autofit_prm = None
self.data_curve = None
self.fit_curve = None
self.legend = None
self.legend_anchor = legend_anchor
self.xrange = None
self.show_xrange = False
self.param_cols = param_cols
self.auto_fit_enabled = auto_fit
self.button_list = [] # list of buttons to be disabled at startup
self.fit_layout = None
self.params_layout = None
CurveWidgetMixin.__init__(self, wintitle=wintitle, icon=icon,
toolbar=toolbar, options=options,
panels=panels)
self.refresh()
# QWidget API --------------------------------------------------------------
def resizeEvent(self, event):
QWidget.resizeEvent(self, event)
self.get_plot().replot()
# CurveWidgetMixin API -----------------------------------------------------
def setup_widget_layout(self):
self.fit_layout = QHBoxLayout()
self.params_layout = QGridLayout()
params_group = create_groupbox(self, _("Fit parameters"),
layout=self.params_layout)
if self.auto_fit_enabled:
auto_group = self.create_autofit_group()
self.fit_layout.addWidget(auto_group)
self.fit_layout.addWidget(params_group)
self.plot_layout.addLayout(self.fit_layout, 1, 0)
vlayout = QVBoxLayout(self)
vlayout.addWidget(self.toolbar)
vlayout.addLayout(self.plot_layout)
self.setLayout(vlayout)
def create_plot(self, options):
CurveWidgetMixin.create_plot(self, options)
for plot in self.get_plots():
plot.SIG_RANGE_CHANGED.connect(self.range_changed)
# Public API ---------------------------------------------------------------
def set_data(self, x, y, fitfunc=None, fitparams=None,
fitargs=None, fitkwargs=None):
if self.fitparams is not None and fitparams is not None:
self.clear_params_layout()
self.x = x
self.y = y
if fitfunc is not None:
self.fitfunc = fitfunc
if fitparams is not None:
self.fitparams = fitparams
if fitargs is not None:
self.fitargs = fitargs
if fitkwargs is not None:
self.fitkwargs = fitkwargs
self.autofit_prm = AutoFitParam(title=_("Automatic fitting options"))
self.autofit_prm.xmin = x.min()
self.autofit_prm.xmax = x.max()
self.compute_imin_imax()
if self.fitparams is not None and fitparams is not None:
self.populate_params_layout()
self.refresh()
def set_fit_data(self, fitfunc, fitparams, fitargs=None, fitkwargs=None):
if self.fitparams is not None:
self.clear_params_layout()
self.fitfunc = fitfunc
self.fitparams = fitparams
self.fitargs = fitargs
self.fitkwargs = fitkwargs
self.populate_params_layout()
self.refresh()
def clear_params_layout(self):
for i, param in enumerate(self.fitparams):
for widget in param.get_widgets():
if widget is not None:
self.params_layout.removeWidget(widget)
#.........这里部分代码省略.........