本文整理汇总了Python中guidata.qt.QtGui.QGroupBox.setLayout方法的典型用法代码示例。如果您正苦于以下问题:Python QGroupBox.setLayout方法的具体用法?Python QGroupBox.setLayout怎么用?Python QGroupBox.setLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类guidata.qt.QtGui.QGroupBox
的用法示例。
在下文中一共展示了QGroupBox.setLayout方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_SessionType_Group
# 需要导入模块: from guidata.qt.QtGui import QGroupBox [as 别名]
# 或者: from guidata.qt.QtGui.QGroupBox import setLayout [as 别名]
def create_SessionType_Group( self ):
groupBox = QGroupBox(' Session Type' )
vbox = QVBoxLayout()
self.sessiontypes = []
types = [['Unconscious', 0], ['Mindfull', 1]]
for t in types:
self.sessiontypes.append( QRadioButton( t[0] ) )
vbox.addWidget( self.sessiontypes[-1] )
self.sessiontypes[0].setChecked(True)
vbox.addStretch(1)
groupBox.setLayout(vbox)
return groupBox
示例2: create_groupbox
# 需要导入模块: from guidata.qt.QtGui import QGroupBox [as 别名]
# 或者: from guidata.qt.QtGui.QGroupBox import setLayout [as 别名]
def create_groupbox(parent, title=None, toggled=None, checked=None,
flat=False, layout=None):
"""Create a QGroupBox"""
if title is None:
group = QGroupBox(parent)
else:
group = QGroupBox(title, parent)
group.setFlat(flat)
if toggled is not None:
group.setCheckable(True)
if checked is not None:
group.setChecked(checked)
parent.connect(group, SIGNAL("toggled(bool)"), toggled)
if layout is not None:
group.setLayout(layout)
return group
示例3: __init__
# 需要导入模块: from guidata.qt.QtGui import QGroupBox [as 别名]
# 或者: from guidata.qt.QtGui.QGroupBox import setLayout [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)
示例4: __init__
# 需要导入模块: from guidata.qt.QtGui import QGroupBox [as 别名]
# 或者: from guidata.qt.QtGui.QGroupBox import setLayout [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
示例5: __init__
# 需要导入模块: from guidata.qt.QtGui import QGroupBox [as 别名]
# 或者: from guidata.qt.QtGui.QGroupBox import setLayout [as 别名]
def __init__(self, parent=None):
QSplitter.__init__(self, parent)
self.setWindowTitle(MAIN_WINDOW_TITLE)
self.setWindowIcon(get_icon("agent.svg"))
self.sysTray = SystemTray(self)
self.connect(self.sysTray, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.__icon_activated)
checks = get_checks()
datadog_conf = DatadogConf(get_config_path(), description="Agent settings file: datadog.conf")
self.forwarder_log_file = ForwarderLogFile()
self.collector_log_file = CollectorLogFile()
self.dogstatsd_log_file = DogstatsdLogFile()
self.jmxfetch_log_file = JMXFetchLogFile()
listwidget = QListWidget(self)
listwidget.addItems([osp.basename(check.module_name).replace("_", " ").title() for check in checks])
self.properties = PropertiesWidget(self)
self.setting_button = QPushButton(get_icon("info.png"), "Logs and Status", self)
self.menu_button = QPushButton(get_icon("settings.png"), "Actions", self)
self.settings = [
(
"Forwarder Logs",
lambda: [
self.properties.set_log_file(self.forwarder_log_file),
self.show_html(self.properties.group_code, self.properties.html_window, False),
],
),
(
"Collector Logs",
lambda: [
self.properties.set_log_file(self.collector_log_file),
self.show_html(self.properties.group_code, self.properties.html_window, False),
],
),
(
"Dogstatsd Logs",
lambda: [
self.properties.set_log_file(self.dogstatsd_log_file),
self.show_html(self.properties.group_code, self.properties.html_window, False),
],
),
(
"JMX Fetch Logs",
lambda: [
self.properties.set_log_file(self.jmxfetch_log_file),
self.show_html(self.properties.group_code, self.properties.html_window, False),
],
),
(
"Agent Status",
lambda: [
self.properties.html_window.setHtml(self.properties.html_window.latest_status()),
self.show_html(self.properties.group_code, self.properties.html_window, True),
self.properties.set_status(),
],
),
]
self.agent_settings = QPushButton(get_icon("edit.png"), "Settings", self)
self.connect(
self.agent_settings,
SIGNAL("clicked()"),
lambda: [
self.properties.set_datadog_conf(datadog_conf),
self.show_html(self.properties.group_code, self.properties.html_window, False),
],
)
self.setting_menu = SettingMenu(self.settings)
self.connect(
self.setting_button,
SIGNAL("clicked()"),
lambda: self.setting_menu.popup(self.setting_button.mapToGlobal(QPoint(0, 0))),
)
self.manager_menu = Menu(self)
self.connect(
self.menu_button,
SIGNAL("clicked()"),
lambda: self.manager_menu.popup(self.menu_button.mapToGlobal(QPoint(0, 0))),
)
holdingBox = QGroupBox("", self)
Box = QVBoxLayout(self)
Box.addWidget(self.agent_settings)
Box.addWidget(self.setting_button)
Box.addWidget(self.menu_button)
Box.addWidget(listwidget)
holdingBox.setLayout(Box)
self.addWidget(holdingBox)
self.addWidget(self.properties)
self.connect(self.properties.enable_button, SIGNAL("clicked()"), lambda: enable_check(self.properties))
#.........这里部分代码省略.........
示例6: PropertiesWidget
# 需要导入模块: from guidata.qt.QtGui import QGroupBox [as 别名]
# 或者: from guidata.qt.QtGui.QGroupBox import setLayout [as 别名]
class PropertiesWidget(QWidget):
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
def set_status(self):
self.refresh_button.setEnabled(True)
self.disable_button.setEnabled(False)
self.enable_button.setEnabled(False)
self.save_button.setEnabled(False)
def set_item(self, check):
self.refresh_button.setEnabled(False)
self.save_button.setEnabled(True)
self.current_file = check
self.desc_label.setText(check.get_description())
self.editor.set_text_from_file(check.file_path)
check.content = self.editor.toPlainText().__str__()
if check.enabled:
self.disable_button.setEnabled(True)
self.enable_button.setEnabled(False)
else:
self.disable_button.setEnabled(False)
self.enable_button.setEnabled(True)
def set_datadog_conf(self, datadog_conf):
self.save_button.setEnabled(True)
self.refresh_button.setEnabled(False)
self.current_file = datadog_conf
self.desc_label.setText(datadog_conf.get_description())
self.editor.set_text_from_file(datadog_conf.file_path)
datadog_conf.content = self.editor.toPlainText().__str__()
self.disable_button.setEnabled(False)
self.enable_button.setEnabled(False)
datadog_conf.check_api_key(self.editor)
def set_log_file(self, log_file):
self.save_button.setEnabled(False)
self.refresh_button.setEnabled(True)
self.disable_button.setEnabled(False)
self.enable_button.setEnabled(False)
try:
self.current_file = log_file
#.........这里部分代码省略.........
示例7: ChoiceWidget
# 需要导入模块: from guidata.qt.QtGui import QGroupBox [as 别名]
# 或者: from guidata.qt.QtGui.QGroupBox import setLayout [as 别名]
class ChoiceWidget(AbstractDataSetWidget):
"""
Choice item widget
"""
def __init__(self, item, parent_layout):
super(ChoiceWidget, self).__init__(item, parent_layout)
self._first_call = True
self.is_radio = item.get_prop_value("display", "radio")
self.store = self.item.get_prop("display", "store", None)
if self.is_radio:
self.group = QGroupBox()
self.group.setToolTip(item.get_help())
self.vbox = QVBoxLayout()
self.group.setLayout(self.vbox)
self._buttons = []
else:
self.combobox = self.group = QComboBox()
self.combobox.setToolTip(item.get_help())
self.combobox.currentIndexChanged.connect(self.index_changed)
def index_changed(self, index):
if self.store:
self.store.set(self.item.instance, self.item.item, self.value())
self.parent_layout.refresh_widgets()
cb = self.item.get_prop_value("display", "callback", None)
if cb is not None:
if self.build_mode:
self.set()
else:
self.parent_layout.update_dataitems()
cb(self.item.instance, self.item.item, self.value())
self.parent_layout.update_widgets(except_this_one=self)
def initialize_widget(self):
if self.is_radio:
for button in self._buttons:
button.toggled.disconnect(self.index_changed)
self.vbox.removeWidget(button)
button.deleteLater()
self._buttons = []
else:
self.combobox.blockSignals(True)
while self.combobox.count():
self.combobox.removeItem(0)
_choices = self.item.get_prop_value("data", "choices")
for key, lbl, img in _choices:
if self.is_radio:
button = QRadioButton(lbl, self.group)
if img:
if is_text_string(img):
if not osp.isfile(img):
img = get_image_file_path(img)
img = QIcon(img)
elif isinstance(img, collections.Callable):
img = img(key)
if self.is_radio:
button.setIcon(img)
else:
self.combobox.addItem(img, lbl)
elif not self.is_radio:
self.combobox.addItem(lbl)
if self.is_radio:
self._buttons.append(button)
self.vbox.addWidget(button)
button.toggled.connect(self.index_changed)
if not self.is_radio:
self.combobox.blockSignals(False)
def set_widget_value(self, idx):
if self.is_radio:
for button in self._buttons:
button.blockSignals(True)
self._buttons[idx].setChecked(True)
for button in self._buttons:
button.blockSignals(False)
else:
self.combobox.blockSignals(True)
self.combobox.setCurrentIndex(idx)
self.combobox.blockSignals(False)
def get_widget_value(self):
if self.is_radio:
for index, widget in enumerate(self._buttons):
if widget.isChecked():
return index
else:
return self.combobox.currentIndex()
def get(self):
"""Override AbstractDataSetWidget method"""
self.initialize_widget()
value = self.item.get()
if value is not None:
idx = 0
_choices = self.item.get_prop_value("data", "choices")
for key, _val, _img in _choices:
if key == value:
break
idx += 1
self.set_widget_value(idx)
#.........这里部分代码省略.........