当前位置: 首页>>代码示例>>Python>>正文


Python QComboBox.currentText方法代码示例

本文整理汇总了Python中PySide.QtGui.QComboBox.currentText方法的典型用法代码示例。如果您正苦于以下问题:Python QComboBox.currentText方法的具体用法?Python QComboBox.currentText怎么用?Python QComboBox.currentText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui.QComboBox的用法示例。


在下文中一共展示了QComboBox.currentText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AddAreaDlg

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [as 别名]
class AddAreaDlg(QDialog):
		
	def __init__(self, parent=None):
		super(AddAreaDlg, self).__init__(parent)
		self.setWindowTitle("New Relief Device Area")
		
		name_label = QLabel("&Name:")
		self.name_lineedit = QLineEdit()
		self.name_lineedit.setMaxLength(200)
		name_label.setBuddy(self.name_lineedit)
		location_label = QLabel("&Location:")
		self.location_combobox = QComboBox()
		self.location_combobox.setEditable(True)
		location_label.setBuddy(self.location_combobox)
		self.browse_button = QPushButton("&Browse...")
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
		
		layout = QGridLayout()
		layout.addWidget(name_label, 0, 0)
		layout.addWidget(self.name_lineedit, 0, 1)
		layout.addWidget(location_label, 1, 0)
		layout.addWidget(self.location_combobox, 1, 1)
		layout.addWidget(self.browse_button, 1, 2)
		#layout.addWidget(QFrame.HLine, 2, 0)
		layout.addWidget(button_box, 2, 1)
		self.setLayout(layout)
		
		self.browse_button.clicked.connect(self.browseFiles)
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
		
	def browseFiles(self):
		self.dirname = QFileDialog.getExistingDirectory(self, "Select file location", options=QFileDialog.ShowDirsOnly)
		self.location_combobox.insertItem(0, self.dirname)
		self.location_combobox.setCurrentIndex(0)
		
	def accept(self):
		if len(self.name_lineedit.text().strip()) == 0:
			QMessageBox.warning(self, "Error: Relief Device Area Name Blank", "The relief device area must be given a name.", QMessageBox.Ok)
			self.name_lineedit.setFocus()
			return
		if len(self.location_combobox.currentText().strip()) == 0:
			QMessageBox.warning(self, "Error: Location Blank", "You must save the relief device area file to a valid directory.", QMessageBox.Ok)
			self.location_combobox.setFocus()
			return
		if not os.path.exists(self.location_combobox.currentText().replace("\\", "/")):
			QMessageBox.warning(self, "Error: Directory Does Not Exist", "The specified directory does not exist.", QMessageBox.Ok)
			self.location_combobox.setFocus()
			return
		if os.path.isfile(self.location_combobox.currentText().replace("\\", "/") + "/" + self.name_lineedit.text() + ".rda"):
			if QMessageBox.question(self, "File Already Exists", 
			"The file {0} already exists at {1}. Are you sure you want to proceed and overwrite this file?".format(self.name_lineedit.text() + ".rda", 
			self.location_combobox.currentText().replace("\\", "/")), QMessageBox.Yes|QMessageBox.No) == QMessageBox.No:
				self.name_lineedit.setFocus()
				return
		QDialog.accept(self)

	def returnVals(self):
		return self.name_lineedit.text(), self.location_combobox.currentText().replace("\\", "/") + "/"
开发者ID:nb1987,项目名称:rvac,代码行数:61,代码来源:dlg_classes.py

示例2: ExportPdfOptionDialog

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [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._optionDropdown = QComboBox()
        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._pdfActionSettings = {"1 Shot per page": [1, 1], "4 Shots per page)": [2, 2], "9 Shots per page)": [3, 3]}

        for pdfMode in sorted(self._pdfActionSettings, reverse=True):
            self._optionDropdown.addItem(pdfMode)

        layout.addRow("Save to:", self._fileNameField)
        layout.addRow("PDF Layout:", self._optionDropdown)
        layout.addRow("", self._buttonbox)

        self.setLayout(layout)
        self.setWindowTitle("Export PDF Options")
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

    def numRows(self):
        """Returns the number of rows for the pdf"""
        optionText = self._optionDropdown.currentText()
        return self._pdfActionSettings[optionText][0]

    def numColumns(self):
        """Returns the number of columns for the pdf"""
        optionText = self._optionDropdown.currentText()
        return self._pdfActionSettings[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
开发者ID:weijer,项目名称:dotStudio,代码行数:50,代码来源:FnPdfExporter.py

示例3: AddScenarioDlg

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [as 别名]
class AddScenarioDlg(QDialog):

	def __init__(self, root_node, parent=None):
		super(AddScenarioDlg, self).__init__(parent)
		self.setWindowTitle("Add Scenario")
		
		type_label = QLabel("&Scenario Type:")
		self.type_combobox = QComboBox()
		type_label.setBuddy(self.type_combobox)
		self.type_combobox.addItems(["External Fire", "Liquid Overfill", "Regulator Failure"])
		device_label = QLabel("&Associated Relief Device:")
		self.device_combobox = QComboBox()
		device_label.setBuddy(self.device_combobox)
		for area in root_node.children:
			for device in area.children:
				self.device_combobox.addItem(device.name, device)
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
			
		layout = QGridLayout()
		layout.addWidget(type_label, 0, 0)
		layout.addWidget(self.type_combobox, 0, 1)
		layout.addWidget(device_label, 1, 0)
		layout.addWidget(self.device_combobox, 1, 1)
		layout.addWidget(button_box, 2, 1)
		self.setLayout(layout)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
		
	def returnVals(self):
		return (self.type_combobox.currentText(), self.device_combobox.itemData(self.device_combobox.currentIndex()))
开发者ID:nb1987,项目名称:rvac,代码行数:33,代码来源:dlg_classes.py

示例4: AddFilterDlg

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [as 别名]
class AddFilterDlg(QDialog):
	
	def __init__(self, parent=None):
		super(AddFilterDlg, self).__init__(parent)
		self.setWindowTitle("Advanced Filtering Options")
		
		note_label = QLabel("NOTE: These filtering options apply exclusively to relief devices, not to the relief device area they belong to or to their scenarios.")
		pressure_label = QLabel("Filter where <b>Set Pressure</b> is")
		self.pressure_combobox = QComboBox()
		self.pressure_combobox.addItems(["Greater Than", "Less Than", "Equal To", "Not Equal To"])
		self.pressure_value = QDoubleSpinBox()
		pressure_layout = QHBoxLayout()
		pressure_layout.addWidget(pressure_label)
		pressure_layout.addWidget(self.pressure_combobox)
		pressure_layout.addWidget(self.pressure_value)
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
		
		layout = QGridLayout()
		layout.addWidget(note_label, 0, 0)
		layout.addLayout(pressure_layout, 1, 0)
		layout.addWidget(button_box, 2, 0)
		self.setLayout(layout)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
		
	def returnVals(self):
		return (self.pressure_combobox.currentText(), self.pressure_value.value())
开发者ID:nb1987,项目名称:rvac,代码行数:30,代码来源:dlg_classes.py

示例5: __init__

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [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)
开发者ID:cloew,项目名称:PersonalAccountingSoftware,代码行数:36,代码来源:account_toolbar_section.py

示例6: ChooseMarkerDialog

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [as 别名]
class ChooseMarkerDialog(QDialog):
	def __init__(self,markers):
		super(ChooseMarkerDialog, self).__init__()
		self.setWindowTitle('Select final marker...')
		markerLabel			= QLabel('Marker:')
		self.marker			= QComboBox()
		self.marker.addItems(markers)
		self.marker.setCurrentIndex(-1)
		layout				= QGridLayout()
		layout.addWidget(markerLabel,0,0)
		layout.addWidget(self.marker,0,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.marker.currentText()
 
	@staticmethod
	def run(markers,parent = None):
		dialog				= ChooseMarkerDialog(markers)
		result				= dialog.exec_()
		marker				= dialog.getMarker()
		return (marker,result == QDialog.Accepted)
开发者ID:mcvmcv,项目名称:cherry,代码行数:27,代码来源:cherryChooseMarkerDialog.py

示例7: aLabeledPopup

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [as 别名]
class aLabeledPopup(QWidget):
    def __init__(self, var, text, item_list, pos = "side", max_size = 200):
        QWidget.__init__(self)
        self.setContentsMargins(1, 1, 1, 1)
        if pos == "side":
            self.layout1=QHBoxLayout()
        else:
            self.layout1 = QVBoxLayout()
        self.layout1.setContentsMargins(1, 1, 1, 1)
        self.layout1.setSpacing(1)
        self.setLayout(self.layout1)
        
        self.item_combo = QComboBox()
        self.item_combo.addItems(item_list)
        self.item_combo.setFont(QFont('SansSerif', 12))
        self.label = QLabel(text)
        # self.label.setAlignment(Qt.AlignLeft)
        self.label.setFont(QFont('SansSerif', 12))
        self.layout1.addWidget(self.label)
        self.layout1.addWidget(self.item_combo)
        self.var = var
        self.item_combo.textChanged.connect(self.when_modified)
        self.item_combo.currentIndexChanged.connect(self.when_modified)
        self.when_modified()
        
    def when_modified(self):
        self.var.set(self.item_combo.currentText())
        
    def hide(self):
        QWidget.hide(self)
开发者ID:bsherin,项目名称:shared_tools,代码行数:32,代码来源:mywidgets.py

示例8: AddDeviceDlg

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [as 别名]
class AddDeviceDlg(QDialog):

	def __init__(self, root_node, parent=None):
		super(AddDeviceDlg, self).__init__(parent)
		self.setWindowTitle("Add Relief Device")

		id_label = QLabel("&Relief Device ID:")
		self.id_lineedit = QLineEdit()
		self.id_lineedit.setMaxLength(200)
		id_label.setBuddy(self.id_lineedit)
		area_label = QLabel("Associated Relief Device &Area:")
		self.area_combobox = QComboBox()
		for area in root_node.children:
			self.area_combobox.addItem(area.name, area)
		area_label.setBuddy(self.area_combobox)
		color_label = QLabel("&Text Color:")
		self.color_combobox = QComboBox()
		for key in sorted(COLORS.keys()):
			pixmap = QPixmap(26, 26)
			pixmap.fill(COLORS[key])
			self.color_combobox.addItem(QIcon(pixmap), key)
		color_label.setBuddy(self.color_combobox)
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
			
		layout = QGridLayout()
		layout.addWidget(id_label, 0, 0)
		layout.addWidget(self.id_lineedit, 0, 1)
		layout.addWidget(area_label, 1, 0)
		layout.addWidget(self.area_combobox, 1, 1)
		layout.addWidget(color_label, 2, 0)
		layout.addWidget(self.color_combobox, 2, 1)
		layout.addWidget(button_box, 3, 1)
		self.setLayout(layout)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
		
	def accept(self):
		if len(self.id_lineedit.text().strip()) == 0:
			QMessageBox.warning(self, "Error: Relief Device ID Blank", "The relief device must be given an ID.", QMessageBox.Ok)
			self.id_lineedit.setFocus()
			return
		selected_area = self.area_combobox.itemData(self.area_combobox.currentIndex())
		for device in selected_area.children:
			if device.name == self.id_lineedit.text():
				QMessageBox.warning(self, "Error: Relief Device ID Already Exists", 
				"Cannot add relief device because that relief device ID already exists. Please create a new relief device ID.", QMessageBox.Ok)
				self.id_lineedit.setFocus()
				self.id_lineedit.setSelection(0, self.id_lineedit.maxLength())
				return
		QDialog.accept(self)
		
	def returnVals(self):
		return (self.id_lineedit.text(), self.area_combobox.itemData(self.area_combobox.currentIndex()),
		COLORS[self.color_combobox.currentText()])
开发者ID:nb1987,项目名称:rvac,代码行数:57,代码来源:dlg_classes.py

示例9: __init__

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [as 别名]
class DateToolbarSection:
    """ Represents the Date Toolbar Section """
    
    def __init__(self, toolbar, panel):
        """ Initialize the Date Toolbar Section """
        self.toolbar = toolbar
        self.panel = panel
        
    def addDateSection(self):
        """ Add Date Section """
        self.dateLabel = QLabel("Month: ", self.toolbar)
        self.toolbar.addWidget(self.dateLabel)
        self.setupMonthComboBox()
        self.setupYearComboBox()
        
    def setupMonthComboBox(self):
        """ Setup the month combo box """
        self.monthComboBox = QComboBox(self.toolbar)
        self.monthComboBox.addItems(["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"])
        self.monthComboBox.activated.connect(self.setMonth)
        self.monthComboBox.setCurrentIndex(self.getCategoryStatistics().month-1)
        self.toolbar.addWidget(self.monthComboBox)
        
    def setupYearComboBox(self):
        """ Setup the year combo box """
        self.yearComboBox = QComboBox(self.toolbar)
        self.getTransactionYears()
        self.yearComboBox.addItems([str(year) for year in self.transactionYears])
        self.yearComboBox.activated.connect(self.setYear)
        self.yearComboBox.setCurrentIndex(self.transactionYears.index(self.getCategoryStatistics().year))
        self.toolbar.addWidget(self.yearComboBox)
    
    def getTransactionYears(self):
        """ Get the possible transacttion years """
        self.transactionYearsSet = Transactions.getAllYears()
        self.transactionYearsSet.add(self.getCategoryStatistics().year)
        self.transactionYears = list(self.transactionYearsSet)
        self.transactionYears.sort()
    
    def setMonth(self, index):
        """ Set the month """
        categoryStatistics = self.getCategoryStatistics()
        categoryStatistics.month = index+1
        self.panel.updatePanel()
    
    def setYear(self, index):
        """ Set the year """
        categoryStatistics = self.getCategoryStatistics()
        categoryStatistics.year = int(self.yearComboBox.currentText())
        self.panel.updatePanel()
        
    def getCategoryStatistics(self):
        """ Returns the Category Statistics """
        return self.panel.categoryStatistics
开发者ID:cloew,项目名称:PersonalAccountingSoftware,代码行数:56,代码来源:date_toolbar_section.py

示例10: AnalysisSelector

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [as 别名]
class AnalysisSelector(QWidget):
    def __init__(self, my_parent, max_size = 200):
        QWidget.__init__(self)
        myframe = QHBoxLayout()
        self.setLayout(myframe)
        self.popup = QComboBox()
        self.popup.setSizeAdjustPolicy(QComboBox.AdjustToContents)
        myframe.addWidget(self.popup)
        myframe.addStretch()
        self.my_parent = my_parent
        self.popup.addItems(self.my_parent._lcvsa_dict.keys())
        self.popup.setFont(QFont('SansSerif', 12))
        self.popup.currentIndexChanged.connect(self.when_modified)
        self.when_modified()
        
    def when_modified(self):
        self.my_parent._lcvsa  = self.my_parent._lcvsa_dict[self.popup.currentText()]
        self.my_parent.gprint("Working with analysis %s" % self.popup.currentText(), "h2")
        
    def hide(self):
        QWidget.hide(self)
开发者ID:bsherin,项目名称:shared_tools,代码行数:23,代码来源:qanalysis_window_basics.py

示例11: ExportDialog

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [as 别名]
class ExportDialog(QDialog):
  """Allows the choice of format and browsing to a save location
     Call data() after exec_()"""
  
  def __init__(self, parent=None):
    super(ExportDialog, self).__init__(parent)
    self._output_folder = None
    self.setModal(True)
    layout_main = QGridLayout()
    label_choose_format = QLabel(self.tr("Choose format"))
    self.combo_choose_format = QComboBox()
    self.combo_choose_format.setModel(QStringListModel(FileExporter.FORMATS_AVAILABLE))
    label_saveto = QLabel(self.tr("Save location"))
    button_saveto = QPushButton(self.tr("Browse ..."))
    button_saveto.clicked.connect(self._openFolderChoiceDialog)
    self.label_output = QLabel()
    button_export = QPushButton(self.tr("Export"))
    button_export.clicked.connect(self.accept)
    button_cancel = QPushButton(self.tr("Cancel"))
    button_cancel.clicked.connect(self.reject)
    row = 0; col = 0;
    layout_main.addWidget(label_choose_format, row, col, 1, 2)
    col += 2
    layout_main.addWidget(self.combo_choose_format, row, col, 1, 2)
    row += 1; col -= 2;
    layout_main.addWidget(label_saveto, row, col, 1, 2)
    col += 2
    layout_main.addWidget(button_saveto, row, col, 1, 2)
    row += 1; col -= 2;
    layout_main.addWidget(self.label_output, row, col, 1, 4)
    row += 1; col += 2
    layout_main.addWidget(button_export, row, col)
    col += 1
    layout_main.addWidget(button_cancel, row, col)
    self.setWindowTitle(self.tr("Export Parameters"))
    self.setLayout(layout_main)
    
  def data(self):
    if self._output_folder is None: return None
    else:
      return ExportInfo(self.combo_choose_format.currentText(), self._output_folder)
  
  def _openFolderChoiceDialog(self):
    folder = QFileDialog.getExistingDirectory(self, caption=self.tr("Choose output directory"))
    if not folder:
      self.label_output.setText("<font style='color:red;'>" + self.tr("Please choose an output folder") 
                                + "</font>")
    else: 
      self.label_output.setText(folder)
      self._output_folder = folder
开发者ID:github-account-because-they-want-it,项目名称:VisualScrape,代码行数:52,代码来源:dialog.py

示例12: CreateSamplesRow

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [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()
开发者ID:mcvmcv,项目名称:cherry,代码行数:17,代码来源:cherryCreateSamplesDialog.py

示例13: SimpleComboboxOption

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [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()
开发者ID:ThomasDalla,项目名称:Highway_Simulation_GUI,代码行数:21,代码来源:helpers.py

示例14: LCRow

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [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()
开发者ID:mcvmcv,项目名称:cherry,代码行数:22,代码来源:cherryLCDialog.py

示例15: RateView

# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import currentText [as 别名]

#.........这里部分代码省略.........
        else:
            error.showMessage('Invalid unit: {0}'.format(unit))

    #######
    # SLOTS
    #######

    def updateRate(self):
        '''Updates the rate of the text box'''
        # Do nothing if rate is not yet defined
        try:
            rate = self.model.rate
        except AttributeError:
            return
        if 0.1 > rate or rate > 100:
            self.rate_value.setText('{0:.3E}'.format(rate))
        else:
            self.rate_value.setText('{0:.3F}'.format(rate))

    def emitRate(self):
        '''Converts the text to a float and emits'''
        # Do nothing if there is no number
        try:
            self.model.setRate(float(self.rate_value.text()))
        except ValueError:
            pass

    def updateUnit(self):
        '''Update for a change of unit'''
        # If there is no unit yet, just set it
        try:
            unit = self.model.unit
        except AttributeError:
            self.model.setConverter(str(self.unit.currentText()))
            try:
                self.model.setRate(float(self.rate_value.text()))
            except ValueError:
                pass
            return
        # Convert unit appropriately
        if self.rate.isChecked():
            if unit == 'Hz':
                conv = { 'GHz' : 1E-9,
                         'THz' : 1E-12,
                         'PHz' : 1E-15 }
            elif unit == 'GHz':
                conv = { 'Hz'  : 1E9,
                         'THz' : 1E-3,
                         'PHz' : 1E-6 }
            elif unit == 'THz':
                conv = { 'Hz'  : 1E12,
                         'GHz' : 1E3,
                         'PHz' : 1E-3 }
            elif unit == 'PHz':
                conv = { 'Hz'  : 1E15,
                         'GHz' : 1E6,
                         'THz' : 1E3 }
            else:
                conv = { ''    : 1,
                         'Hz'  : 1, 
                         'GHz' : 1, 
                         'THz' : 1, 
                         'PHz' : 1, }
        else:
            if unit == 's':
                conv = { 'ns' : 1E9,
开发者ID:jensengrouppsu,项目名称:rapid,代码行数:70,代码来源:rate.py


注:本文中的PySide.QtGui.QComboBox.currentText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。