本文整理汇总了Python中PySide.QtGui.QComboBox.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python QComboBox.setToolTip方法的具体用法?Python QComboBox.setToolTip怎么用?Python QComboBox.setToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QComboBox
的用法示例。
在下文中一共展示了QComboBox.setToolTip方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SimpleComboboxOption
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setToolTip [as 别名]
class SimpleComboboxOption(SimpleOption):
def __init__(self, settingsName, labelText, defaultValue, checkable=False, *options):
self.options = options
super(SimpleComboboxOption,self).__init__(settingsName, labelText, defaultValue, checkable)
def editor(self, defaultValue):
#options = ('Uniform','Exponential','Normal','Log Normal')
options = self.options
self.combo = QComboBox()
self.combo.addItems(options)
self.combo.setCurrentIndex(int(QSettings().value(self.settingsName, defaultValue)))
self.combo.setToolTip('Default value: %s' % defaultValue)
#self.combo.setAlignment(Qt.AlignLeft|Qt.AlignTop)
self.layout().addWidget(self.combo)
def setEnabled(self, e):
self.combo.setEnabled(e)
def getValue(self):
return self.combo.currentIndex()
def getName(self):
return self.combo.currentText()
示例2: create_combobox
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setToolTip [as 别名]
def create_combobox(self, text, choices, option, default=NoDefault,
tip=None):
"""choices: couples (name, key)"""
label = QLabel(text)
combobox = QComboBox()
if tip is not None:
combobox.setToolTip(tip)
# combobox.setEditable(True)
for name, key in choices:
combobox.addItem(name, key) # to_qvariant(key))
self.comboboxes[option] = combobox
layout = QHBoxLayout()
for subwidget in (label, combobox):
layout.addWidget(subwidget)
layout.addStretch(1)
layout.setContentsMargins(0, 0, 0, 0)
widget = QWidget(self)
widget.setLayout(layout)
return widget
示例3: ExchangeView
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setToolTip [as 别名]
class ExchangeView(QGroupBox):
'''The box containing the rate value'''
def __init__(self, title = 'Peak Exchange Matrix', parent = None):
'''Initialize'''
super(ExchangeView, self).__init__(parent)
self.setTitle(title)
self._createWidgets()
def _createWidgets(self):
'''Create the widgets contained in this box'''
# Peak number chooser
self.numpeaks = [QRadioButton("2"),
QRadioButton("3"),
QRadioButton("4")]
self.numpeaks[0].setToolTip(ttt('Model the exchange of 2 peaks'))
self.numpeaks[1].setToolTip(ttt('Model the exchange of 3 peaks'))
self.numpeaks[2].setToolTip(ttt('Model the exchange of 4 peaks'))
# Make 4x4 matrix of QLabels
self.exview = [[QLabel(self) for i in xrange(4)] for j in xrange(4)]
for i in xrange(4):
for e in self.exview[i]:
e.setToolTip(ttt('The current exchange matrix'))
# Enforce symmetry button
self.symmetry = QCheckBox("Enforce Symmetry", self)
self.symmetry.setToolTip(ttt('If symmetry is on then you only need to '
'manually set the upper triangle of the '
'exchange matrix. Thse values are '
'mirrored '
'in the lower triangle and the diagonals '
'are automatically set so that each row '
'sums to 1. '
'Otherwise you must set every element'))
# Exchange picker
self.exchooser = QComboBox(self)
self.exchooser.setToolTip(ttt('Choose between which two peaks to set '
'the exchange (relative) rate'))
# Exchange value
self.exvalue = QLineEdit(self)
self.exvalue.setToolTip(ttt('The exchange (relative) rate'))
self.exvalue.setValidator(QDoubleValidator(0.0, 1.0, 3, self.exvalue))
def makeConnections(self):
'''Connect the widgets together'''
# When the table has been resized, tidy it up
self.matrix.matrixChanged.connect(self.resetMatrix)
# If the check state changed, change the data model
self.symmetry.stateChanged.connect(self.changeDataModel)
self.numpeaks[0].clicked.connect(self.changeDataModel)
self.numpeaks[1].clicked.connect(self.changeDataModel)
self.numpeaks[2].clicked.connect(self.changeDataModel)
# Attach the chooser to an exchange rate
self.exchooser.currentIndexChanged.connect(self.attachExchange)
# If the exchange rate is changed, update the matrix
self.exvalue.editingFinished.connect(self.newExchange)
def initUI(self):
'''Lays out the widgets'''
nums = QHBoxLayout()
nums.addWidget(QLabel("Number of Peaks: "))
nums.addWidget(self.numpeaks[0])
nums.addWidget(self.numpeaks[1])
nums.addWidget(self.numpeaks[2])
val = QHBoxLayout()
val.addWidget(QLabel("Exchange: "))
val.addStretch()
val.addWidget(self.exchooser)
self.exvalue.setMaximumWidth(50)
val.addWidget(self.exvalue)
ex = QGridLayout()
for i in xrange(4):
for j in xrange(4):
ex.addWidget(self.exview[i][j], i+1, j+1)
lo = QVBoxLayout()
lo.addLayout(nums)
lo.addWidget(self.symmetry)
lo.addLayout(val)
lo.addLayout(ex)
self.setLayout(lo)
def setModel(self, model, npmodel):
'''Attaches models to the views.'''
self.matrix = model
self.npmodel = npmodel
def setNumPeaks(self, npeaks):
'''Manually set the number of peaks'''
if npeaks == 2:
self.numpeaks[0].click()
elif npeaks == 3:
self.numpeaks[1].click()
elif npeaks == 4:
self.numpeaks[2].click()
else:
error.showMessage('Only valid number of peaks is 2, 3, or 4')
def setMatrixSymmetry(self, sym):
'''Manually set the matrix symmetry'''
self.symmetry.setChecked(sym)
#.........这里部分代码省略.........
示例4: AnimMungeDialog
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setToolTip [as 别名]
class AnimMungeDialog(QDialog):
types = ['FirstPerson/Soldier',
'Prop/Vehicle']
types2 = {'FirstPerson/Soldier': '/comp_debug 0 /debug',
'Prop/Vehicle': '/specialquathack'}
def __init__(self, files, main, parent=None):
super(AnimMungeDialog, self).__init__(parent)
self.outd = os.getcwd() + '\\munge\\output'
self.ind = os.getcwd() + '\\munge\\input'
self.files = files
self.clear_input_files()
self.clear_output_files()
for filename in self.files:
shutil.copy(filename, self.ind)
self.initUI()
def munge(self):
self.statlabel.setText('<b>AnimMunging</b>')
params = self.types2[self.type_box.currentText()]
add_params = ''
if self.add_params.text() != 'Additional Params':
add_params = ' {0}'.format(self.add_params.text())
if self.bf1mode.isChecked():
os.system(os.getcwd() + '\\zenasset1.exe /multimsh /src {0}{1} /keepframe0 {2} /dest {3}\\{4}.zaf'.format(self.ind, add_params, params, self.outd, self.animname.text()))
os.system(os.getcwd() + '\\binmunge1.exe -inputfile munge\\output\\*.zaa -chunkid zaa_ -ext zaabin -outputdir {1}\\'.format(self.outd, self.outd))
os.system(os.getcwd() + '\\binmunge1.exe -inputfile munge\\output\\*.zaf -chunkid zaf_ -ext zafbin -outputdir {1}\\'.format(self.outd, self.outd))
else:
os.system(os.getcwd() + '\\zenasset.exe /multimsh /writefiles /src {0}{1} /keepframe0 {2} /dest {3}\\{4}.zaf'.format(self.ind, add_params, params, self.outd, self.animname.text()))
os.system(os.getcwd() + '\\binmunge.exe -inputfile munge\\output\\*.zaa -chunkid zaa_ -ext zaabin -outputdir {1}'.format(self.outd, self.outd))
os.system(os.getcwd() + '\\binmunge.exe -inputfile munge\\output\\*.zaf -chunkid zaf_ -ext zafbin -outputdir {1}'.format(self.outd, self.outd))
self.clear_byproduct()
files = []
for filename in os.listdir(self.outd):
files.append(filename)
self.outfiles.addItems(files)
self.statlabel.setText('<b>AnimMunged</b>')
def initUI(self):
grp = QGroupBox('Anim Munge')
grplay = QGridLayout()
self.bf1mode = QCheckBox()
grplay.addWidget(QLabel('<b>SWBF1</b>'), 0, 1)
grplay.addWidget(self.bf1mode, 0, 2)
grplay.addWidget(QLabel('<b>Input</b>'), 1, 1)
grplay.addWidget(QLabel('<b>Output</b>'), 1, 3)
self.infiles = QListWidget()
self.infiles.setMinimumWidth(150)
self.infiles.addItems([os.path.basename(item) for item in self.files])
grplay.addWidget(self.infiles, 2, 1, 1, 2)
self.outfiles = QListWidget()
self.outfiles.setMinimumWidth(150)
grplay.addWidget(self.outfiles, 2, 3, 1, 2)
self.add_params = QLineEdit()
self.add_params.setText('Additional Params')
self.add_params.setToolTip('<b>Additional Munge Parameters.</b> Like scale 1.5')
grplay.addWidget(self.add_params, 0, 3, 1, 2)
self.statlabel = QLabel('<b>AnimMunger</b>')
grplay.addWidget(self.statlabel, 4, 1, 1, 1)
self.animname = QLineEdit()
self.animname.setText('AnimName')
self.animname.setToolTip('<b>Animation Name.</b> Name of the final animation files. IE: name.zafbin, name.zaabin, name.anims.')
grplay.addWidget(self.animname, 3, 1)
self.type_box = QComboBox()
self.type_box.addItems(self.types)
self.type_box.setToolTip('<b>Munge Mode.</b> This switches munge parameters.')
grplay.addWidget(QLabel('<b>Munge Mode:</b>'), 3, 2)
grplay.addWidget(self.type_box, 3, 3, 1, 2)
munge_btn = QPushButton('Munge')
munge_btn.clicked.connect(self.munge)
munge_btn.setToolTip('<b>Munge.</b> Munges the input files with the selected mode.')
grplay.addWidget(munge_btn, 4, 2)
save_out = QPushButton('Save')
save_out.clicked.connect(self.save)
save_out.setToolTip('<b>Save.</b> Saves the output files.')
grplay.addWidget(save_out, 4, 3)
cancel_btn = QPushButton('Cancel')
cancel_btn.clicked.connect(self.cancel)
cancel_btn.setToolTip('<b>Cancel.</b> Closes the dialog and removes all temporary files.')
grplay.addWidget(cancel_btn, 4, 4)
grp.setLayout(grplay)
mainlay = QVBoxLayout()
mainlay.addWidget(grp)
self.setLayout(mainlay)
self.setGeometry(340, 340, 320, 300)
self.setWindowTitle('MSH Suite - Animation Munge')
self.show()
def save(self):
filepath = QFileDialog.getExistingDirectory(self, 'Select .MSH', os.getcwd())
for filename in os.listdir(self.outd):
shutil.copy(os.path.join(self.outd, filename), filepath)
self.cancel()
def cancel(self):
self.statlabel.setText('<b>AnimSeeYa</b>')
#.........这里部分代码省略.........
示例5: RateView
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setToolTip [as 别名]
class RateView(QGroupBox):
'''The box containing the rate value'''
def __init__(self, title = 'Rate', parent = None):
'''Initialize'''
super(RateView, self).__init__(parent)
self.setTitle(title)
self._createWidgets()
def _createWidgets(self):
'''Create the widgets contained in this box'''
# Rate or lifetime chooser
self.rate = QRadioButton('Rate', self)
self.rate.setToolTip(ttt('Choose this to express exchange as rate'))
self.lifetime = QRadioButton('Lifetime', self)
self.lifetime.setToolTip(ttt('Choose this to express exchange as '
'lifetime'))
# Box containing value
self.rate_value = QLineEdit(self)
validate = QDoubleValidator(self.rate_value)
validate.setDecimals(3)
validate.setBottom(0.0)
self.rate_value.setValidator(validate)
self.rate_value.setToolTip(ttt('The rate or lifetime value'))
# Unit
self.unit = QComboBox(self)
self.unit.setToolTip(ttt('Selects the input unit for the rate '
'or lifetime'))
def initUI(self):
'''Lays out the widgets'''
radios = QVBoxLayout()
radios.addWidget(self.rate)
radios.addWidget(self.lifetime)
rate = QGridLayout()
rate.addWidget(QLabel("Unit: "), 1, 1)
rate.addWidget(self.unit, 1, 2)
rate.addWidget(QLabel("Value: "), 2, 1)
rate.addWidget(self.rate_value, 2, 2)
total = QHBoxLayout()
total.addLayout(radios)
total.addStretch()
total.addLayout(rate)
self.setLayout(total)
def makeConnections(self):
'''Connect the widgets together'''
# When one radio button is checked, change the combo box model
# and un-check the other radio button
self.rate.clicked.connect(self.setRateModel)
self.lifetime.clicked.connect(self.setLifetimeModel)
# If the text changes, emit that rate
self.rate_value.editingFinished.connect(self.emitRate)
# If the underlying model changes, adjust the text
self.model.rateChanged.connect(self.updateRate)
# If the unit changes, update rate
self.unit.currentIndexChanged.connect(self.updateUnit)
def setModel(self, model):
'''Attaches models to the views'''
self.model = model
def setRate(self, rate):
'''Set the rate manually'''
self.rate_value.setText(str(rate))
self.rate_value.editingFinished.emit()
def setUnit(self, unit):
'''Set the unit manually'''
if unit == 's':
self.lifetime.click()
self.unit.setCurrentIndex(0)
elif unit == 'ns':
self.lifetime.click()
self.unit.setCurrentIndex(1)
elif unit == 'ps':
self.lifetime.click()
self.unit.setCurrentIndex(2)
elif unit == 'fs':
self.lifetime.click()
self.unit.setCurrentIndex(3)
elif unit in ('Hz', 'hz'):
self.rate.click()
self.unit.setCurrentIndex(0)
elif unit in ('GHz', 'ghz'):
self.rate.click()
self.unit.setCurrentIndex(1)
elif unit in ('THz', 'thz'):
self.rate.click()
self.unit.setCurrentIndex(2)
elif unit in ('PHz', 'phz'):
self.rate.click()
self.unit.setCurrentIndex(3)
#.........这里部分代码省略.........
示例6: ExportPdfOptionDialog
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setToolTip [as 别名]
class ExportPdfOptionDialog(QDialog):
"""
Displays options UI for the PDF
"""
def __init__(self, parent = None):
if not parent:
parent = hiero.ui.mainWindow()
super(ExportPdfOptionDialog, self).__init__(parent)
layout = QFormLayout()
self._fileNameField = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter='*.pdf')
self._fileNameField.setFilename(os.path.join(os.getenv('HOME'), "Desktop", "Sequence.pdf"))
self._pdfLayoutDropdown = QComboBox()
self._pdfLayoutDropdown.setToolTip("Set the PDF page layout type.")
self._thumbFrameTypeDropdown = QComboBox()
self._thumbFrameTypeDropdown.setToolTip("Set which frame to take the thumbnail from.")
self._buttonbox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
self._buttonbox.accepted.connect(self.accept)
self._buttonbox.rejected.connect(self.reject)
self._pdfLayouts = PDFExporter.PAGE_LAYOUTS_DICT
self._thumbFrameTypes = PDFExporter.THUMB_FRAME_TYPES
for pdfLayout in sorted(self._pdfLayouts, reverse=True):
self._pdfLayoutDropdown.addItem(pdfLayout)
for frameType in self._thumbFrameTypes:
self._thumbFrameTypeDropdown.addItem(frameType)
layout.addRow("Save to:", self._fileNameField)
layout.addRow("PDF Layout:", self._pdfLayoutDropdown)
layout.addRow("Thumbnail Frame:", self._thumbFrameTypeDropdown)
layout.addRow("", self._buttonbox)
self.setLayout(layout)
self.setWindowTitle("Export PDF Options")
self.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )
def _thumbnailFrameType(self):
"""Returns the currently selected thumbnail frame type"""
return self._thumbFrameTypeDropdown.currentText()
def _numRows(self):
"""Returns the number of rows for the pdf"""
optionText = self._pdfLayoutDropdown.currentText()
return self._pdfLayouts[optionText][0]
def _numColumns(self):
"""Returns the number of columns for the pdf"""
optionText = self._pdfLayoutDropdown.currentText()
return self._pdfLayouts[optionText][1]
def _filePath(self):
"""Returns the filepath for the pdf"""
filename = self._fileNameField.filename()
if not filename.endswith('.pdf'):
filename = filename + ".pdf"
return filename