本文整理汇总了Python中PySide.QtGui.QSpinBox.setMinimum方法的典型用法代码示例。如果您正苦于以下问题:Python QSpinBox.setMinimum方法的具体用法?Python QSpinBox.setMinimum怎么用?Python QSpinBox.setMinimum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QSpinBox
的用法示例。
在下文中一共展示了QSpinBox.setMinimum方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_spinbox
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [as 别名]
def create_spinbox(self, prefix, suffix, option, default=NoDefault,
min_=None, max_=None, step=None, tip=None):
if prefix:
plabel = QLabel(prefix)
else:
plabel = None
if suffix:
slabel = QLabel(suffix)
else:
slabel = None
spinbox = QSpinBox()
if min_ is not None:
spinbox.setMinimum(min_)
if max_ is not None:
spinbox.setMaximum(max_)
if step is not None:
spinbox.setSingleStep(step)
if tip is not None:
spinbox.setToolTip(tip)
self.spinboxes[option] = spinbox
layout = QHBoxLayout()
for subwidget in (plabel, spinbox, slabel):
if subwidget is not None:
layout.addWidget(subwidget)
layout.addStretch(1)
layout.setContentsMargins(0, 0, 0, 0)
widget = QWidget(self)
widget.setLayout(layout)
return widget
示例2: DoubleInt
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [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()
示例3: SliderWidget
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [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)
示例4: AddWindow
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [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()
示例5: get_frame
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [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
示例6: _add_my_ships
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [as 别名]
def _add_my_ships(self):
""" Adds shipyards from a dict to the table.
*Must* be called after (or by) add_shipyards_for(), since that's what
sets self.shipyards which this method depends on.
"""
row = 0
delete_buttons = {}
for ship in sorted( self.ships, key=operator.attrgetter('type') ):
### Image
lbl_icon = QLabel()
img_bldg = QPixmap(":/" + ship.type + ".png").scaled(self.img_w, self.img_w, Qt.KeepAspectRatio)
lbl_icon.setPixmap(img_bldg)
### Type
itm_type = QTableWidgetItem(ship.type)
### Num to build
build_spinner = QSpinBox()
build_spinner.setMinimum(0)
build_spinner.valueChanged.connect( self._spinner_updated )
self.widget.insertRow(row)
self.widget.setCellWidget(row, 0, lbl_icon)
self.widget.setItem(row, 1, itm_type)
self.widget.setCellWidget(row, 2, build_spinner)
row +=1
示例7: initUI
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [as 别名]
def initUI(self):
grp = QGroupBox('Transform')
grplay = QGridLayout()
# Translation
grplay.addWidget(QLabel('<b>Translation</b>'), 0, 0)
trax = QDoubleSpinBox()
trax.setMinimum(-10000)
trax.setMaximum(10000)
trax.setValue(self.tran.translation[0])
self.controls['trax'] = trax
grplay.addWidget(trax, 0, 1)
tray = QDoubleSpinBox()
tray.setMinimum(-10000)
tray.setMaximum(10000)
tray.setValue(self.tran.translation[1])
self.controls['tray'] = tray
grplay.addWidget(tray, 0, 2)
traz = QDoubleSpinBox()
traz.setMinimum(-10000)
traz.setMaximum(10000)
traz.setValue(self.tran.translation[2])
self.controls['traz'] = traz
grplay.addWidget(traz, 0, 3)
# Rotation.
grplay.addWidget(QLabel('<b>Rotation</b>'), 1, 0)
rotx = QSpinBox()
rotx.setMinimum(-10000)
rotx.setMaximum(10000)
#rotx.setText(str(self.tran.euler_angles()[0]))
traz.setValue(self.tran.euler_angles()[0])
self.controls['rotx'] = rotx
grplay.addWidget(rotx, 1, 1)
roty = QSpinBox()
roty.setMinimum(-10000)
roty.setMaximum(10000)
#roty.setText(str(self.tran.euler_angles()[1]))
traz.setValue(self.tran.euler_angles()[1])
self.controls['roty'] = roty
grplay.addWidget(roty, 1, 2)
rotz = QSpinBox()
rotz.setMinimum(-10000)
rotz.setMaximum(10000)
#rotz.setText(str(self.tran.euler_angles()[2]))
traz.setValue(self.tran.euler_angles()[2])
self.controls['rotz'] = rotz
grplay.addWidget(rotz, 1, 3)
# Scale.
grplay.addWidget(QLabel('<b>Scale</b>'), 2, 0)
sclx = QDoubleSpinBox()
sclx.setMinimum(-10000)
sclx.setMaximum(10000)
sclx.setValue(self.tran.scale[0])
self.controls['sclx'] = sclx
grplay.addWidget(sclx, 2, 1)
scly = QDoubleSpinBox()
scly.setMinimum(-10000)
scly.setMaximum(10000)
scly.setValue(self.tran.scale[1])
self.controls['scly'] = scly
grplay.addWidget(scly, 2, 2)
sclz = QDoubleSpinBox()
sclz.setMinimum(-10000)
sclz.setMaximum(10000)
sclz.setValue(self.tran.scale[2])
self.controls['sclz'] = sclz
grplay.addWidget(sclz, 2, 3)
grp.setLayout(grplay)
# Buttons.
save_btn = QPushButton('Save')
save_btn.clicked.connect(self.save)
cancel_btn = QPushButton('Cancel')
cancel_btn.clicked.connect(self.close)
btns = QHBoxLayout()
btns.addStretch()
btns.addWidget(save_btn)
btns.addWidget(cancel_btn)
# Main Layout.
mainlay = QVBoxLayout()
mainlay.addWidget(grp)
mainlay.addLayout(btns)
mainlay.addStretch()
self.setLayout(mainlay)
self.setGeometry(340, 340, 400, 100)
self.setWindowTitle('MSH Suite - Edit BBox')
self.show()
示例8: initUI
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [as 别名]
def initUI(self):
grp = QGroupBox('Material')
grplay = QGridLayout()
name = QLineEdit()
name.setText(self.mat.name)
self.controls['name'] = name
tex0 = QLineEdit()
tex0.setText(self.mat.tex0)
self.controls['tex0'] = tex0
tex1 = QLineEdit()
tex1.setText(self.mat.tex1)
self.controls['tex1'] = tex1
tex2 = QLineEdit()
tex2.setText(self.mat.tex2)
self.controls['tex2'] = tex2
tex3 = QLineEdit()
tex3.setText(self.mat.tex3)
self.controls['tex3'] = tex3
flags = QGroupBox('Flags')
fllay = QGridLayout()
for ind, flag in enumerate(self.mat.flags):
fllay.addWidget(QLabel(self.pretty_flags[flag[0]]), ind, 0)
box = QCheckBox()
fllay.addWidget(box, ind, 1)
if flag[1]:
box.toggle()
self.controls[flag[0]] = box
fllay.addWidget(QLabel('<b>RenderType</b>'), 8, 0)
numbox = QComboBox()
numbox.addItems(self.render_types)
numbox.setCurrentIndex(self.mat.render_type)
fllay.addWidget(numbox)
self.controls['render_type'] = numbox
fllay.addWidget(QLabel('<b>Data0</b>'), 9, 0)
d0 = QSpinBox()
d0.setValue(self.mat.data0)
d0.setMinimum(0)
d0.setMaximum(255)
fllay.addWidget(d0)
self.controls['data0'] = d0
fllay.addWidget(QLabel('<b>Data1</b>'), 10, 0)
d1 = QSpinBox()
d1.setValue(self.mat.data1)
d1.setMinimum(0)
d1.setMaximum(255)
fllay.addWidget(d1)
self.controls['data1'] = d1
flags.setLayout(fllay)
colors = QGroupBox('Colors')
collay = QGridLayout()
self.add_color('<b>Diffuse</b>', self.mat.diff_color, collay, 3)
self.add_color('<b>Specular</b>', self.mat.spec_color, collay, 4)
self.add_color('<b>Ambient</b>', self.mat.ambt_color, collay, 5)
colors.setLayout(collay)
grplay.addWidget(QLabel('<b>Name</b>'), 0, 0)
grplay.addWidget(name, 0, 1)
grplay.addWidget(QLabel('<b>Texture0</b>'), 1, 0)
grplay.addWidget(tex0, 1, 1)
grplay.addWidget(QLabel('<b>Texture1</b>'), 1, 2)
grplay.addWidget(tex1, 1, 3)
grplay.addWidget(QLabel('<b>Texture2</b>'), 2, 0)
grplay.addWidget(tex2, 2, 1)
grplay.addWidget(QLabel('<b>Texture3</b>'), 2, 2)
grplay.addWidget(tex3, 2, 3)
grplay.addWidget(QLabel('<b>Gloss</b>'), 3, 0)
gloss = QDoubleSpinBox()
gloss.setValue(self.mat.gloss)
grplay.addWidget(gloss, 3, 1)
self.controls['gloss'] = gloss
grplay.addWidget(colors, 4, 0, 1, 5)
grplay.addWidget(flags, 5, 0, 1, 3)
grp.setLayout(grplay)
btns = QHBoxLayout()
save = QPushButton('Save')
save.clicked.connect(self.save)
cancel = QPushButton('Cancel')
cancel.clicked.connect(self.close)
#.........这里部分代码省略.........
示例9: OptionsContainer
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [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()
#.........这里部分代码省略.........
示例10: optdlg
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [as 别名]
class optdlg(QDialog):
def __init__(self, parent=None):
super(optdlg, self).__init__(parent)
self.setFixedSize(484, 399)
appicom = QIcon(":/icons/njnlogo.png")
self.setWindowIcon(appicom)
self.setWindowTitle("Nigandu English to Tamil Dictionary | OPTIONS")
self.buttonBox = QDialogButtonBox(self)
self.buttonBox.setEnabled(True)
self.buttonBox.setGeometry(QRect(350, 20, 121, 200))
self.buttonBox.setOrientation(Qt.Vertical)
self.buttonBox.setStandardButtons(QDialogButtonBox.Apply|QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
self.buttonBox.setCenterButtons(True)
self.restorebtn = QPushButton(self)
self.restorebtn.setGeometry(QRect(354, 360, 121, 23))
self.restorebtn.setText("&RestoreDefults")
self.fontbox = QGroupBox(self)
self.fontbox.setGeometry(QRect(10, 10, 331, 141))
self.spinBox = QSpinBox(self.fontbox)
self.spinBox.setGeometry(QRect(100, 20, 81, 21))
self.spinBox.setMinimum(10)
self.spinBox.setMaximum(24)
self.label = QLabel(self.fontbox)
self.label.setGeometry(QRect(20, 20, 71, 21))
self.label.setText("Font Size:")
self.fontbox.setTitle("Font")
self.samplefontbox = QGroupBox(self)
self.samplefontbox.setGeometry(QRect(20, 50, 291, 91))
self.samplefontbox.setTitle("Sample Text")
self.sampletxt = QLabel(self.samplefontbox)
self.sampletxt.setGeometry(QRect(20, 20, 251, 61))
self.sampletxt.setText("AaBbCcDdEeFfGgHhIiJjKkLlYyZz")
self.clipbox = QGroupBox(self)
self.clipbox.setGeometry(QRect(10, 160, 331, 61))
self.clipbox.setTitle("ClipBoard Options")
self.checkclip = QCheckBox(self.clipbox)
self.checkclip.setGeometry(QRect(20, 20, 301, 31))
self.checkclip.setText("Allow copy from clipboard on start-up")
self.histbox = QGroupBox(self)
self.histbox.setGeometry(QRect(10, 230, 331, 91))
self.histbox.setTitle("History")
self.checkshowhistdock = QCheckBox(self.histbox)
self.checkshowhistdock.setGeometry(QRect(20, 60, 301, 17))
self.checkshowhistdock.setText("Show History Dock on the right side")
self.checkdelhist = QCheckBox(self.histbox)
self.checkdelhist.setGeometry(QRect(20, 30, 301, 17))
self.checkdelhist.setText("Clear all the past history records")
self.bkmbox = QGroupBox(self)
self.bkmbox.setGeometry(QRect(10, 330, 331, 61))
self.bkmbox.setTitle("Book Marks")
self.checkshowbkmdock = QCheckBox(self.bkmbox)
self.checkshowbkmdock.setGeometry(QRect(20, 30, 301, 17))
self.checkshowbkmdock.setText("Show Book Marks Dock on the right side.")
self.spinBox.valueChanged[int].connect(self.setsampletxt)
self.restorebtn.clicked.connect(self.setdeafults)
self.buttonBox.rejected.connect(self.close)
def setdeafults(self):
self.spinBox.setValue(13)
self.checkshowhistdock.setChecked(True)
self.checkshowbkmdock.setChecked(True)
self.checkclip.setChecked(True)
self.checkdelhist.setChecked(False)
def setsampletxt(self, i):
font = QFont()
font.setPixelSize(i)
self.sampletxt.setFont(font)
示例11: Ui_MainWindow
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [as 别名]
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
lbMinWidth = 65
# leMinWidth = 200
MainWindow.setObjectName("MainWindow")
MainWindow.resize(400, 310)
# self.centralwidget = QWidget(MainWindow)
self.mainSplitter = QSplitter(Qt.Horizontal, MainWindow)
self.mainSplitter.setObjectName("centralwidget")
self.mainSplitter.setProperty("childrenCollapsible", False)
MainWindow.setCentralWidget(self.mainSplitter)
self.leftSplitter = QSplitter(Qt.Vertical, self.mainSplitter)
self.leftSplitter.setProperty("childrenCollapsible", False)
##### login_gbox
self.login_gbox = QGroupBox(self.leftSplitter)
self.login_gbox.setFlat(True)
self.login_gbox.setObjectName("login_gbox")
login_gbox_layout = QVBoxLayout(self.login_gbox)
login_gbox_csf_layout = QHBoxLayout()
login_gbox_account_layout = QHBoxLayout()
login_gbox_connect_layout = QHBoxLayout()
login_gbox_layout.addLayout(login_gbox_csf_layout)
login_gbox_layout.addLayout(login_gbox_account_layout)
login_gbox_layout.addLayout(login_gbox_connect_layout)
self.lb_client_secrets_file_path = QLabel(self.login_gbox)
self.lb_client_secrets_file_path.setObjectName("lb_client_secrets_file_path")
self.lb_client_secrets_file_path.setMinimumWidth(lbMinWidth)
self.client_secrets_file_path_le = QLineEdit(self.login_gbox)
self.client_secrets_file_path_le.setObjectName("client_secrets_file_path_le")
self.client_secret_file_path_tBtn = QToolButton(self.login_gbox)
self.client_secret_file_path_tBtn.setObjectName("client_secret_file_path_tBtn")
login_gbox_csf_layout.addWidget(self.lb_client_secrets_file_path)
login_gbox_csf_layout.addWidget(self.client_secrets_file_path_le)
login_gbox_csf_layout.addWidget(self.client_secret_file_path_tBtn)
self.lb_account = QLabel(self.login_gbox)
self.lb_account.setMaximumWidth(lbMinWidth)
self.lb_account.setObjectName("lb_account")
self.remove_account_btn = QToolButton(self.login_gbox)
self.remove_account_btn.setObjectName("remove_account_btn")
self.remove_account_btn.setMinimumWidth(20)
self.remove_account_btn.setEnabled(False)
self.add_account_btn = QToolButton(self.login_gbox)
self.add_account_btn.setObjectName("add_account_btn")
self.add_account_btn.setMinimumWidth(20)
self.accounts_cb = QComboBox(self.login_gbox)
self.accounts_cb.setObjectName("accounts_cb")
login_gbox_account_layout.addWidget(self.lb_account)
login_gbox_account_layout.addWidget(self.remove_account_btn)
login_gbox_account_layout.addWidget(self.add_account_btn)
login_gbox_account_layout.addWidget(self.accounts_cb)
self.lb_decryption_key = QLabel(self.login_gbox)
self.lb_decryption_key.setObjectName("lb_decryption_key")
self.lb_decryption_key.setMinimumWidth(lbMinWidth)
self.lb_decryption_key.hide()
self.decryption_key_le = QLineEdit(self.login_gbox)
self.decryption_key_le.setEchoMode(QLineEdit.Password)
self.decryption_key_le.setObjectName("decryption_key_le")
self.decryption_key_le.hide()
self.connect_btn = QPushButton(self.login_gbox)
self.connect_btn.setEnabled(False)
self.connect_btn.setObjectName("connect_btn")
login_gbox_connect_layout.addWidget(self.lb_decryption_key)
login_gbox_connect_layout.addWidget(self.decryption_key_le)
login_gbox_connect_layout.addWidget(self.connect_btn)
#### search_gbox
self.search_gbox = QGroupBox(self.leftSplitter)
self.search_gbox.setFlat(True)
self.search_gbox.setObjectName("search_gbox")
self.search_gbox.hide()
search_gbox_layout = QVBoxLayout(self.search_gbox)
search_gbox_mailbox_layout = QVBoxLayout()
search_gbox_date_layout = QHBoxLayout()
search_gbox_from_layout = QHBoxLayout()
search_gbox_to_layout = QHBoxLayout()
search_gbox_subject_layout = QHBoxLayout()
search_gbox_threads_layout = QHBoxLayout()
search_gbox_paramaters_layout = QHBoxLayout()
search_gbox_layout.addLayout(search_gbox_mailbox_layout)
search_gbox_layout.addLayout(search_gbox_date_layout)
#.........这里部分代码省略.........
示例12: PushupForm
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [as 别名]
class PushupForm(QDialog):
'''
classdocs
'''
pushupCreated = Signal(Pushup_Model)
def __init__(self, athlete):
'''
Constructor
'''
QDialog.__init__(self)
self.setWindowTitle("Pushup form")
self.athlete = athlete
self.pushupForm = QFormLayout()
self.createGUI()
def createGUI(self):
self.series = QSpinBox()
self.series.setMinimum(1)
self.repetitions = QSpinBox()
self.repetitions.setMaximum(512)
self.avgHeartRateToggle = QCheckBox()
self.avgHeartRateToggle.toggled.connect(self._toggleHeartRateSpinBox)
self.avgHeartRate = QSpinBox()
self.avgHeartRate.setMinimum(30)
self.avgHeartRate.setMaximum(250)
self.avgHeartRate.setValue(120)
self.avgHeartRate.setDisabled(True)
self.dateSelector_widget = QCalendarWidget()
self.dateSelector_widget.setMaximumDate(QDate.currentDate())
self.addButton = QPushButton("Add pushup")
self.addButton.setMaximumWidth(90)
self.addButton.clicked.connect(self._createPushup)
self.cancelButton = QPushButton("Cancel")
self.cancelButton.setMaximumWidth(90)
self.cancelButton.clicked.connect(self.reject)
self.pushupForm.addRow("Series", self.series)
self.pushupForm.addRow("Repetitions", self.repetitions)
self.pushupForm.addRow("Store average heart rate ? ", self.avgHeartRateToggle)
self.pushupForm.addRow("Average Heart Rate", self.avgHeartRate)
self.pushupForm.addRow("Exercise Date", self.dateSelector_widget)
btnsLayout = QVBoxLayout()
btnsLayout.addWidget(self.addButton)
btnsLayout.addWidget(self.cancelButton)
btnsLayout.setAlignment(Qt.AlignRight)
layoutWrapper = QVBoxLayout()
layoutWrapper.addLayout(self.pushupForm)
layoutWrapper.addLayout(btnsLayout)
self.setLayout(layoutWrapper)
def _createPushup(self):
exerciseDate = self.dateSelector_widget.selectedDate()
exerciseDate = self.qDate_to_date(exerciseDate)
if self.avgHeartRateToggle.isChecked():
heartRate = self.avgHeartRate.value()
else:
heartRate = None
pushup = Pushup_Model(self.athlete._name,
exerciseDate,
heartRate,
self.series.value(),
self.repetitions.value())
self.pushupCreated.emit(pushup)
self.accept()
def _toggleHeartRateSpinBox(self):
if self.avgHeartRateToggle.isChecked():
self.avgHeartRate.setDisabled(False)
else:
self.avgHeartRate.setDisabled(True)
def qDate_to_date(self, qDate):
return date(qDate.year(), qDate.month(),qDate.day())
示例13: init_UI
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import setMinimum [as 别名]
def init_UI(self):
lay = QGridLayout()
lay.addWidget(QLabel('<b>Position</b>'), 0, 0, 1, 4)
posx = QDoubleSpinBox()
posx.setValue(self.v.x)
self.controls['posx'] = posx
posy = QDoubleSpinBox()
posy.setValue(self.v.y)
self.controls['posy'] = posy
posz = QDoubleSpinBox()
posz.setValue(self.v.z)
self.controls['posz'] = posz
lay.addWidget(posx, 1, 0)
lay.addWidget(posy, 1, 1)
lay.addWidget(posz, 1, 2)
lay.addWidget(QLabel('<b>Normal</b>'), 2, 0, 1, 4)
norx = QDoubleSpinBox()
norx.setValue(self.v.nx)
self.controls['norx'] = norx
nory = QDoubleSpinBox()
nory.setValue(self.v.ny)
self.controls['nory'] = nory
norz = QDoubleSpinBox()
norz.setValue(self.v.nz)
self.controls['norz'] = norz
lay.addWidget(norx, 3, 0)
lay.addWidget(nory, 3, 1)
lay.addWidget(norz, 3, 2)
lay.addWidget(QLabel('<b>Texture Coordinates</b>'), 4, 0, 1, 4)
u = QDoubleSpinBox()
u.setValue(self.v.u)
self.controls['u'] = u
v = QDoubleSpinBox()
v.setValue(self.v.v)
self.controls['v'] = v
lay.addWidget(u, 5, 0)
lay.addWidget(v, 5, 1)
lay.addWidget(QLabel('<b>Color</b>'), 6, 0, 1, 4)
red = QSpinBox()
red.setMinimum(0)
red.setMaximum(255)
red.setValue(self.v.color.red)
self.controls['red'] = red
green = QSpinBox()
green.setMinimum(0)
green.setMaximum(255)
green.setValue(self.v.color.green)
self.controls['green'] = green
blue = QSpinBox()
blue.setMinimum(0)
blue.setMaximum(255)
blue.setValue(self.v.color.blue)
self.controls['blue'] = blue
alpha = QSpinBox()
alpha.setMinimum(0)
alpha.setMaximum(255)
alpha.setValue(self.v.color.alpha)
self.controls['alpha'] = alpha
lay.addWidget(red, 7, 0)
lay.addWidget(green, 7, 1)
lay.addWidget(blue, 7, 2)
lay.addWidget(alpha, 7, 3)
grp = QGroupBox('Vertex')
grp.setLayout(lay)
btns = QVBoxLayout()
save = QPushButton('Save')
save.clicked.connect(self.save)
cancel = QPushButton('Cancel')
cancel.clicked.connect(self.close)
btns.addStretch()
btns.addWidget(save)
btns.addWidget(cancel)
mainlay = QHBoxLayout()
mainlay.addWidget(grp)
mainlay.addLayout(btns)
#.........这里部分代码省略.........