本文整理汇总了Python中PySide.QtGui.QSpinBox.setValue方法的典型用法代码示例。如果您正苦于以下问题:Python QSpinBox.setValue方法的具体用法?Python QSpinBox.setValue怎么用?Python QSpinBox.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QSpinBox
的用法示例。
在下文中一共展示了QSpinBox.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SpinBoxPySlot
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
class SpinBoxPySlot(UsesQApplication, BasicPySlotCase):
"""Tests the connection of python slots to QSpinBox signals"""
def setUp(self):
super(SpinBoxPySlot, self).setUp()
self.spin = QSpinBox()
def tearDown(self):
del self.spin
super(SpinBoxPySlot, self).tearDown()
def testSpinBoxValueChanged(self):
"""Connection of a python slot to QSpinBox.valueChanged(int)"""
QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
self.args = [3]
self.spin.emit(SIGNAL('valueChanged(int)'), *self.args)
self.assert_(self.called)
def testSpinBoxValueChangedImplicit(self):
"""Indirect qt signal emission using QSpinBox.setValue(int)"""
QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
self.args = [42]
self.spin.setValue(self.args[0])
self.assert_(self.called)
def atestSpinBoxValueChangedFewArgs(self):
"""Emission of signals with fewer arguments than needed"""
# XXX: PyQt4 crashes on the assertRaises
QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
self.args = (554,)
self.assertRaises(TypeError, self.spin.emit, SIGNAL('valueChanged(int)'))
示例2: SpinBoxPySignal
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
class SpinBoxPySignal(UsesQApplication):
"""Tests the connection of python signals to QSpinBox qt slots."""
def setUp(self):
super(SpinBoxPySignal, self).setUp()
self.obj = Dummy()
self.spin = QSpinBox()
self.spin.setValue(0)
def tearDown(self):
super(SpinBoxPySignal, self).tearDown()
del self.obj
del self.spin
def testValueChanged(self):
"""Emission of a python signal to QSpinBox setValue(int)"""
QObject.connect(self.obj, SIGNAL('dummy(int)'), self.spin, SLOT('setValue(int)'))
self.assertEqual(self.spin.value(), 0)
self.obj.emit(SIGNAL('dummy(int)'), 4)
self.assertEqual(self.spin.value(), 4)
def testValueChangedMultiple(self):
"""Multiple emissions of a python signal to QSpinBox setValue(int)"""
QObject.connect(self.obj, SIGNAL('dummy(int)'), self.spin, SLOT('setValue(int)'))
self.assertEqual(self.spin.value(), 0)
self.obj.emit(SIGNAL('dummy(int)'), 4)
self.assertEqual(self.spin.value(), 4)
self.obj.emit(SIGNAL('dummy(int)'), 77)
self.assertEqual(self.spin.value(), 77)
示例3: setup_toolbar
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
def setup_toolbar(self):
color_widget = ColorWidget()
color_widget.color_changed.connect(self.fourier.on_color_change)
self.toolBar.addWidget(QLabel("Color:"))
self.toolBar.addWidget(color_widget)
self.toolBar.addWidget(QLabel("Shape:"))
size_spin = QSpinBox(self.toolBar)
size_spin.setValue(20)
size_spin.valueChanged[int].connect(self.fourier.on_size_change)
shape_combo = QComboBox(self.toolBar)
shape_combo.activated[str].connect(self.fourier.on_shape_change)
shape_combo.addItems(brush_shapes)
self.toolBar.addWidget(shape_combo)
self.toolBar.addWidget(size_spin)
self.toolBar.addWidget(QLabel("Symmetry:"))
x_sym = QCheckBox(self.toolBar)
x_sym.toggled.connect(self.fourier.on_x_toggle)
opp_sym = QCheckBox(self.toolBar)
opp_sym.toggled.connect(self.fourier.on_opp_toggle)
self.toolBar.addWidget(QLabel("X"))
self.toolBar.addWidget(x_sym)
y_sym = QCheckBox(self.toolBar)
y_sym.toggled.connect(self.fourier.on_y_toggle)
self.toolBar.addWidget(QLabel("Y"))
self.toolBar.addWidget(y_sym)
self.toolBar.addWidget(QLabel("Center"))
self.toolBar.addWidget(opp_sym)
示例4: DoubleInt
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
class DoubleInt(QDialog):
def __init__(self, cmd, parent=None, text_left='left', text_right='right',
default1=0, default2=0):
# cmd is a command which this dialog will call upon OKing.
# The arguments are cmd(i1, i2), the two chosen ints.
super(DoubleInt, self).__init__(parent)
self.tr = text_right
self.tl = text_left
self.i1 = 0
self.i2 = 0
self.default1 = default1
self.default2 = default2
self.cmd = cmd
self.initUI()
def initUI(self):
mainlay = QVBoxLayout()
btns = QHBoxLayout()
mainui = QGridLayout()
mainlay.addLayout(mainui)
mainlay.addLayout(btns)
ok = QPushButton('OK')
ok.clicked.connect(self.ok)
cancel = QPushButton('Cancel')
cancel.clicked.connect(self.close)
btns.addStretch()
btns.addWidget(ok)
btns.addWidget(cancel)
text1 = QLabel(self.tl)
text2 = QLabel(self.tr)
self.int1 = QSpinBox()
self.int1.setMaximum(2048)
self.int1.setMinimum(128)
self.int1.setValue(self.default1)
self.int2 = QSpinBox()
self.int2.setMaximum(2048)
self.int2.setMinimum(128)
self.int2.setValue(self.default2)
mainui.addWidget(text1, 0, 0)
mainui.addWidget(text2, 0, 1)
mainui.addWidget(self.int1, 1, 0)
mainui.addWidget(self.int2, 1, 1)
self.setLayout(mainlay)
self.setGeometry(340, 340, 200, 100)
self.setWindowTitle('MSH Suite - Double Integer')
self.show()
def ok(self):
self.i1 = int(self.int1.text())
self.i2 = int(self.int2.text())
self.cmd(self.i1, self.i2)
self.close()
示例5: testSpinButton
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
def testSpinButton(self):
#Connecting a lambda to a QPushButton.clicked()
obj = QSpinBox()
ctr = Control()
arg = 444
func = lambda x: setattr(ctr, 'arg', 444)
QObject.connect(obj, SIGNAL('valueChanged(int)'), func)
obj.setValue(444)
self.assertEqual(ctr.arg, arg)
QObject.disconnect(obj, SIGNAL('valueChanged(int)'), func)
示例6: AddWindow
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
class AddWindow(QDialog):
def __init__(self, parent=None):
super(AddWindow, self).__init__(parent)
self.setGeometry(QtCore.QRect(110, 40, 171, 160))
def initUi(self):
self.grid = QGridLayout()
self.grid.addWidget(QLabel("Connection name"), 0, 0)
self.grid.addWidget(QLabel("Username"), 2, 0)
self.grid.addWidget(QLabel("Password"), 4, 0)
self.grid.addWidget(QLabel("Hostname"), 6, 0)
self.grid.addWidget(QLabel("Port"), 8, 0)
self.connectionNameInput = QLineEdit(self)
self.grid.addWidget(self.connectionNameInput, 1, 0)
self.userNameInput = QLineEdit(self)
self.grid.addWidget(self.userNameInput, 3, 0)
self.passwordInput = QLineEdit(self)
self.grid.addWidget(self.passwordInput, 5, 0)
self.hostnameInput = QLineEdit(self)
self.grid.addWidget(self.hostnameInput, 7, 0)
self.portSpinBox = QSpinBox(self)
self.portSpinBox.setMinimum(1)
self.portSpinBox.setMaximum(65535)
self.portSpinBox.setValue(22)
self.grid.addWidget(self.portSpinBox, 9, 0)
self.addButton = QPushButton("Accept")
self.grid.addWidget(self.addButton, 10, 0)
self.setLayout(self.grid)
self.addButton.clicked.connect(self.clickedAddButton)
self.show()
@Slot()
def clickedAddButton(self):
dataRep = DataRepository()
host = self.hostnameInput.text()
port = self.portSpinBox.value()
pwd = self.passwordInput.text()
login = self.userNameInput.text()
name = self.connectionNameInput.text()
dataRep.addConnection({
'host':host,
'port':port,
'pwd':pwd,
'login':login,
'name':name
})
self.accept()
self.close()
def closeEvent(self, event):
event.accept()
示例7: createBinaryOptions
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
def createBinaryOptions(self):
"""
Binary Analysis Options
"""
groupBox = QtGui.QGroupBox('Binary Analysis')
# Elements
cbs_unique_str = QCheckBox('Show unique strings', self)
cbs_unique_com = QCheckBox('Show unique comments', self)
cbs_unique_calls = QCheckBox('Show unique calls', self)
cbs_entropy = QCheckBox('Calculate entropy', self)
cutoff_label = QLabel('Connect BB cutoff')
sb_cutoff = QSpinBox()
sb_cutoff.setRange(1, 40)
cutoff_func_label = QLabel('Connect functions cutoff')
sbf_cutoff = QSpinBox()
sbf_cutoff.setRange(1, 40)
# Default states are read from the Config
# class and reflected in the GUI
cbs_unique_str.setCheckState(
self.get_state(self.config.display_unique_strings))
cbs_unique_com.setCheckState(
self.get_state(self.config.display_unique_comments))
cbs_unique_calls.setCheckState(
self.get_state(self.config.display_unique_calls))
cbs_entropy.setCheckState(
self.get_state(self.config.calculate_entropy))
sb_cutoff.setValue(self.config.connect_bb_cutoff)
sbf_cutoff.setValue(self.config.connect_func_cutoff)
# Connect elements and signals
cbs_unique_str.stateChanged.connect(self.string_unique)
cbs_unique_com.stateChanged.connect(self.comment_unique)
cbs_unique_calls.stateChanged.connect(self.calls_unique)
cbs_entropy.stateChanged.connect(self.string_entropy)
sb_cutoff.valueChanged[int].connect(self.set_cutoff)
sb_cutoff.valueChanged[int].connect(self.set_func_cutoff)
vbox = QtGui.QVBoxLayout()
vbox.addWidget(cbs_unique_str)
vbox.addWidget(cbs_unique_com)
vbox.addWidget(cbs_unique_calls)
vbox.addWidget(cbs_entropy)
vbox.addWidget(cutoff_label)
vbox.addWidget(sb_cutoff)
vbox.addWidget(cutoff_func_label)
vbox.addWidget(sbf_cutoff)
vbox.addStretch(1)
groupBox.setLayout(vbox)
return groupBox
示例8: SliderWidget
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
class SliderWidget(QWidget):
"""
SliderWidget
"""
valueChanged = Signal(int)
def __init__(self):
super(SliderWidget, self).__init__()
self.label = QLabel()
self.slider = QSlider(Qt.Horizontal)
self.spinbox = QSpinBox()
self.slider.valueChanged.connect(self.changedValue)
self.spinbox.valueChanged.connect(self.changedValue)
layout = QGridLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setVerticalSpacing(0)
layout.addWidget(self.label, 0, 0)
layout.addWidget(self.slider, 0, 1)
layout.addWidget(self.spinbox, 0, 2)
self.setLayout(layout)
def setName(self, name):
"""
Set the name for the slider
"""
self.label.setText(name)
def setRange(self, range):
"""
Set the range for the value
"""
self.slider.setMinimum(range[0])
self.spinbox.setMinimum(range[0])
self.slider.setMaximum(range[1])
self.spinbox.setMaximum(range[1])
def setValue(self, value):
"""
Set the value for the slider and the spinbox
"""
self.slider.setValue(value)
self.spinbox.setValue(value)
def value(self):
return self.slider.value()
@Slot(int)
def changedValue(self, value):
self.setValue(value)
self.valueChanged.emit(value)
示例9: testSetValueIndirect
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
def testSetValueIndirect(self):
"""Indirect signal emission: QSpinBox using valueChanged(int)/setValue(int)"""
spinSend = QSpinBox()
spinRec = QSpinBox()
spinRec.setValue(5)
QObject.connect(spinSend, SIGNAL('valueChanged(int)'), spinRec, SLOT('setValue(int)'))
self.assertEqual(spinRec.value(), 5)
spinSend.setValue(3)
self.assertEqual(spinRec.value(), 3)
self.assertEqual(spinSend.value(), 3)
示例10: DoFPCompound
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
class DoFPCompound(QGroupBox):
def __init__(self, parent=None):
super(DoFPCompound, self).__init__(parent)
self.setTitle("doFP")
self.button_execute = QPushButton("Execute ...")
self.spinbox_iterations = QSpinBox()
self.spinbox_iterations.setMaximum(9999)
self.spinbox_iterations.setValue(200)
self.spinbox_iterations.setToolTip("No. iterations")
layout = QHBoxLayout()
layout.addWidget(self.spinbox_iterations)
layout.addWidget(self.button_execute)
self.setLayout(layout)
示例11: CreateSamplesRow
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
class CreateSamplesRow():
def __init__(self):
self.plate = QLineEdit()
self.parents = QSpinBox()
self.samples = QSpinBox()
self.loadedBy = QComboBox()
self.parents.setMaximum(8)
self.parents.setValue(2)
self.samples.setMaximum(96)
self.samples.setValue(94)
self.loadedBy.addItems(['Column','Row'])
def getPlate(self): return self.plate.text()
def getParents(self): return self.parents.value()
def getSamples(self): return self.samples.value()
def getLoadedBy(self): return self.loadedBy.currentText()
示例12: get_frame
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
def get_frame(self):
# Info stuff.
self.infos = {}
infogrp = QGroupBox('Scene Info')
grdlay = QGridLayout()
grdlay.addWidget(QLabel('<b>Name</b>'), 0, 0)
namebox = QLineEdit()
self.infos['name'] = namebox
namebox.setText(self.info.name)
rangebox1 = QSpinBox()
rangebox1.setMinimum(0)
rangebox1.setMaximum(1000)
self.infos['rangestart'] = rangebox1
rangebox1.setValue(self.info.frame_range[0])
rangebox2 = QSpinBox()
rangebox2.setMinimum(0)
rangebox2.setMaximum(1000)
self.infos['rangeend'] = rangebox2
rangebox2.setValue(self.info.frame_range[1])
fpsbox = QDoubleSpinBox()
self.infos['fps'] = fpsbox
fpsbox.setValue(self.info.fps)
bbox_btn = QPushButton('Bounding Box')
bbox_btn.clicked.connect(self.edit_bbox)
grdlay.addWidget(namebox, 0, 1)
grdlay.addWidget(QLabel('<b>StartFrame</b>'), 1, 0)
grdlay.addWidget(rangebox1, 1, 1)
grdlay.addWidget(QLabel('<b>EndFrame</b>'), 1, 2)
grdlay.addWidget(fpsbox, 0, 3)
grdlay.addWidget(rangebox2, 1, 3)
grdlay.addWidget(QLabel('<b>FPS</b>'), 0, 2)
grdlay.addWidget(bbox_btn, 2, 0)
grplay = QVBoxLayout()
grplay.addLayout(grdlay)
#grplay.addStretch()
infogrp.setLayout(grplay)
return infogrp
示例13: testSetValue
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
def testSetValue(self):
"""Direct signal emission: QSpinBox using valueChanged(int)/setValue(int)"""
spinSend = QSpinBox()
spinRec = QSpinBox()
spinRec.setValue(5)
spinSend.setValue(42)
QObject.connect(spinSend, SIGNAL('valueChanged(int)'), spinRec, SLOT('setValue(int)'))
self.assertEqual(spinRec.value(), 5)
self.assertEqual(spinSend.value(), 42)
spinSend.emit(SIGNAL('valueChanged(int)'), 3)
self.assertEqual(spinRec.value(), 3)
#Direct emission shouldn't change the value of the emitter
self.assertEqual(spinSend.value(), 42)
spinSend.emit(SIGNAL('valueChanged(int)'), 66)
self.assertEqual(spinRec.value(), 66)
self.assertEqual(spinSend.value(), 42)
示例14: NewMarkerDialog
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
class NewMarkerDialog(QDialog):
def __init__(self):
super(NewMarkerDialog, self).__init__()
self.setWindowTitle('Add new marker...')
newMarkerLabel = QLabel('Marker:')
self.newMarker = QLineEdit()
includeLabel = QLabel('Include all samples:')
self.includeAll = QCheckBox()
controlsLabel = QLabel('Control wells:')
self.controls = QSpinBox()
self.controls.setRange(0,8)
self.controls.setValue(2)
layout = QGridLayout()
layout.addWidget(newMarkerLabel,0,0)
layout.addWidget(self.newMarker,0,1)
layout.addWidget(includeLabel,1,0)
layout.addWidget(self.includeAll,1,1)
layout.addWidget(controlsLabel,2,0)
layout.addWidget(self.controls,2,1)
self.buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttons.accepted.connect(self.accept)
self.buttons.rejected.connect(self.reject)
layout.addWidget(self.buttons,100,0,1,2)
self.setLayout(layout)
def getMarker(self): return self.newMarker.text()
def getIncludeAll(self): return self.includeAll.isChecked()
def getControls(self): return self.controls.value()
@staticmethod
def run(parent = None):
dialog = NewMarkerDialog()
result = dialog.exec_()
newMarker = dialog.getMarker()
includeAll = dialog.getIncludeAll()
controls = dialog.getControls()
return (newMarker,includeAll,controls,result == QDialog.Accepted)
示例15: OptionsContainer
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setValue [as 别名]
class OptionsContainer(QWidget):
def __init__(self,main_window):
QWidget.__init__(self)
self.main_window = main_window
self.layout = QGridLayout()
self.setLayout(self.layout)
self.lr = numpy.zeros(2)
self.fps = QSpinBox()
self.fps.setValue(25)
self.fps.setMinimum(1)
self.fps.setMaximum(1000)
self.layout.addWidget(QLabel("FPS:"),10,10)
self.layout.addWidget(self.fps,10,11)
self.capture_area_group = QButtonGroup()
self.capture_area_fs = QRadioButton("Full Screen")
self.connect(self.capture_area_fs, SIGNAL("clicked()"),self.capture_area_change)
self.capture_area_fs.setChecked(True)
self.capture_area_sa = QRadioButton("Selected Area")
self.connect(self.capture_area_sa, SIGNAL("clicked()"),self.capture_area_change)
self.capture_area_group.addButton(self.capture_area_fs)
self.capture_area_group.addButton(self.capture_area_sa)
self.capture_area_group.setExclusive(True)
self.layout.addWidget(self.capture_area_fs,12,10)
self.layout.addWidget(self.capture_area_sa,12,11)
self.sa_group = QGroupBox()
self.sa_grid = QGridLayout()
self.sa_group.setLayout(self.sa_grid)
self.sa_ul_bt = QPushButton("Select Upper Left")
self.connect(self.sa_ul_bt, SIGNAL("clicked()"), self.select_ul)
self.sa_lr_bt = QPushButton("Select Lower Right")
self.connect(self.sa_lr_bt, SIGNAL("clicked()"), self.select_lr)
self.sa_x = QSpinBox()
self.sa_y = QSpinBox()
self.sa_w = QSpinBox()
self.sa_h = QSpinBox()
for sb in [self.sa_h,self.sa_w,self.sa_x,self.sa_y]:
sb.setMaximum(999999)
sb.setMinimum(0)
self.sa_grid.addWidget(self.sa_ul_bt,14,10,1,1)
self.sa_grid.addWidget(self.sa_lr_bt,15,10,1,1)
self.sa_grid.addWidget(QLabel("x"),14,11,1,1)
self.sa_grid.addWidget(self.sa_x,14,12,1,1)
self.sa_grid.addWidget(QLabel("y"),15,11,1,1)
self.sa_grid.addWidget(self.sa_y,15,12,1,1)
self.sa_grid.addWidget(QLabel("w"),16,11,1,1)
self.sa_grid.addWidget(self.sa_w,16,12,1,1)
self.sa_grid.addWidget(QLabel("h"),17,11,1,1)
self.sa_grid.addWidget(self.sa_h,17,12,1,1)
self.sa_show_bt = QPushButton("Show Area")
self.sa_show_bt.setCheckable(True)
self.connect(self.sa_show_bt, SIGNAL("clicked()"), self.show_selected_area)
self.sa_grid.addWidget(self.sa_show_bt,18,10,1,10)
self.sa_group.hide()
self.layout.addWidget(self.sa_group,14,10,1,10)
self.capture_delay = QSpinBox()
self.capture_delay.setMinimum(0)
self.capture_delay.setMaximum(10000)
self.layout.addWidget(QLabel("Capture Delay"),18,10,1,1)
self.layout.addWidget(self.capture_delay,18,11,1,1)
self.capture_bt = QPushButton("Capture")
self.stop_capture_bt = QPushButton("Stop")
self.stop_capture_bt.hide()
self.layout.addWidget(self.capture_bt,20,10,1,10)
self.layout.addWidget(self.stop_capture_bt,30,10,1,10)
self.ffmpeg_flags = QLineEdit()
self.ffmpeg_flags.setText("-qscale 0 -vcodec mpeg4")
self.layout.addWidget(QLabel("FFMPEG Flags:"),40,10)
self.layout.addWidget(self.ffmpeg_flags,50,10,1,10)
self.encode_bt = QPushButton("Encode Video")
self.layout.addWidget(self.encode_bt,60,10,1,10)
self.open_dir_bt = QPushButton("Open Directory")
self.layout.addWidget(self.open_dir_bt,80,10,1,10)
self.connect(self.open_dir_bt, SIGNAL("clicked()"),self.open_cwd)
self.selected_area = SelectedArea()
def show_selected_area(self):
x = self.sa_x.value()
y = self.sa_y.value()
#.........这里部分代码省略.........