本文整理汇总了Python中PySide.QtGui.QCheckBox类的典型用法代码示例。如果您正苦于以下问题:Python QCheckBox类的具体用法?Python QCheckBox怎么用?Python QCheckBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QCheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, text, minValue, maxValue, defaultValue ):
QWidget.__init__( self )
validator = QDoubleValidator(minValue, maxValue, 2, self )
mainLayout = QHBoxLayout( self )
checkBox = QCheckBox()
checkBox.setFixedWidth( 115 )
checkBox.setText( text )
lineEdit = QLineEdit()
lineEdit.setValidator( validator )
lineEdit.setText( str(defaultValue) )
slider = QSlider( QtCore.Qt.Horizontal )
slider.setMinimum( minValue*100 )
slider.setMaximum( maxValue*100 )
slider.setValue( defaultValue )
mainLayout.addWidget( checkBox )
mainLayout.addWidget( lineEdit )
mainLayout.addWidget( slider )
QtCore.QObject.connect( slider, QtCore.SIGNAL( 'valueChanged(int)' ), self.syncWidthLineEdit )
QtCore.QObject.connect( lineEdit, QtCore.SIGNAL( 'textChanged(QString)' ), self.syncWidthSlider )
QtCore.QObject.connect( checkBox, QtCore.SIGNAL( "clicked()" ), self.updateEnabled )
self.checkBox = checkBox
self.slider = slider
self.lineEdit = lineEdit
self.updateEnabled()
示例2: __init__
def __init__(self, *args, **kwargs ):
QWidget.__init__( self, *args, **kwargs )
mainLayout = QHBoxLayout( self )
mainLayout.setContentsMargins(0,0,0,0)
label = QLabel( "Aim Direction : " )
lineEdit1 = QLineEdit()
lineEdit2 = QLineEdit()
lineEdit3 = QLineEdit()
verticalSeparator = Widget_verticalSeparator()
checkBox = QCheckBox( "Set Auto" )
mainLayout.addWidget( label )
mainLayout.addWidget( lineEdit1 )
mainLayout.addWidget( lineEdit2 )
mainLayout.addWidget( lineEdit3 )
mainLayout.addWidget( verticalSeparator )
mainLayout.addWidget( checkBox )
validator = QDoubleValidator( -10000.0, 10000.0, 2 )
lineEdit1.setValidator( validator )
lineEdit2.setValidator( validator )
lineEdit3.setValidator( validator )
lineEdit1.setText( "0.0" )
lineEdit2.setText( "1.0" )
lineEdit3.setText( "0.0" )
checkBox.setChecked( True )
self.label = label; self.lineEdit1 = lineEdit1;
self.lineEdit2 = lineEdit2; self.lineEdit3 = lineEdit3; self.checkBox = checkBox
self.setVectorEnabled()
QtCore.QObject.connect( checkBox, QtCore.SIGNAL( 'clicked()' ), self.setVectorEnabled )
示例3: create_checkbox
def create_checkbox(self, parent, label=""):
""" Returns an adapted checkbox control.
"""
control = QCheckBox(check_parent(parent))
control.setText(label)
return control_adapter_for(control)
示例4: buildAttributeGroupBox
def buildAttributeGroupBox(self):
"""Layout/construct the AttributeScene UI for this tab."""
groupBox = QGroupBox("Attribute Policy (Colors)")
layout = QVBoxLayout()
# agent.propagate_attribute_scenes
self.attr_propagate = QCheckBox(
"Propagate attribute scene " + "information (e.g. color maps) to other modules."
)
self.attr_propagate.setChecked(self.agent.propagate_attribute_scenes)
self.attr_propagate.stateChanged.connect(self.attrPropagateChanged)
# We only allow this change if the parent does not propagate
if self.agent.parent().propagate_attribute_scenes:
self.attr_propagate.setDisabled(True)
# agent.apply_attribute_scenes
self.attr_applyScene = QCheckBox("Apply attribute scene information " + "from other modules.")
self.attr_applyScene.setChecked(self.agent.apply_attribute_scenes)
self.attr_applyScene.stateChanged.connect(self.attrApplyChanged)
layout.addWidget(self.attr_applyScene)
layout.addItem(QSpacerItem(5, 5))
layout.addWidget(self.attr_propagate)
groupBox.setLayout(layout)
return groupBox
示例5: __init__
def __init__(self, group_name, name_list, param_type = int, default_param = None, help_instance = None, handler = None, help_dict = None):
QGroupBox.__init__(self, group_name)
the_layout = QVBoxLayout()
the_layout.setSpacing(5)
the_layout.setContentsMargins(1, 1, 1, 1)
self.setLayout(the_layout)
self.widget_dict = OrderedDict([])
self.mytype= param_type
self.is_popup = False
if default_param == None:
default_param = ""
self.default_param = default_param
for txt in name_list:
qh = QHBoxLayout()
cb = QCheckBox(txt)
cb.setFont(QFont('SansSerif', 12))
efield = QLineEdit(str(default_param))
efield.setFont(QFont('SansSerif', 10))
efield.setMaximumWidth(25)
qh.addWidget(cb)
qh.addStretch()
qh.addWidget(efield)
the_layout.addLayout(qh)
if handler != None:
cb.toggled.connect(handler)
self.widget_dict[txt] = [cb, efield]
if (help_dict != None) and (help_instance != None):
if txt in help_dict:
help_button_widget = help_instance.create_button(txt, help_dict[txt])
qh.addWidget(help_button_widget)
return
示例6: _setupUi
def _setupUi(self):
self.setMinimumWidth(800)
self.setMinimumHeight(600)
layout = QVBoxLayout()
self.setLayout(layout)
self.editPmCmd = QLineEdit()
layout.addWidget(self.editPmCmd)
self.modesWidget = QWidget()
self.modesLayout = QHBoxLayout()
self.modesWidget.setLayout(self.modesLayout)
layout.addWidget(self.modesWidget)
self.checkBoxes = []
for mode in 'create query edit'.split():
chkBox = QCheckBox(mode)
chkBox.setProperty('mode', mode)
self.checkBoxes.append(chkBox)
for checkBox in self.checkBoxes:
self.modesLayout.addWidget(checkBox)
checkBox.setChecked(True)
if self.command:
self.updateDocs()
else:
layout.addStretch()
示例7: createEditor
def createEditor(self, parent, option, index):
if not index.isValid():
return QSqlRelationalDelegate.createEditor(self, parent,
option, index)
if index.column() in self.__read_only:
return None
elif index.column() in self.__dates:
return QDateEdit(QDate.currentDate(), parent)
elif index.column() in self.__booleens:
editor = QCheckBox("", parent)
r = self.checkBoxRect(option, editor)
rect = option.rect
rect.moveTo(r.x(), r.y())
rect.setWidth(r.width())
rect.setHeight(r.height())
editor.setGeometry(rect)
editor.setAutoFillBackground(True)
return editor
elif index.column() in self.__numbers:
editor = QSpinBox(parent)
editor.setMinimum(0)
editor.setMaximum(100)
return editor
return QSqlRelationalDelegate.createEditor(self, parent,
option, index)
示例8: createVulnOptions
def createVulnOptions(self):
"""
Vulnerability Discovery related
"""
groupBox = QtGui.QGroupBox('Vulnerability Discovery')
# Elements
cbv_deep_dang = QCheckBox('Deep search for dangerous functions')
# xxx = QCheckBox('blah')
# Default states are read from the Options
# class and reflected in the GUI
cbv_deep_dang.setCheckState(self.get_state(self.config.deep_dangerous_functions))
# Connect elements and signals
cbv_deep_dang.stateChanged.connect(self.deep_dangerous)
vbox = QtGui.QVBoxLayout()
vbox.addWidget(cbv_deep_dang)
# vbox.addWidget(xxx)
vbox.addStretch(1)
groupBox.setLayout(vbox)
return groupBox
示例9: _initUI
def _initUI(self):
# Variables
result = self.result()
transitions = sorted(result.iter_transitions())
transition0 = transitions[0]
model = _TransitionListModel(transitions)
# Widgets
self._chk_errorbar = QCheckBox("Show error bars")
self._chk_errorbar.setChecked(True)
self._cb_transition = QComboBox()
self._cb_transition.setModel(model)
self._cb_transition.setCurrentIndex(0)
self._chk_pg = QCheckBox("No absorption, no fluorescence")
state = result.exists(transition0, True, False, False, False)
self._chk_pg.setEnabled(state)
self._chk_pg.setChecked(state)
self._chk_eg = QCheckBox("With absorption, no fluorescence")
state = result.exists(transition0, True, True, False, False)
self._chk_eg.setEnabled(state)
self._chk_eg.setChecked(state)
self._chk_pt = QCheckBox("No absorption, with fluorescence")
state = result.exists(transition0, True, False, True, True)
self._chk_pt.setEnabled(state)
self._chk_pt.setChecked(state)
self._chk_et = QCheckBox("With absorption, with fluorescence")
state = result.exists(transition0, True, True, True, True)
self._chk_et.setEnabled(state)
self._chk_et.setChecked(state)
# Layouts
layout = _ResultToolItem._initUI(self)
layout.addRow(self._chk_errorbar)
layout.addRow("Transition", self._cb_transition)
boxlayout = QVBoxLayout()
boxlayout.addWidget(self._chk_pg)
boxlayout.addWidget(self._chk_eg)
boxlayout.addWidget(self._chk_pt)
boxlayout.addWidget(self._chk_et)
box_generated = QGroupBox("Curves")
box_generated.setLayout(boxlayout)
layout.addRow(box_generated)
# Signals
self._cb_transition.currentIndexChanged.connect(self._onTransitionChanged)
self._chk_pg.stateChanged.connect(self.stateChanged)
self._chk_eg.stateChanged.connect(self.stateChanged)
self._chk_pt.stateChanged.connect(self.stateChanged)
self._chk_et.stateChanged.connect(self.stateChanged)
self._chk_errorbar.stateChanged.connect(self.stateChanged)
return layout
示例10: __init__
def __init__(self, renderController, parent=None):
super(RenderSlicerParamWidget, self).__init__(parent=parent)
self.renderController = renderController
self.renderController.slicesChanged.connect(self.setSlices)
self.renderController.clippingBoxChanged.connect(self.showsClippingBox)
self.renderController.clippingPlanesChanged.connect(self.showsClippingPlanes)
self.sliceLabelTexts = ["Axial:", "Coronal:", "Sagittal:"]
self.sliceLabels = [QLabel(text) for text in self.sliceLabelTexts]
self.sliceCheckBoxes = [QCheckBox() for i in range(3)]
for index in range(3):
self.sliceCheckBoxes[index].clicked.connect(self.checkBoxChanged)
self.sliceLabels[index].setAlignment(Qt.AlignRight | Qt.AlignVCenter)
self.sliceCheckBoxes[index].setEnabled(True)
slicesLayout = QGridLayout()
slicesLayout.setAlignment(Qt.AlignTop)
for index in range(3):
slicesLayout.addWidget(self.sliceLabels[index], index+1, 0)
slicesLayout.addWidget(self.sliceCheckBoxes[index], index+1, 1)
self.slicesGroupBox = QGroupBox()
self.slicesGroupBox.setTitle("Visible slices")
self.slicesGroupBox.setLayout(slicesLayout)
# Create option to show clipping box
self.clippingCheckBox = QCheckBox()
self.clippingCheckBox.setChecked(self.renderController.clippingBox)
self.clippingCheckBox.clicked.connect(self.clippingCheckBoxChanged)
self.clippingPlanesCheckBox = QCheckBox()
self.clippingPlanesCheckBox.setChecked(self.renderController.clippingPlanes)
self.clippingPlanesCheckBox.clicked.connect(self.clippingPlanesCheckBoxChanged)
self.resetButton = QPushButton("Reset")
self.resetButton.clicked.connect(self.resetClippingBox)
clippingLabel = QLabel("Clipping box:")
clippingLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
clippingPlanesLabel = QLabel("Clipping planes:")
clippingPlanesLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
clipLayout = QGridLayout()
clipLayout.addWidget(clippingLabel, 0, 0)
clipLayout.addWidget(self.clippingCheckBox, 0, 1)
clipLayout.addWidget(clippingPlanesLabel, 1, 0)
clipLayout.addWidget(self.clippingPlanesCheckBox, 1, 1)
clipLayout.addWidget(self.resetButton, 2, 0)
self.clippingGroupBox = QGroupBox()
self.clippingGroupBox.setTitle("Clipping box")
self.clippingGroupBox.setLayout(clipLayout)
# Create a nice layout for the labels
layout = QGridLayout()
layout.setAlignment(Qt.AlignTop)
layout.addWidget(self.slicesGroupBox, 0, 0)
layout.addWidget(self.clippingGroupBox, 0, 1)
self.setLayout(layout)
示例11: testSignalMapper
def testSignalMapper(self):
checkboxMapper = QSignalMapper()
box = QCheckBox('check me')
box.stateChanged.connect(checkboxMapper.map)
checkboxMapper.setMapping(box, box.text())
checkboxMapper.mapped[str].connect(self.cb_changed)
self._changed = False
box.setChecked(True)
self.assert_(self._changed)
示例12: __init__
def __init__(self, color, diameter, parent=None):
QCheckBox.__init__(self, parent)
self.color1 = QColor(color)
self.color2 = QColor(50, 50, 50)
self.resize(QSize(2 * float(diameter), diameter))
self.setStyleSheet("background-color: rgb(0, 0, 0);\n" +
"color: rgb(255, 255, 255);\n")
self.setChecked(True)
self.setEnabled(True)
self._enable = True
示例13: _PhotonSpectrumResultOptionsToolItem
class _PhotonSpectrumResultOptionsToolItem(_ResultToolItem):
def _initUI(self):
# Widgets
self._chk_total = QCheckBox("Show total intensity")
self._chk_total.setChecked(True)
self._chk_background = QCheckBox("Show background intensity")
self._chk_background.setChecked(False)
self._chk_errorbar = QCheckBox("Show error bars")
self._chk_errorbar.setChecked(True)
# Layouts
layout = _ResultToolItem._initUI(self)
layout.addRow(self._chk_total)
layout.addRow(self._chk_background)
layout.addRow(self._chk_errorbar)
# Signals
self._chk_total.stateChanged.connect(self.stateChanged)
self._chk_background.stateChanged.connect(self.stateChanged)
self._chk_errorbar.stateChanged.connect(self.stateChanged)
return layout
def isTotal(self):
return self._chk_total.isChecked()
def isBackground(self):
return self._chk_background.isChecked()
def isErrorbar(self):
return self._chk_errorbar.isChecked()
示例14: EditPreferencesDlg
class EditPreferencesDlg(QDialog):
def __init__(self, parent=None):
super(EditPreferencesDlg, self).__init__(parent)
self.setWindowTitle("Preferences")
# define widgets
pref_list = QListWidget()
pref_list.addItem("General")
pref_list.addItem("Display")
pref_list.setMaximumWidth(150)
pref_list.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
general_page = QWidget()
general_layout = QGridLayout()
general_layout.setAlignment(Qt.AlignTop)
general_layout.addWidget(QLabel("<b>General</b>"), 0, 0)
general_page.setLayout(general_layout)
display_page = QWidget()
display_layout = QGridLayout()
display_layout.setAlignment(Qt.AlignTop)
display_layout.addWidget(QLabel("<b>Display Options</b>"), 0, 0)
self.multitabs_checkbox = QCheckBox("Limit the display of tabs to one relief device (and the device's scenarios) at a time")
if parent.limit_tabs is True:
self.multitabs_checkbox.setChecked(True)
display_layout.addWidget(self.multitabs_checkbox, 1, 0)
display_page.setLayout(display_layout)
stacked_widget = QStackedWidget()
for page in general_page, display_page:
stacked_widget.addWidget(page)
main_layout = QVBoxLayout()
widgets_layout = QHBoxLayout()
widgets_layout.addWidget(pref_list)
widgets_layout.addWidget(stacked_widget)
buttons_layout = QHBoxLayout()
buttons_layout.addStretch()
buttons_layout.addWidget(button_box)
main_layout.addLayout(widgets_layout)
main_layout.addLayout(buttons_layout)
self.setLayout(main_layout)
pref_list.currentRowChanged.connect(stacked_widget.setCurrentIndex)
button_box.accepted.connect(self.accept)
button_box.rejected.connect(self.reject)
def sizeHint(self):
return QSize(400, 400)
def returnVals(self):
return self.multitabs_checkbox.isChecked()
示例15: addReadinessTab
def addReadinessTab(self):
self.readyFrame = QtGui.QFrame()
self.readyLayout = QtGui.QVBoxLayout()
self.readyFrame.setLayout(self.readyLayout)
# Initial state
self.readyInitialGroup = QtGui.QGroupBox(u"Initial readiness state")
self.readyInitialLayout = QtGui.QVBoxLayout()
self.readyInitialGroup.setLayout(self.readyInitialLayout)
self.readyatstartCheckbox = QCheckBox(getMessage("readyatstart-label"))
self.readyatstartCheckbox.setObjectName("readyAtStart")
self.readyInitialLayout.addWidget(self.readyatstartCheckbox)
self.readyLayout.addWidget(self.readyInitialGroup)
# Automatically pausing
self.readyPauseGroup = QtGui.QGroupBox(u"Pausing")
self.readyPauseLayout = QtGui.QVBoxLayout()
self.readyPauseGroup.setLayout(self.readyPauseLayout)
self.pauseonleaveCheckbox = QCheckBox(getMessage("pauseonleave-label"))
self.pauseonleaveCheckbox.setObjectName("pauseOnLeave")
self.readyPauseLayout.addWidget(self.pauseonleaveCheckbox)
self.readyLayout.addWidget(self.readyPauseGroup)
# Unpausing
self.readyUnpauseGroup = QtGui.QGroupBox(getMessage("unpause-title"))
self.readyUnpauseLayout = QtGui.QVBoxLayout()
self.readyUnpauseGroup.setLayout(self.readyUnpauseLayout)
self.readyUnpauseButtonGroup = QButtonGroup()
self.unpauseIfAlreadyReadyOption = QRadioButton(getMessage("unpause-ifalreadyready-option"))
self.readyUnpauseButtonGroup.addButton(self.unpauseIfAlreadyReadyOption)
self.unpauseIfAlreadyReadyOption.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png"))
self.unpauseIfAlreadyReadyOption.setObjectName("unpause-ifalreadyready" + constants.CONFIG_NAME_MARKER + "unpauseAction" + constants.CONFIG_VALUE_MARKER + constants.UNPAUSE_IFALREADYREADY_MODE)
self.readyUnpauseLayout.addWidget(self.unpauseIfAlreadyReadyOption)
self.unpauseIfOthersReadyOption = QRadioButton(getMessage("unpause-ifothersready-option"))
self.readyUnpauseButtonGroup.addButton(self.unpauseIfOthersReadyOption)
self.unpauseIfOthersReadyOption.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png"))
self.unpauseIfOthersReadyOption.setObjectName("unpause-ifothersready" + constants.CONFIG_NAME_MARKER + "unpauseAction" + constants.CONFIG_VALUE_MARKER + constants.UNPAUSE_IFOTHERSREADY_MODE)
self.readyUnpauseLayout.addWidget(self.unpauseIfOthersReadyOption)
self.unpauseIfMinUsersReadyOption = QRadioButton(getMessage("unpause-ifminusersready-option"))
self.readyUnpauseButtonGroup.addButton(self.unpauseIfMinUsersReadyOption)
self.unpauseIfMinUsersReadyOption.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png"))
self.unpauseIfMinUsersReadyOption.setObjectName("unpause-ifminusersready" + constants.CONFIG_NAME_MARKER + "unpauseAction" + constants.CONFIG_VALUE_MARKER + constants.UNPAUSE_IFMINUSERSREADY_MODE)
self.readyUnpauseLayout.addWidget(self.unpauseIfMinUsersReadyOption)
self.unpauseAlwaysUnpauseOption = QRadioButton(getMessage("unpause-always"))
self.readyUnpauseButtonGroup.addButton(self.unpauseAlwaysUnpauseOption)
self.unpauseAlwaysUnpauseOption.setStyleSheet(constants.STYLE_SUBCHECKBOX.format(self.posixresourcespath + "chevrons_right.png"))
self.unpauseAlwaysUnpauseOption.setObjectName("unpause-always" + constants.CONFIG_NAME_MARKER + "unpauseAction" + constants.CONFIG_VALUE_MARKER + constants.UNPAUSE_ALWAYS_MODE)
self.readyUnpauseLayout.addWidget(self.unpauseAlwaysUnpauseOption)
self.readyLayout.addWidget(self.readyUnpauseGroup)
self.readyLayout.setAlignment(Qt.AlignTop)
self.stackedLayout.addWidget(self.readyFrame)