本文整理汇总了Python中guidata.qt.QtGui.QGroupBox类的典型用法代码示例。如果您正苦于以下问题:Python QGroupBox类的具体用法?Python QGroupBox怎么用?Python QGroupBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QGroupBox类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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
示例2: create_SessionType_Group
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
示例3: __init__
def __init__(self, label, klass, wordwrap=False, **kwargs):
QGroupBox.__init__(self, label)
self.klass = klass
self.dataset = klass(**kwargs)
self.layout = QVBoxLayout()
if self.dataset.get_comment():
label = QLabel(self.dataset.get_comment())
label.setWordWrap(wordwrap)
self.layout.addWidget(label)
self.grid_layout = QGridLayout()
self.layout.addLayout(self.grid_layout)
self.setLayout(self.layout)
self.edit = self.get_edit_layout()
示例4: create_groupbox
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
示例5: __init__
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)
示例6: __init__
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)
示例7: __init__
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
示例8: PropertiesWidget
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
#.........这里部分代码省略.........
示例9: ChoiceWidget
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)
#.........这里部分代码省略.........