本文整理汇总了Python中PySide.QtGui.QComboBox.findText方法的典型用法代码示例。如果您正苦于以下问题:Python QComboBox.findText方法的具体用法?Python QComboBox.findText怎么用?Python QComboBox.findText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QComboBox
的用法示例。
在下文中一共展示了QComboBox.findText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import findText [as 别名]
class AccountToolbarSection:
""" The Account Toolbar section """
def __init__(self, toolbar, table_view):
""" Initialize the Account Toolbar Section """
self.toolbar = toolbar
self.table_view = table_view
def addAccount(self):
""" Add Account Label and Combo Box to the UI """
label = QLabel("Account: ", self.toolbar)
self.toolbar.addWidget(label)
self.accountComboBox = QComboBox(self.toolbar)
UpdateComboBoxWithAccounts(self.accountComboBox)
self.accountComboBox.activated.connect(self.setAccount)
index = self.accountComboBox.findText(self.table_view.account.name)
if not index == -1:
self.accountComboBox.setCurrentIndex(index)
self.toolbar.addWidget(self.accountComboBox)
def setAccount(self, index):
""" Set the Transaction Account to view """
account = Accounts.all()[index]
self.table_view.updateTransactions(account=account)
self.toolbar.buildToolbarWidgets()
def tabSelected(self):
""" Update the Account Tab when the tab is selected """
text = self.accountComboBox.currentText()
UpdateComboBoxWithAccounts(self.accountComboBox)
index = self.accountComboBox.findText(text)
if not (index == -1):
self.accountComboBox.setCurrentIndex(index)
示例2: LCRow
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import findText [as 别名]
class LCRow():
def __init__(self,fileName,experimentName,guess):
self.fileName = QLabel(fileName)
self.plateID = QLineEdit()
self.experiment = QLineEdit()
self.guess = QLabel(guess[0] + ', ' + guess[1])
self.robot = QComboBox()
self.platePosition = QComboBox()
self.plateID.setText(path.splitext(path.basename(fileName))[0])
self.experiment.setText(experimentName)
self.robot.addItems(['2000','FX','96'])
self.robot.setCurrentIndex(self.robot.findText(guess[0]))
self.platePosition.addItems(['Plate 0','Plate 1','Plate 2','Plate 3','Plate 4'])
self.platePosition.setCurrentIndex(self.platePosition.findText(guess[1]))
def getFileName(self): return self.fileName.text()
def getPlateID(self): return self.plateID.text()
def getExperiment(self): return self.experiment.text()
def getRobot(self): return self.robot.currentText()
def getPlatePosition(self): return self.platePosition.currentIndex()
示例3: RenderParameterWidget
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import findText [as 别名]
class RenderParameterWidget(QWidget):
"""
RenderParameterWidget is a widget that is shown in the render property
widget. It holds a combo box with which different visualizations can be
chosen. Beneath the combo box it displays a widget in a scroll view that
contains widgets with which parameters of the visualization can be adjusted.
"""
def __init__(self, renderController, parent=None):
super(RenderParameterWidget, self).__init__(parent=parent)
self.renderController = renderController
self.renderController.visualizationChanged.connect(self.visualizationLoaded)
self.paramWidget = None
self.visTypeComboBox = QComboBox()
for visualizationType in self.renderController.visualizationTypes:
self.visTypeComboBox.addItem(visualizationType)
layout = QGridLayout()
layout.setAlignment(Qt.AlignTop)
layout.setSpacing(10)
layout.setContentsMargins(10, 0, 10, 0)
if len(self.renderController.visualizationTypes) > 1:
layout.addWidget(QLabel("Visualization type:"), 0, 0)
layout.addWidget(self.visTypeComboBox, 0, 1)
self.setLayout(layout)
self.scrollArea = QScrollArea()
self.scrollArea.setFrameShape(QFrame.NoFrame)
self.scrollArea.setAutoFillBackground(False)
self.scrollArea.setAttribute(Qt.WA_TranslucentBackground)
self.scrollArea.setWidgetResizable(True)
self.visTypeComboBox.currentIndexChanged.connect(self.visTypeComboBoxChanged)
def UpdateWidgetFromRenderWidget(self):
"""
Update the parameter widget with a widget from the render widget.
"""
# Add the scroll area for the parameter widget if it is not there yet
layout = self.layout()
if layout.indexOf(self.scrollArea) == -1:
layout.addWidget(self.scrollArea, 1, 0, 1, 2)
self.setLayout(layout)
# Clear the previous parameter widget
if self.paramWidget is not None:
self.paramWidget.setParent(None)
if self.renderController.visualization is not None:
self.renderController.visualization.disconnect(SIGNAL("updatedTransferFunction"), self.transferFunctionChanged)
# Get a new parameter widget from the render widget
self.paramWidget = self.renderController.getParameterWidget()
Style.styleWidgetForTab(self.paramWidget)
self.scrollArea.setWidget(self.paramWidget)
if self.renderController.visualization is not None:
self.renderController.visualization.updatedTransferFunction.connect(self.transferFunctionChanged)
self.visTypeComboBox.setCurrentIndex(self.visTypeComboBox.findText(self.renderController.visualizationType))
@Slot(int)
def visTypeComboBoxChanged(self, index):
"""
Slot that changes the render type. Also updates parameters and makes
sure that the renderWidget renders with the new visualizationType.
:type index: any
"""
self.renderController.setVisualizationType(self.visTypeComboBox.currentText())
self.UpdateWidgetFromRenderWidget()
self.renderController.updateVisualization()
def visualizationLoaded(self, visualization):
self.UpdateWidgetFromRenderWidget()
@Slot()
def transferFunctionChanged(self):
"""
Slot that can be used when a transfer function has changed so that
the render will be updated afterwards.
Should be called on valueChanged by the widgets from the parameter widget.
"""
self.renderController.updateVisualization()
示例4: TransferPanel
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import findText [as 别名]
#.........这里部分代码省略.........
self.showMaximized()
# Open the Logbook
if file is not None:
self._openLogbook(file)
def _writeSettings(self):
'Write settings to the configuration'
settings = QSettings()
settings.beginGroup('MainWindow')
settings.setValue('pos', self.pos())
settings.setValue('size', self.size())
settings.setValue('max', self.isMaximized())
settings.setValue('file', self._logbookPath)
settings.endGroup()
def closeEvent(self, e):
'Intercept an OnClose event'
self._writeSettings()
e.accept()
#--------------------------------------------------------------------------
# Slots
@QtCore.Slot()
def _btnAddComputerClicked(self):
'Add a Dive Computer'
dc = AddDiveComputerWizard.RunWizard(self)
if dc is not None:
self._logbook.session.add(dc)
self._logbook.session.commit()
self._cbxComputer.model().reload()
self._cbxComputer.setCurrentIndex(self._cbxComputer.findText(dc.name))
@QtCore.Slot()
def _btnRemoveComputerClicked(self):
'Remove a Dive Computer'
idx = self._cbxComputer.currentIndex()
dc = self._cbxComputer.itemData(idx, Qt.UserRole+0)
if QMessageBox.question(self, self.tr('Delete Dive Computer?'),
self.tr('Are you sure you want to delete "%s"?') % dc.name,
QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) == QMessageBox.Yes:
self._logbook.session.delete(dc)
self._logbook.session.commit()
self._cbxComputer.model().reload()
@QtCore.Slot()
def _btnBrowseClicked(self):
'Browse for a Logbook File'
if self._logbook is not None:
dir = os.path.dirname(self._logbookPath)
else:
dir = os.path.expanduser('~')
fn = QFileDialog.getOpenFileName(self,
caption=self.tr('Select a Logbook file'), dir=dir,
filter='Logbook Files (*.lbk);;All Files(*.*)')[0]
if fn == '':
return
if not os.path.exists(fn):
if QMessageBox.question(self, self.tr('Create new Logbook?'),
self.tr('Logbook "%s" does not exist. Would you like to create it?') % os.path.basename(fn),
QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) != QMessageBox.Yes:
return
Logbook.Create(fn)
示例5: AnyIMU_window
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import findText [as 别名]
class AnyIMU_window(QMainWindow):
def __init__(self, parent=None):
super(AnyIMU_window, self).__init__(parent)
self.setWindowTitle('AnyIMU')
self.resize(450, 700)
os.system('cls')
self.dcm = DCM()
self.accDataCurr = None
self.gyrDataCurr = None
self.magDataCurr = None
self.barDataCurr = None
self.serialThread = None
self.skipDataCount = 5
# The plot widget
self.accPlotWidget = SensorDisplay(name='Accelerometer')
self.gyrPlotWidget = SensorDisplay(name='Gyroscope')
self.magPlotWidget = SensorDisplay(name='Magnetometer')
self.barPlotWidget = SensorDisplay(name='Barometer')
self.accPlotWidget.addPlot(fillLevelIn=0, brushIn=(200,0,0,100), penIn=(255,0,0), dataType='int', dataName='X')
self.accPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,200,0,100), penIn=(0,255,0), dataType='int', dataName='Y')
self.accPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,0,200,100), penIn=(0,0,255), dataType='int', dataName='Z')
self.gyrPlotWidget.addPlot(fillLevelIn=0, brushIn=(200,0,0,100), penIn=(255,0,0), dataType='int', dataName='X')
self.gyrPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,200,0,100), penIn=(0,255,0), dataType='int', dataName='Y')
self.gyrPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,0,200,100), penIn=(0,0,255), dataType='int', dataName='Z')
self.magPlotWidget.addPlot(fillLevelIn=0, brushIn=(200,0,0,100), penIn=(255,0,0), dataType='int', dataName='X')
self.magPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,200,0,100), penIn=(0,255,0), dataType='int', dataName='Y')
self.magPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,0,200,100), penIn=(0,0,255), dataType='int', dataName='Z')
self.barPlotWidget.addPlot(fillLevelIn=0, brushIn=(200,0,0,100), penIn=(255,0,0), dataType='float', dataName='TEMP')
self.barPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,200,0,100), penIn=(0,255,0), dataType='float', dataName='PRS')
self.barPlotWidget.addPlot(fillLevelIn=0, brushIn=(0,0,200,100), penIn=(0,0,255), dataType='float', dataName='ALT')
# the main layout and widgets
self.mainWidget = QWidget()
self.setCentralWidget(self.mainWidget)
self.mainLayout = QGridLayout()
self.mainWidget.setLayout(self.mainLayout)
connectionLayout = QHBoxLayout()
# widgets
serialLab = QLabel('Serial Port:')
self.serialLine = QLineEdit('COM3')
self.serialLine.setFixedWidth(100)
baudRateLab = QLabel('Baud Rate:')
self.baudRateCombo = QComboBox()
for baud in [300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200]: self.baudRateCombo.addItem(str(baud))
default = self.baudRateCombo.findText('9600')
self.baudRateCombo.setCurrentIndex(default)
self.viewport = Viewport()
# Debugging stuff----------------------------------
debugLayout = QHBoxLayout()
# these are used to offset the the rotation
self.xAdd = QSpinBox()
self.yAdd = QSpinBox()
self.zAdd = QSpinBox()
for each in [self.xAdd, self.yAdd, self.zAdd]:
each.setMinimum(-180) # min
each.setMaximum(180) # max
each.setSingleStep(90) # change this to a small value if need be
# these are used for inverting the rotations
self.xMult = QCheckBox()
self.yMult = QCheckBox()
self.zMult = QCheckBox()
self.xAdd.setValue(0)
self.yAdd.setValue(90) # in my case I need to offset by 90 in the Y axis
self.zAdd.setValue(0)
self.xMult.setChecked(False)
self.yMult.setChecked(True) # in my case I need to invert the Y axis on the acc
self.zMult.setChecked(False)
for each in [self.xAdd, self.yAdd, self.zAdd, self.xMult, self.yMult, self.zMult]:
debugLayout.addWidget(each)
# Debugging stuff----------------------------------
self.serialBtn = QPushButton('Connect')
# add widgets to layout
connectionLayout.addWidget(serialLab)
connectionLayout.addWidget(self.serialLine)
connectionLayout.addWidget(baudRateLab)
connectionLayout.addWidget(self.baudRateCombo)
connectionLayout.addWidget(self.serialBtn)
connectionLayout.addStretch()
self.mainLayout.addLayout(connectionLayout, 0,0,1,2)
self.mainLayout.addWidget(self.viewport, 1,0,1,2)
self.mainLayout.addWidget(self.accPlotWidget, 2,0,1,1)
self.mainLayout.addWidget(self.gyrPlotWidget, 2,1,1,1)
self.mainLayout.addWidget(self.magPlotWidget, 3,0,1,1)
#.........这里部分代码省略.........