本文整理汇总了Python中PySide.QtGui.QCheckBox.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python QCheckBox.setToolTip方法的具体用法?Python QCheckBox.setToolTip怎么用?Python QCheckBox.setToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QCheckBox
的用法示例。
在下文中一共展示了QCheckBox.setToolTip方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ExchangeView
# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox 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)
#.........这里部分代码省略.........
示例2: ConfigDialog
# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setToolTip [as 别名]
#.........这里部分代码省略.........
self.datacleared = True
self.QtGui = QtGui
self.error = error
if sys.platform.startswith('linux'):
resourcespath = utils.findWorkingDir() + "/resources/"
else:
resourcespath = utils.findWorkingDir() + "\\resources\\"
self.resourcespath = resourcespath
super(ConfigDialog, self).__init__()
self.setWindowTitle(getMessage("en", "config-window-title"))
self.setWindowFlags(self.windowFlags() & Qt.WindowCloseButtonHint & ~Qt.WindowContextHelpButtonHint)
self.setWindowIcon(QtGui.QIcon(resourcespath + "syncplay.png"))
if(config['host'] == None):
host = ""
elif(":" in config['host']):
host = config['host']
else:
host = config['host'] + ":" + str(config['port'])
self.connectionSettingsGroup = QtGui.QGroupBox(getMessage("en", "connection-group-title"))
self.hostTextbox = QLineEdit(host, self)
self.hostLabel = QLabel(getMessage("en", "host-label"), self)
self.usernameTextbox = QLineEdit(config['name'], self)
self.serverpassLabel = QLabel(getMessage("en", "password-label"), self)
self.defaultroomTextbox = QLineEdit(config['room'], self)
self.usernameLabel = QLabel(getMessage("en", "username-label"), self)
self.serverpassTextbox = QLineEdit(config['password'], self)
self.defaultroomLabel = QLabel(getMessage("en", "room-label"), self)
if (constants.SHOW_TOOLTIPS == True):
self.hostLabel.setToolTip(getMessage("en", "host-tooltip"))
self.hostTextbox.setToolTip(getMessage("en", "host-tooltip"))
self.usernameLabel.setToolTip(getMessage("en", "username-tooltip"))
self.usernameTextbox.setToolTip(getMessage("en", "username-tooltip"))
self.serverpassLabel.setToolTip(getMessage("en", "password-tooltip"))
self.serverpassTextbox.setToolTip(getMessage("en", "password-tooltip"))
self.defaultroomLabel.setToolTip(getMessage("en", "room-tooltip"))
self.defaultroomTextbox.setToolTip(getMessage("en", "room-tooltip"))
self.connectionSettingsLayout = QtGui.QGridLayout()
self.connectionSettingsLayout.addWidget(self.hostLabel, 0, 0)
self.connectionSettingsLayout.addWidget(self.hostTextbox, 0, 1)
self.connectionSettingsLayout.addWidget(self.serverpassLabel, 1, 0)
self.connectionSettingsLayout.addWidget(self.serverpassTextbox, 1, 1)
self.connectionSettingsLayout.addWidget(self.usernameLabel, 2, 0)
self.connectionSettingsLayout.addWidget(self.usernameTextbox, 2, 1)
self.connectionSettingsLayout.addWidget(self.defaultroomLabel, 3, 0)
self.connectionSettingsLayout.addWidget(self.defaultroomTextbox, 3, 1)
self.connectionSettingsGroup.setLayout(self.connectionSettingsLayout)
self.mediaplayerSettingsGroup = QtGui.QGroupBox(getMessage("en", "media-setting-title"))
self.executableiconImage = QtGui.QImage()
self.executableiconLabel = QLabel(self)
self.executableiconLabel.setMinimumWidth(16)
self.executablepathCombobox = QtGui.QComboBox(self)
self.executablepathCombobox.setEditable(True)
self.executablepathCombobox.currentIndexChanged.connect(self.updateExecutableIcon)
self.executablepathCombobox.setEditText(self._tryToFillPlayerPath(config['playerPath'], playerpaths))
self.executablepathCombobox.setMinimumWidth(200)
self.executablepathCombobox.setMaximumWidth(200)
self.executablepathCombobox.editTextChanged.connect(self.updateExecutableIcon)
self.executablepathLabel = QLabel(getMessage("en", "executable-path-label"), self)
示例3: DataBrowser
# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setToolTip [as 别名]
class DataBrowser(QWidget, Ui_DataBrowser):
"""
@since: 2011-08-24
"""
__author__ = "Moritz Wade"
__contact__ = "[email protected]"
__copyright__ = "Zuse Institute Berlin 2011"
def __init__(self, parent, id, dataSet):
super(DataBrowser, self).__init__(parent)
self.setupUi(self)
self._simWorkbench = None
self.dataService = None
self.id = id
self.data = dataSet
self.optionsService = OptionsService()
# create the custom selectable table header
self.selectableHeader = SelectableTableHeader(Qt.Horizontal, self.tableView)
self.selectableHeader.setNonSelectableIndexes([0])
self.selectableHeader.sectionSelectionChanged.connect(self.on_columnSelectionChanged)
self.tableView.setHorizontalHeader(self.selectableHeader)
# create the data model
self.dataModel = DataBrowserModel(self, self.id, self.data)
self.tableView.setModel(self.dataModel)
self._setUpSelectionCheckBox()
self._updateInfoPane()
if not self.optionsService.getDebug():
self.groupBoxPerturbation.setVisible(False)
def getId(self):
return self.id
def setSimulationWorkbench(self, simWorkbench):
self._simWorkbench = simWorkbench
def getSelectionCheckBox(self):
return self._selectionCheckBox
def isSelected(self):
checkState = self._selectionCheckBox.checkState()
return True if checkState == Qt.Checked else False
def _setUpSelectionCheckBox(self):
self._selectionCheckBox = QCheckBox()
self._selectionCheckBox.setChecked(True)
infoText = "Select or deselect this data (e.g. to be included in plots and computations)."
self._selectionCheckBox.setStatusTip(infoText)
self._selectionCheckBox.setToolTip(infoText)
self._selectionCheckBox.stateChanged.connect(self._selectionChanged)
def _updateInfoPane(self):
"""
Updates the info pane with basic info about the loaded data
and the data file (if any).
"""
self.lineEditInfoSpecies.setText(str(self.data.getNumOfRealData()))
self.lineEditInfoDataType.setText(self.data.type)
# self.lineEditInfoFormat.setText(self.data.format)
filepath = self.data.filename
if filepath and os.path.exists(filepath):
self.lineEditInfoPath.setText(filepath)
filesize = os.path.getsize(filepath)
filesize = filesize / 1024 # displaying kB
self.lineEditInfoFilesize.setText("%s kB" % filesize)
timeLastModifiedEpoch = os.path.getmtime(filepath)
timeLastModified = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(timeLastModifiedEpoch))
self.lineEditInfoLastModified.setText(str(timeLastModified))
else:
noFileText = "No File"
self.lineEditInfoPath.setText(noFileText)
self.lineEditInfoFilesize.setText(noFileText)
self.lineEditInfoLastModified.setText(noFileText)
def remove(self):
"""
Cleans up stuff then destroys self.
It's not sure whether this is really needed
but it might serve to close some memory holes
(e.g. dangling references somewhere).
"""
del self.dataModel
del self
#.........这里部分代码省略.........
示例4: ConfigDialog
# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setToolTip [as 别名]
#.........这里部分代码省略.........
from syncplay import utils
self.config = config
self.QtGui = QtGui
self.error = error
if sys.platform.startswith('linux'):
resourcespath = utils.findWorkingDir() + "/resources/"
else:
resourcespath = utils.findWorkingDir() + "\\resources\\"
super(ConfigDialog, self).__init__()
self.setWindowTitle(getMessage("en", "config-window-title"))
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
self.setWindowIcon(QtGui.QIcon(resourcespath + "syncplay.png"))
if(config['host'] == None):
host = ""
elif(":" in config['host']):
host = config['host']
else:
host = config['host']+":"+str(config['port'])
self.connectionSettingsGroup = QtGui.QGroupBox(getMessage("en", "connection-group-title"))
self.hostTextbox = QLineEdit(host, self)
self.hostLabel = QLabel(getMessage("en", "host-label"), self)
self.usernameTextbox = QLineEdit(config['name'],self)
self.serverpassLabel = QLabel(getMessage("en", "password-label"), self)
self.defaultroomTextbox = QLineEdit(config['room'],self)
self.usernameLabel = QLabel(getMessage("en", "username-label"), self)
self.serverpassTextbox = QLineEdit(config['password'],self)
self.defaultroomLabel = QLabel(getMessage("en", "room-label"), self)
if (constants.SHOW_TOOLTIPS == True):
self.hostLabel.setToolTip(getMessage("en", "host-tooltip"))
self.hostTextbox.setToolTip(getMessage("en", "host-tooltip"))
self.usernameLabel.setToolTip(getMessage("en", "username-tooltip"))
self.usernameTextbox.setToolTip(getMessage("en", "username-tooltip"))
self.serverpassLabel.setToolTip(getMessage("en", "password-tooltip"))
self.serverpassTextbox.setToolTip(getMessage("en", "password-tooltip"))
self.defaultroomLabel.setToolTip(getMessage("en", "room-tooltip"))
self.defaultroomTextbox.setToolTip(getMessage("en", "room-tooltip"))
self.connectionSettingsLayout = QtGui.QGridLayout()
self.connectionSettingsLayout.addWidget(self.hostLabel, 0, 0)
self.connectionSettingsLayout.addWidget(self.hostTextbox, 0, 1)
self.connectionSettingsLayout.addWidget(self.serverpassLabel, 1, 0)
self.connectionSettingsLayout.addWidget(self.serverpassTextbox, 1, 1)
self.connectionSettingsLayout.addWidget(self.usernameLabel, 2, 0)
self.connectionSettingsLayout.addWidget(self.usernameTextbox, 2, 1)
self.connectionSettingsLayout.addWidget(self.defaultroomLabel, 3, 0)
self.connectionSettingsLayout.addWidget(self.defaultroomTextbox, 3, 1)
self.connectionSettingsGroup.setLayout(self.connectionSettingsLayout)
self.mediaplayerSettingsGroup = QtGui.QGroupBox(getMessage("en", "media-setting-title"))
self.executablepathCombobox = QtGui.QComboBox(self)
self.executablepathCombobox.setEditable(True)
self.executablepathCombobox.setEditText(self._tryToFillPlayerPath(config['playerPath'],playerpaths))
self.executablepathCombobox.setMinimumWidth(200)
self.executablepathCombobox.setMaximumWidth(200)
self.executablepathLabel = QLabel(getMessage("en", "executable-path-label"), self)
self.executablebrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'),getMessage("en", "browse-label"))
self.executablebrowseButton.clicked.connect(self.browsePlayerpath)
self.mediapathTextbox = QLineEdit(config['file'], self)
self.mediapathLabel = QLabel(getMessage("en", "media-path-label"), self)
self.mediabrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'),getMessage("en", "browse-label"))
self.mediabrowseButton.clicked.connect(self.browseMediapath)
示例5: ScaleView
# 需要导入模块: from PySide.QtGui import QCheckBox [as 别名]
# 或者: from PySide.QtGui.QCheckBox import setToolTip [as 别名]
class ScaleView(QGroupBox):
'''The box containing the rate value'''
def __init__(self, title = 'Window Limits', parent = None):
'''Initialize'''
super(ScaleView, self).__init__(parent)
self.setTitle(title)
self._createWidgets()
def _createWidgets(self):
'''Create the widgets contained in this box'''
# The three choosers
self.xmin = QLineEdit(self)
self.xmin.setToolTip(ttt('The lower limit of the plot, in '
'wavenumbers'))
self.xmax = QLineEdit(self)
self.xmax.setToolTip(ttt('The upper limit of the plot, in '
'wavenumbers'))
self.reverse = QCheckBox("Reverse Limits", self)
self.reverse.setToolTip(ttt('Display plot with higher frequencies on '
'the left, not the right'))
# Set validators for limits
self.xmin.setValidator(QIntValidator(300, 3000, self.xmin))
self.xmax.setValidator(QIntValidator(300, 3000, self.xmax))
# The wavelength selection
self.wavenum = QLineEdit(' ')
self.wavenum.setReadOnly(True)
self.intense = QLineEdit(' ')
self.intense.setReadOnly(True)
def initUI(self):
'''Lays out the widgets'''
total = QHBoxLayout()
total.addWidget(QLabel("Wavenum: "))
total.addWidget(self.wavenum)
total.addWidget(QLabel("Intens.: "))
total.addWidget(self.intense)
total.addWidget(QLabel("Lower Limit"))
total.addWidget(self.xmin)
total.addStretch()
total.addWidget(self.reverse)
total.addStretch()
total.addWidget(QLabel("Upper Limit"))
total.addWidget(self.xmax)
self.setLayout(total)
def makeConnections(self):
'''Connect the widgets together'''
# If any changes happen, reset the scale
self.xmin.editingFinished.connect(self.resetScale)
self.xmax.editingFinished.connect(self.resetScale)
self.reverse.clicked.connect(self.resetScale)
def setModel(self, model):
'''Attaches models to the views'''
self.model = model
def setValue(self, xmin, xmax, reversed):
'''Manually sets the values that are viewed'''
self.xmin.setText(str(xmin))
self.xmax.setText(str(xmax))
self.reverse.setChecked(reversed)
self.reverse.clicked.emit()
#######
# SLOTS
#######
def resetScale(self):
'''Checks that the given scale is valid, then resets if so'''
try:
xmin = int(self.xmin.text())
except ValueError:
return
try:
xmax = int(self.xmax.text())
except ValueError:
return
reverse = self.reverse.isChecked()
if xmin > xmax:
err = "Lower limit cannot be greater than upper limit"
error.showMessage(err)
return
self.model.setScale(xmin, xmax, reverse)
def setSelection(self, x, y):
'''Displays the current selection'''
x = max(min(x, float(self.xmax.text())),
float(self.xmin.text()))
y = max(min(y, 1.0), 0.0)
self.wavenum.setText('{0:.1f}'.format(x))
self.intense.setText('{0:.3f}'.format(y))