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


Python QtGui.QComboBox类代码示例

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


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

示例1: DragPlotWidget

class DragPlotWidget(QFrame):
    ''' draggable widget plotting data and
    a combo box to choose channel
    '''
    
    def __init__(self, parent=None):
        super(DragPlotWidget, self).__init__(parent)
        
        # transparent fill color and a frame with size 400x250 
        self.setStyleSheet("QFrame {  border: 2px solid black; background-image: url(); }")
        self.setGeometry(1,1,400,250)
        
        # arrange elements in a gridLayout
        l = QGridLayout()
        self.setLayout(l)
        
        self.p = pq.PlotWidget(self)
        self.p.setYRange(-0.0002, 0.0002)
        self.pl1 = self.p.plot(np.linspace(0,3.4, 1000))  # initial plot
        
        self.box = QComboBox(self)
        self.box.addItems(["EMG " + str(x+1) for x in range(16)])
        self.box.currentIndexChanged.connect(self.changeChannel)
        
        l.addWidget(self.p)
        l.addWidget(self.box)
        
        self.dragPos = QPoint(0,0)
        
    def mousePressEvent(self, e):
        ''' enter drag mode by left click and save position '''
        if e.buttons() != Qt.LeftButton:
            return
        self.dragPos = e.pos()
        
    def mouseMoveEvent(self, e):
        ''' move by holding left mouse button and update position
        - removing offset by subtracting saved dragPos
        '''
        if e.buttons() != Qt.LeftButton:
            return
        position = e.pos() + self.pos() - self.dragPos
        self.move(position)
        self.update()
        self.parent().update()
    
    def mouseReleaseEvent(self, e):
        ''' release left mouse button and exit drag mode '''
        if e.buttons() != Qt.LeftButton:
            return
        position = e.pos() + self.pos() - self.dragPos
        self.move(position)
    
    def changeChannel(self, index):
        ''' change channel to index and clear plot '''
        self.p.plot([0], clear=True)
    
    def updatePlot(self, data):
        ''' plot new data '''
        self.p.plot(data[self.box.currentIndex()], clear=True)
开发者ID:Yakisoba007,项目名称:PyTrigno,代码行数:60,代码来源:plotter.py

示例2: CustomPage

class CustomPage(QWizardPage):
    '''
    Custom Computer Wizard Page
    
    Contains inputs for the Driver and Parser that the user can define a 
    custom mix of driver/parser/options.
    '''
    def __init__(self, parent=None):
        super(CustomPage, self).__init__(parent)
        
        self._createLayout()
        
        self.registerField('driver', self._cbxDriver)
        self.registerField('parser', self._cbxParser)
        self.registerField('driveropt', self._txtDOpts)
        self.registerField('parseropt', self._txtPOpts)
    
        self.setTitle(self.tr('Setup Driver Options'))
        self.setSubTitle(self.tr('Select the Driver and Parser to use with your Dive Computer.'))
    
    def nextId(self):
        'Return the next Page Id'
        return Pages.Browse
    
    def _createLayout(self):
        'Create the Wizard Page Layout'
        
        self._cbxDriver = QComboBox()
        self._cbxDriver.setModel(DriverModel())
        self._lblDriver = QLabel(self.tr('&Driver:'))
        self._lblDriver.setBuddy(self._cbxDriver)
        
        self._cbxParser = QComboBox()
        self._cbxParser.setModel(ParserModel())
        self._lblParser = QLabel(self.tr('&Parser:'))
        self._lblParser.setBuddy(self._cbxParser)
        
        self._txtDOpts = QLineEdit()
        self._lblDOpts = QLabel(self.tr('Driver Options:'))
        self._lblDOpts.setBuddy(self._txtDOpts)
        
        self._txtPOpts = QLineEdit()
        self._lblPOpts = QLabel(self.tr('Parser Options:'))
        self._lblPOpts.setBuddy(self._txtPOpts)
        
        gbox = QGridLayout()
        gbox.addWidget(self._lblDriver, 0, 0)
        gbox.addWidget(self._cbxDriver, 0, 1)
        gbox.addWidget(self._lblParser, 1, 0)
        gbox.addWidget(self._cbxParser, 1, 1)
        gbox.addWidget(self._lblDOpts, 2, 0)
        gbox.addWidget(self._txtDOpts, 2, 1)
        gbox.addWidget(self._lblPOpts, 3, 0)
        gbox.addWidget(self._txtPOpts, 3, 1)
        
        vbox = QVBoxLayout()
        vbox.addLayout(gbox)
        vbox.addStretch()
        
        self.setLayout(vbox)
开发者ID:asymworks,项目名称:python-divelog,代码行数:60,代码来源:add_dc.py

示例3: __init__

	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)
开发者ID:nb1987,项目名称:rvac,代码行数:26,代码来源:dlg_classes.py

示例4: aLabeledPopup

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,代码行数:30,代码来源:mywidgets.py

示例5: AddFilterDlg

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,代码行数:28,代码来源:dlg_classes.py

示例6: createEditor

 def createEditor(self, parent, option, index):
     """ Should return a combo box with Income or Expense """
     self.accounts = Accounts.all()
     self.accountNames = [account.name for account in self.accounts]
     comboBox = QComboBox(parent)
     comboBox.insertItems(0, self.accountNames)
     return comboBox
开发者ID:cloew,项目名称:PersonalAccountingSoftware,代码行数:7,代码来源:transaction_account_delegate.py

示例7: _OptionsSelector

class _OptionsSelector(QDialog):

    def __init__(self, list_options, parent=None):
        QDialog.__init__(self, parent)

        # Variables
        model = _AvailableOptionsListModel()
        for options in list_options:
            model.addOptions(options)

        # Widgets
        lbltext = QLabel('Select the options to import')

        self._combobox = QComboBox()
        self._combobox.setModel(model)

        buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        # Layouts
        layout = QVBoxLayout()
        layout.addWidget(lbltext)
        layout.addWidget(self._combobox)
        layout.addWidget(buttons)
        self.setLayout(layout)

        # Signals
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)

    def options(self):
        return self._combobox.model().options(self._combobox.currentIndex())
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:31,代码来源:runner.py

示例8: setup_toolbar

    def setup_toolbar(self):
        color_widget = ColorWidget()
        color_widget.color_changed.connect(self.fourier.on_color_change)
        self.toolBar.addWidget(QLabel("Color:"))
        self.toolBar.addWidget(color_widget)

        self.toolBar.addWidget(QLabel("Shape:"))
        size_spin = QSpinBox(self.toolBar)
        size_spin.setValue(20)
        size_spin.valueChanged[int].connect(self.fourier.on_size_change)

        shape_combo = QComboBox(self.toolBar)
        shape_combo.activated[str].connect(self.fourier.on_shape_change)
        shape_combo.addItems(brush_shapes)

        self.toolBar.addWidget(shape_combo)
        self.toolBar.addWidget(size_spin)

        self.toolBar.addWidget(QLabel("Symmetry:"))
        x_sym = QCheckBox(self.toolBar)
        x_sym.toggled.connect(self.fourier.on_x_toggle)

        opp_sym = QCheckBox(self.toolBar)
        opp_sym.toggled.connect(self.fourier.on_opp_toggle)
        self.toolBar.addWidget(QLabel("X"))
        self.toolBar.addWidget(x_sym)

        y_sym = QCheckBox(self.toolBar)
        y_sym.toggled.connect(self.fourier.on_y_toggle)
        self.toolBar.addWidget(QLabel("Y"))
        self.toolBar.addWidget(y_sym)
        self.toolBar.addWidget(QLabel("Center"))
        self.toolBar.addWidget(opp_sym)
开发者ID:d42,项目名称:Fourierism,代码行数:33,代码来源:fourier_widget.py

示例9: ChooseMarkerDialog

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,代码行数:25,代码来源:cherryChooseMarkerDialog.py

示例10: create_combobox

    def create_combobox(self, parent, editable=False):
        """ Returns an adapted QComboBox control.
        """
        control = QComboBox(check_parent(parent))
        control.setEditable(editable)

        return control_adapter(control)
开发者ID:davidmorrill,项目名称:facets,代码行数:7,代码来源:toolkit.py

示例11: CopyScenarioDlg

class CopyScenarioDlg(QDialog):

	def __init__(self, root_node, parent=None):
		super(CopyScenarioDlg, self).__init__(parent)
		self.setWindowTitle("Duplicate Scenario")
		
		device_label = QLabel("&Copy Scenario To:")
		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(device_label, 0, 0)
		layout.addWidget(self.device_combobox, 0, 1)
		layout.addWidget(button_box, 1, 1)
		self.setLayout(layout)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
		
	def returnVals(self):
		return self.device_combobox.itemData(self.device_combobox.currentIndex())
开发者ID:nb1987,项目名称:rvac,代码行数:25,代码来源:dlg_classes.py

示例12: createEditor

 def createEditor(self, row, column, item, view):
   """
     Creates the ComboBox for setting the Status
   """
   cb = QComboBox()
   for key in gStatusTags.keys():
     cb.addItem(QIcon(gStatusTags[key]), key)
   return cb
开发者ID:antiero,项目名称:dotHiero,代码行数:8,代码来源:FnShotStatusUI.py

示例13: __init__

    def __init__(self, parent=None):
        QComboBox.__init__(self, parent)

        self._factors = {}
        for scale, factor in self._FACTORS:
            self.addItem(scale)
            self._factors[scale] = factor

        self.setScale("s")
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:9,代码来源:widget.py

示例14: DelegateKeepsReferenceToEditor

class DelegateKeepsReferenceToEditor(QAbstractItemDelegate):
    def __init__(self, parent=None):
        QAbstractItemDelegate.__init__(self, parent)
        self.comboBox = QComboBox()
        self.comboBox.addItem(id_text)

    def createEditor(self, parent, option, index):
        self.comboBox.setParent(parent)
        return self.comboBox
开发者ID:holmeschiu,项目名称:PySide,代码行数:9,代码来源:delegatecreateseditor_test.py

示例15: addFilter

 def addFilter(self):
     """ Add Filter Label and Combo Box to the UI """
     label = QLabel("Filter: ", self.toolbar)
     self.toolbar.addWidget(label)
     comboBox = QComboBox(self.toolbar)
     comboBox.addItems(__filter_order__)
     comboBox.activated.connect(self.setTransactionFilter)
     index = [__transaction_filters__[filterText] for filterText in __filter_order__].index(self.table_view.filters)
     comboBox.setCurrentIndex(index)
     self.toolbar.addWidget(comboBox)
开发者ID:cloew,项目名称:PersonalAccountingSoftware,代码行数:10,代码来源:filter_toolbar_section.py


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