本文整理汇总了Python中PyQt4.Qt.QPushButton.setCheckable方法的典型用法代码示例。如果您正苦于以下问题:Python QPushButton.setCheckable方法的具体用法?Python QPushButton.setCheckable怎么用?Python QPushButton.setCheckable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QPushButton
的用法示例。
在下文中一共展示了QPushButton.setCheckable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dbsElectrodeControlsDialog
# 需要导入模块: from PyQt4.Qt import QPushButton [as 别名]
# 或者: from PyQt4.Qt.QPushButton import setCheckable [as 别名]
class dbsElectrodeControlsDialog(QDialog):
def __init__(self, callback, parent=None):
QDialog.__init__(self, parent)
self.callback = callback
self.create_widgets()
#self.layout_widgets()
self.create_connections()
self.setModal(False)
self.setWindowTitle('Electrode Controls')
self.layout().setSizeConstraint(QLayout.SetFixedSize)
self.saved_params = dict()
def create_widgets(self):
gridLayout = QGridLayout()
groupBox = QGroupBox( 'Rendering controls' )
groupBox.setFlat(True)
groupBox2 = QGroupBox( 'DBSCAN centroids' )
groupBox2.setFlat(True)
groupBox3 = QGroupBox( 'Electrode filter' )
groupBox3.setFlat(True)
gridLayout.addWidget(groupBox)
gridLayout.addWidget(groupBox3)
gridLayout.addWidget(groupBox2)
# rendering controls
self.visi_label = QLabel( 'show electrodes' )
self.visi = QCheckBox()
self.visi.setChecked(False)
self.fall_off_label = QLabel( 'fall-off' )
self.fall_off = QSlider(Qt.Horizontal)
self.fall_off.setRange(1, 100) # data set dependent
self.thickness_label = QLabel( 'thickness' )
self.thickness = QSlider(Qt.Horizontal)
self.thickness.setRange(1, 100) # data set dependent
self.trans_label = QLabel( 'force translucency' )
self.forced_translucency = QCheckBox()
self.forced_translucency.setChecked(False)
# dbscan controls
#self.view_button_grp = QButtonGroup()
self.all_electrodes = QRadioButton('show all')
self.only_clusters = QRadioButton('show clusters')
self.only_noise = QRadioButton('show noise')
self.all_electrodes.setEnabled(False)
self.all_electrodes.setChecked(True)
self.only_clusters.setEnabled(False)
self.only_noise.setEnabled(False)
#self.view_button_grp.addButton( self.all_electrodes )
#self.view_button_grp.addButton( self.only_clusters )
#self.view_button_grp.addButton( self.only_noise )
#gridLayout.addWidget(self.view_button_grp)
self.eps_label = QLabel( 'epsilon' )
self.eps_spinbox = QDoubleSpinBox()
self.eps_spinbox.setRange(0.1, 10)
self.eps_spinbox.setSingleStep(0.1)
self.min_points_label = QLabel( 'min points' )
self.min_spinbox = QSpinBox()
self.min_spinbox.setRange(1, 20)
self.min_spinbox.setSingleStep(1)
self.button = QPushButton('Recalculate')
self.button.setCheckable(True)
self.browser = QTextBrowser()
vbox = QVBoxLayout()
vbox2 = QVBoxLayout()
vbox3 = QVBoxLayout()
vbox.addWidget( self.visi_label )
vbox.addWidget( self.visi )
vbox.addWidget( self.fall_off_label )
vbox.addWidget( self.fall_off )
vbox.addWidget( self.thickness_label )
vbox.addWidget( self.thickness )
vbox.addWidget( self.trans_label )
vbox.addWidget( self.forced_translucency )
vbox2.addWidget( self.eps_label )
vbox2.addWidget( self.eps_spinbox )
vbox2.addWidget( self.min_points_label )
vbox2.addWidget( self.min_spinbox )
vbox2.addWidget( self.button )
vbox2.addWidget( self.browser )
vbox3.addWidget( self.all_electrodes )
vbox3.addWidget( self.only_clusters )
vbox3.addWidget( self.only_noise )
groupBox.setLayout(vbox)
groupBox2.setLayout(vbox2)
groupBox3.setLayout(vbox3)
#.........这里部分代码省略.........
示例2: dbsPatientSubsetSelectorDialog
# 需要导入模块: from PyQt4.Qt import QPushButton [as 别名]
# 或者: from PyQt4.Qt.QPushButton import setCheckable [as 别名]
class dbsPatientSubsetSelectorDialog(QDialog):
def __init__(self, callback, parent, patnum=50):
QDialog.__init__(self, parent)
self.callback = callback
self.patnum = patnum
self.pat_widgets_list = list()
self.create_and_layout_widgets()
self.create_connections()
self.setModal(False)
self.setWindowTitle('Patient Subset Selector')
#self.pat_sub_group = dict()
#self._patientSelected()
def create_and_layout_widgets(self):
layout = QHBoxLayout(self)
self.setLayout(layout)
lab = QLabel(str(self.patnum))
layout.addWidget(lab)
self.pat_widgets_list.append(lab)
for pat in range(0, self.patnum):
cbox = QCheckBox()
cbox.setChecked(True)
layout.addWidget(cbox)
self.pat_widgets_list.append(cbox)
#self.pat_widgets_list[1].setChecked(True)
self.pushbutton = QPushButton('Recalculate')
layout.addWidget( self.pushbutton )
self.pushbutton.setCheckable(True)
self.layout().setSizeConstraint( QLayout.SetFixedSize )
def updateWidgetValues(self, patnum, patdict):
self.patnum = patnum
self.pat_sub_group = patdict
'''
child = self.layout().takeAt(0)
while child:
del child
child = self.layout().takeAt(0)
del self.pat_cbox_list[:]
'''
# make all widgets invisible
for widget in self.pat_widgets_list:
widget.setVisible(False)
# test label widget for data set num paitients
qstr = QString( str( self.patnum ) )
self.pat_widgets_list[0].setText(QString( qstr ))
self.pat_widgets_list[0].setVisible(True)
for pat in range(1, self.patnum + 1):
#cbox = QCheckBox()
#self.layout().addWidget(cbox)
#self.pat_cbox_list.append(cbox)
self.pat_widgets_list[pat].setVisible(True)
# update checkbox widgets based on state of patient subset dictionary
# passed from active volume object
for pat in patdict.keys():
#self.pat_widgets_list[int(pat)].setVisible(True)
self.pat_widgets_list[int(pat)].setChecked(patdict[pat])
self.updateGeometry()
self.update()
def create_connections(self):
#for cbox in self.pat_widgets_list[1:]:
# cbox.stateChanged.connect(self._patientSelected)
self.pushbutton.pressed.connect(self._patientUpdate)
def _patientUpdate(self):
self._patientSelected()
av_key = self.parent().active_vol
if av_key is not None:
active_vol = self.parent()._vdata[av_key]
active_vol.updatePatientSubgroup(self.pat_sub_group)
active_vol.pat_sub_group = self.pat_sub_group
self.parent()._colorControlsDialog.setTFChart( self.parent()._vdata[av_key].chart )
'''
# update the new volume object
active_vol.xclip = xclip = cvol.xclip
active_vol.yclip = cvol.yclip
active_vol.zclip = cvol.zclip
active_vol.curr_statistic = cvol.curr_statistic
active_vol.picking_opacity =
'''
#.........这里部分代码省略.........
示例3: MainView
# 需要导入模块: from PyQt4.Qt import QPushButton [as 别名]
# 或者: from PyQt4.Qt.QPushButton import setCheckable [as 别名]
#.........这里部分代码省略.........
self.centralGridLayout.addWidget(self.voltageLabel, 2, 0, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.voltageString, 2, 1, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(hline2, 3, 0, 1, -1)
self.centralGridLayout.addWidget(self.currentLabel, 4, 0, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.currentString, 4, 1, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(hline3, 5, 0, 1, -1)
self.centralGridLayout.addWidget(self.frequencyLabel, 6, 0, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.frequencyString, 6, 1, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(hline4, 7, 0, 1, -1)
self.centralGridLayout.addWidget(vline1, 0, 2, -1, 1)
self.centralGridLayout.addWidget(self.activeEnergyLabel, 2, 3, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.activeEnergyString, 2, 4, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.apparentEnergyLabel, 4, 3, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.apparentEnergyString, 4, 4, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.reactiveEnergyLabel, 6, 3, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.reactiveEnergyString, 6, 4, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(vline2, 0, 5, -1, 1)
self.centralGridLayout.addWidget(self.activePowerLabel, 2, 6, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.activePowerString, 2, 7, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.apparentPowerLabel, 4, 6, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.apparentPowerString, 4, 7, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.reactivePowerLabel, 6, 6, 1, 1, QtCore.Qt.AlignLeft)
self.centralGridLayout.addWidget(self.reactivePowerString, 6, 7, 1, 1, QtCore.Qt.AlignLeft)
# self.centralGridLayout.addWidget(vline3, 0, 8, -1, 1)
# Buttons
self.startStopButton = QPushButton("START")
self.startStopButton.setFont(self.lcdStringFont)
buttonPolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.startStopButton.setSizePolicy(buttonPolicy)
self.startStopButton.clicked.connect(self.startStopClicked)
self.resetButton = QPushButton("RESET")
self.resetButton.setFont(self.lcdStringFont)
self.resetButton.setSizePolicy(buttonPolicy)
self.resetButton.clicked.connect(self.resetButtonClicked)
self.broadcastButton = QPushButton("BROADCAST")
self.broadcastButton.setFont(self.lcdStringFont)
self.broadcastButton.setSizePolicy(buttonPolicy)
self.broadcastButton.setCheckable(True)
self.broadcastButton.toggled.connect(self.broadcastButtonClicked)
self.centralGridLayout.addWidget(self.startStopButton, 8, 0, 1, 2)
self.centralGridLayout.addWidget(self.resetButton, 8, 3, 1, 2)
self.centralGridLayout.addWidget(self.broadcastButton, 8, 6, 1, 2)
# Status bar and show window
self.statusBar().showMessage('Ready')
self.setWindowTitle("ADE7753 Power Meter")
self.show()
# Button slots
def startStopClicked(self):
if(self._running):
self._running = False
self.startStopButton.setText("START")
self.startPressed.emit(False)
else:
self._running = True
self.startStopButton.setText("STOP")
self.startPressed.emit(True)
def resetButtonClicked(self):
self.resetPressed.emit()
def broadcastButtonClicked(self, s):
self.broadcastPressed.emit(s)
# Helper functions
def HLine(self):
line = QFrame()
line.setFrameStyle(QFrame.HLine)
line.setFrameShape(QFrame.HLine)
line.setFrameShadow(QFrame.Sunken)
return line
def VLine(self):
line = QFrame()
line.setFrameStyle(QFrame.VLine)
line.setFrameShape(QFrame.VLine)
line.setFrameShadow(QFrame.Sunken)
return line