• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python QtWidgets.QComboBox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

    def __init__(self, editor):
        Panel.__init__(self, editor)
        self._editor = editor
        self._editor.sig_cursor_position_changed.connect(
            self._handle_cursor_position_change_event
        )

        # The layout
        hbox = QHBoxLayout()
        self.class_cb = QComboBox()
        self.method_cb = QComboBox()
        hbox.addWidget(self.class_cb)
        hbox.addWidget(self.method_cb)
        hbox.setSpacing(0)
        hbox.setContentsMargins(0, 0, 0, 0)

        self.setLayout(hbox)

        # Internal data
        self.folds = None
        self.parents = None
        self.classes = None
        self.funcs = None

        # Initial data for the dropdowns.
        self.class_cb.addItem("<None>", 0)
        self.method_cb.addItem("<None>", 0)

        # Attach some events.
        self.class_cb.activated.connect(self.combobox_activated)
        self.method_cb.activated.connect(self.combobox_activated)
开发者ID:burrbull,项目名称:spyder,代码行数:31,代码来源:classfunctiondropdown.py


示例2: populate_unit_layout

    def populate_unit_layout(self, unit_layout, gui=None):
        """
        Populate horizontal layout (living on conversion gui)
        with appropriate widgets.

        Layouts:
            [QComboBox]

        :param unit_layout: (QHBoxLayout) Horizontal layout
        :param gui: conversion gui
        :return: updated unit_layout
        """

        unit_str = self._unit.to_string()
        options = self._unit.find_equivalent_units(include_prefix_units=True)
        options = [i.to_string() for i in options]
        options.sort(key=lambda x: x.upper())
        if unit_str not in options:
            options.append(unit_str)
        index = options.index(unit_str)
        combo = QComboBox()
        # combo.setFixedWidth(200)
        combo.addItems(options)
        combo.setCurrentIndex(index)
        combo.currentIndexChanged.connect(self._update_message)
        self.options_combo = combo
        unit_layout.addWidget(combo)
        self._update_message()
        return unit_layout
开发者ID:spacetelescope,项目名称:cube-tools,代码行数:29,代码来源:flux_units_gui.py


示例3: buttonwidget

class buttonwidget(QWidget):

    def __init__(self):
        # how connect
        super(buttonwidget, self).__init__()
        self.grid = QGridLayout()
        self.btnConnect = QPushButton("Connect")
        self.grid.addWidget(self.btnConnect, 0, 0, 1, 5)

        self.btnLock = QPushButton("Lock Cassette")
        self.grid.addWidget(self.btnLock, 1, 0, 1, 5)

        self.btnPurge = QPushButton("Purge")
        self.grid.addWidget(self.btnPurge, 2, 0, 1, 2)

        self.cbxPurgeType = QComboBox()
        self.cbxPurgeType.addItems(["Normal", "Extended", "Add Conditioner", "Custom"])
        self.grid.addWidget(self.cbxPurgeType, 2, 2, 1, 2)

        self.txtNumPurge = QLineEdit()
        self.grid.addWidget(self.txtNumPurge, 2, 4, 1, 1)

        self.btnRecover = QPushButton("Recover")
        self.grid.addWidget(self.btnRecover, 3, 0, 1, 5)

        self.btnHelp = QPushButton("Help")
        self.grid.addWidget(self.btnHelp, 4, 0, 1, 5)

        self.setLayout(self.grid)

    def updateButtonText(self):
        print('updating text')

    def EnableDisableButtons(self):
        print('enabeling,disabeling buttons')
开发者ID:dangraf,项目名称:PycharmProjects,代码行数:35,代码来源:button_panel.py


示例4: FormComboWidget

class FormComboWidget(QWidget):
    update_buttons = Signal()
    
    def __init__(self, datalist, comment="", parent=None):
        QWidget.__init__(self, parent)
        layout = QVBoxLayout()
        self.setLayout(layout)
        self.combobox = QComboBox()
        layout.addWidget(self.combobox)
        
        self.stackwidget = QStackedWidget(self)
        layout.addWidget(self.stackwidget)
        self.combobox.currentIndexChanged.connect(
                                              self.stackwidget.setCurrentIndex)
        
        self.widgetlist = []
        for data, title, comment in datalist:
            self.combobox.addItem(title)
            widget = FormWidget(data, comment=comment, parent=self)
            self.stackwidget.addWidget(widget)
            self.widgetlist.append(widget)
            
    def setup(self):
        for widget in self.widgetlist:
            widget.setup()

    def get(self):
        return [ widget.get() for widget in self.widgetlist]
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:28,代码来源:formlayout.py


示例5: _CompositionWidget

class _CompositionWidget(_ConditionWidget):

    def _init_ui(self):
        # Widgets
        self._cb_unit = QComboBox()
        self._cb_unit.addItems(list(_COMPOSITION_UNITS))

        # Layouts
        layout = _ConditionWidget._init_ui(self)
        layout.addRow('<i>Unit</i>', self._cb_unit)

        # Signals
        self._cb_unit.currentIndexChanged.connect(self.edited)

        return layout

    def parameter(self, parameter=None):
        parameter = _ConditionWidget.parameter(self, parameter)
        parameter.unit = self._cb_unit.currentText()
        return parameter

    def setParameter(self, condition):
        _ConditionWidget.setParameter(self, condition)
        self._cb_unit.setCurrentIndex(self._cb_unit.findText(condition.unit))

    def setReadOnly(self, state):
        _ConditionWidget.setReadOnly(self, state)
        self._cb_unit.setEnabled(not state)

    def isReadOnly(self):
        return _ConditionWidget.isReadOnly(self) and \
            not self._cb_unit.isEnabled()
开发者ID:pyhmsa,项目名称:pyhmsa-gui,代码行数:32,代码来源:composition.py


示例6: _init_ui

    def _init_ui(self):
        self.slit_type_label = QLabel('Slit Type')
        self.slit_type_combo = QComboBox()
        self.slit_type_combo.currentIndexChanged.connect(self.update_info)

        hbl1 = QHBoxLayout()
        hbl1.addWidget(self.slit_type_label)
        hbl1.addWidget(self.slit_type_combo)

        self.slit_width_label = QLabel('Slit Width')
        self.slit_width_input = QLineEdit()
        self.slit_width_combo = QComboBox()
        self.slit_width_units = QLabel('arcsec')

        hbl2 = QHBoxLayout()
        hbl2.addWidget(self.slit_width_label)
        hbl2.addWidget(self.slit_width_input)
        hbl2.addWidget(self.slit_width_combo)
        hbl2.addWidget(self.slit_width_units)

        self.slit_length_label = QLabel('Slit Length')
        self.slit_length_input = QLineEdit()
        self.slit_length_combo = QComboBox()
        self.slit_length_units = QLabel('arcsec')

        hbl3 = QHBoxLayout()
        hbl3.addWidget(self.slit_length_label)
        hbl3.addWidget(self.slit_length_input)
        hbl3.addWidget(self.slit_length_combo)
        hbl3.addWidget(self.slit_length_units)

        self.okButton = QPushButton('Apply')
        self.okButton.clicked.connect(self.apply)
        self.okButton.setDefault(True)

        self.cancelButton = QPushButton('Cancel')
        self.cancelButton.clicked.connect(self.cancel)

        hbl4 = QHBoxLayout()
        hbl4.addWidget(self.cancelButton)
        hbl4.addWidget(self.okButton)

        vbl = QVBoxLayout()
        vbl.addLayout(hbl1)
        vbl.addLayout(hbl2)
        vbl.addLayout(hbl3)
        vbl.addLayout(hbl4)
        self.setLayout(vbl)
        self.vbl = vbl

        self._load_selections()
        self._populate_combo()
        self.update_info(0)

        self.show()
开发者ID:spacetelescope,项目名称:mosviz,代码行数:55,代码来源:slit_selection_ui.py


示例7: _AcquisitionRasterWidget

class _AcquisitionRasterWidget(_AcquisitionWidget):

    def _init_ui(self):
        # Widgets
        self._cb_raster_mode = QComboBox()
        self._cb_raster_mode.addItems([None] + list(_RASTER_MODES))

        # Layouts
        layout = _AcquisitionWidget._init_ui(self)
        layout.addRow('Raster mode', self._cb_raster_mode)

        # Singals
        self._cb_raster_mode.currentIndexChanged.connect(self.edited)

        return layout

    def parameter(self, parameter=None):
        parameter = _AcquisitionWidget.parameter(self, parameter)
        parameter.raster_mode = self._cb_raster_mode.currentText()
        return parameter

    def setParameter(self, condition):
        _AcquisitionWidget.setParameter(self, condition)
        self._cb_raster_mode.setCurrentIndex(self._cb_raster_mode.findText(condition.raster_mode))

    def setReadOnly(self, state):
        _AcquisitionWidget.setReadOnly(self, state)
        self._cb_raster_mode.setEnabled(not state)

    def isReadOnly(self):
        return _AcquisitionWidget.isReadOnly(self) and \
            not self._cb_raster_mode.isEnabled()
开发者ID:pyhmsa,项目名称:pyhmsa-gui,代码行数:32,代码来源:acquisition.py


示例8: create_combobox

 def create_combobox(self, text, choices, option, default=NoDefault,
                     tip=None, restart=False):
     """choices: couples (name, key)"""
     label = QLabel(text)
     combobox = QComboBox()
     if tip is not None:
         combobox.setToolTip(tip)
     for name, key in choices:
         if not (name is None and key is None):
             combobox.addItem(name, to_qvariant(key))
     # Insert separators
     count = 0
     for index, item in enumerate(choices):
         name, key = item
         if name is None and key is None:
             combobox.insertSeparator(index + count)
             count += 1
     self.comboboxes[combobox] = (option, default)
     layout = QHBoxLayout()
     layout.addWidget(label)
     layout.addWidget(combobox)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.label = label
     widget.combobox = combobox
     widget.setLayout(layout)
     combobox.restart_required = restart
     combobox.label_text = text
     return widget
开发者ID:impact27,项目名称:spyder,代码行数:30,代码来源:configdialog.py


示例9: focusOutEvent

    def focusOutEvent(self, event):
        """Handle focus out event restoring the last valid selected path."""
        # Calling asynchronously the 'add_current_text' to avoid crash
        # https://groups.google.com/group/spyderlib/browse_thread/thread/2257abf530e210bd
        if not self.is_valid():
            lineedit = self.lineEdit()
            QTimer.singleShot(50, lambda: lineedit.setText(self.selected_text))

        hide_status = getattr(self.lineEdit(), 'hide_status_icon', None)
        if hide_status:
            hide_status()
        QComboBox.focusOutEvent(self, event)
开发者ID:rlaverde,项目名称:spyder,代码行数:12,代码来源:comboboxes.py


示例10: DetectorSpectrometerWidget

class DetectorSpectrometerWidget(_DetectorWidget):

    def __init__(self, parent=None):
        _DetectorWidget.__init__(self, DetectorSpectrometer, parent)

    def _init_ui(self):
        # Widgets
        self._txt_channel_count = NumericalAttributeLineEdit(self.CLASS.channel_count)
        self._txt_channel_count.setFormat('{0:d}')
        self._wdg_calibration = CalibrationWidget()
        self._cb_collection_mode = QComboBox()
        self._cb_collection_mode.addItems([None] + list(_COLLECTION_MODES))

        # Layout
        layout = _DetectorWidget._init_ui(self)
        layout.insertRow(0, '<i>Channel count</i>', self._txt_channel_count)
        layout.insertRow(1, '<i>Calibration</i>', self._wdg_calibration)
        layout.addRow('Collection mode', self._cb_collection_mode)

        # Signals
        self._txt_channel_count.textEdited.connect(self.edited)
        self._wdg_calibration.edited.connect(self.edited)
        self._cb_collection_mode.currentIndexChanged.connect(self.edited)

        return layout

    def _create_parameter(self):
        return self.CLASS(1, CalibrationConstant('Quantity', 'm', 0.0))

    def parameter(self, parameter=None):
        parameter = _DetectorWidget.parameter(self, parameter)
        parameter.channel_count = self._txt_channel_count.text()
        parameter.calibration = self._wdg_calibration.calibration()
        parameter.collection_mode = self._cb_collection_mode.currentText()
        return parameter

    def setParameter(self, condition):
        _DetectorWidget.setParameter(self, condition)
        self._txt_channel_count.setText(condition.channel_count)
        self._wdg_calibration.setCalibration(condition.calibration)
        self._cb_collection_mode.setCurrentIndex(self._cb_collection_mode.findText(condition.collection_mode))

    def setReadOnly(self, state):
        _DetectorWidget.setReadOnly(self, state)
        self._txt_channel_count.setReadOnly(state)
        self._wdg_calibration.setReadOnly(state)
        self._cb_collection_mode.setEnabled(not state)

    def isReadOnly(self):
        return _DetectorWidget.isReadOnly(self) and \
            self._txt_channel_count.isReadOnly() and \
            self._wdg_calibration.isReadOnly() and \
            not self._cb_collection_mode.isEnabled()

    def hasAcceptableInput(self):
        return _DetectorWidget.hasAcceptableInput(self) and \
            self._txt_channel_count.hasAcceptableInput() and \
            self._wdg_calibration.hasAcceptableInput()
开发者ID:pyhmsa,项目名称:pyhmsa-gui,代码行数:58,代码来源:detector.py


示例11: keyPressEvent

    def keyPressEvent(self, event):
        """Qt Override.

        Handle key press events.
        """
        if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter:
            if self.add_current_text_if_valid():
                self.selected()
                self.hide_completer()
        elif event.key() == Qt.Key_Escape:
            self.set_current_text(self.selected_text)
            self.hide_completer()
        else:
            QComboBox.keyPressEvent(self, event)
开发者ID:rlaverde,项目名称:spyder,代码行数:14,代码来源:comboboxes.py


示例12: NewGrainDialog

class NewGrainDialog(QDialog):
    def __init__(self):
        super(NewGrainDialog, self).__init__()
        self.setup_ui()

    def setup_ui(self):
        self.setWindowTitle("Add New Grain")
        self.setWindowIcon(QIcon(RESOURCE_PATH + "icons/nakka-finocyl.gif"))

        self.resize(400, 400)

        controls = QGridLayout()
        gb_frame = QGroupBox(self.tr("Grain Design"))
        gb_frame.setLayout(controls)
        
        self.cb_grain_type = QComboBox()

        # TODO: make grain types auto propagate combobox
        self.cb_grain_type.addItems([self.tr("Cylindrical (BATES)")])
        controls.addWidget(QLabel(self.tr("Core Shape")), 0, 0)
        controls.addWidget(self.cb_grain_type, 0, 1)

        self.cb_propellant_type = QComboBox()
        self.cb_propellant_type.addItems(app_context.propellant_db.propellant_names())
        controls.addWidget(QLabel(self.tr("Propellant Type")), 1, 0)
        controls.addWidget(self.cb_propellant_type, 1, 1)

        # ok and cancel buttons
        btn_ok = QPushButton(self.tr("Apply"))
        btn_ok.clicked.connect(self.confirm_grain)
        btn_cancel = QPushButton(self.tr("Close"))
        btn_cancel.clicked.connect(self.close)

        lay_btns = QHBoxLayout()
        lay_btns.addWidget(btn_ok)
        lay_btns.addWidget(btn_cancel)
        frame_btns = QFrame()
        frame_btns.setLayout(lay_btns)

        # master layout
        master = QVBoxLayout()
        master.addWidget(gb_frame)
        master.addSpacing(10)
        master.addWidget(frame_btns)
        self.setLayout(master)

    def confirm_grain(self):
        # grain = OpenBurnGrain.from_widget_factory(...)
        pass
开发者ID:tuxxi,项目名称:OpenBurn,代码行数:49,代码来源:grain_dialog.py


示例13: _make_search_box

 def _make_search_box(self):
     """
     Make a algorithm search box.
     :return: A QComboBox
     """
     search_box = QComboBox(self)
     search_box.setEditable(True)
     search_box.completer().setCompletionMode(QCompleter.PopupCompletion)
     search_box.setInsertPolicy(QComboBox.NoInsert)
     search_box.editTextChanged.connect(self._on_search_box_selection_changed)
     search_box.lineEdit().returnPressed.connect(self.execute_algorithm)
     return search_box
开发者ID:DanNixon,项目名称:mantid,代码行数:12,代码来源:widget.py


示例14: __init__

    def __init__(self, parent, order):
        super(LayoutSaveDialog, self).__init__(parent)

        # variables
        self._parent = parent

        # widgets
        self.combo_box = QComboBox(self)
        self.combo_box.addItems(order)
        self.combo_box.setEditable(True)
        self.combo_box.clearEditText()
        self.button_box = QDialogButtonBox(QDialogButtonBox.Ok |
                                           QDialogButtonBox.Cancel,
                                           Qt.Horizontal, self)
        self.button_ok = self.button_box.button(QDialogButtonBox.Ok)
        self.button_cancel = self.button_box.button(QDialogButtonBox.Cancel)

        # widget setup
        self.button_ok.setEnabled(False)
        self.dialog_size = QSize(300, 100)
        self.setWindowTitle('Save layout as')
        self.setModal(True)
        self.setMinimumSize(self.dialog_size)
        self.setFixedSize(self.dialog_size)

        # layouts
        self.layout = QVBoxLayout()
        self.layout.addWidget(self.combo_box)
        self.layout.addWidget(self.button_box)
        self.setLayout(self.layout)

        # signals and slots
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.close)
        self.combo_box.editTextChanged.connect(self.check_text)
开发者ID:0xBADCA7,项目名称:spyder,代码行数:35,代码来源:layoutdialog.py


示例15: _init_ui

    def _init_ui(self):
        # Widgets
        self._cb_technology = QComboBox()
        self._cb_technology.addItems([None] + list(_XEDS_TECHNOLOGIES))
        self._txt_nominal_throughput = NumericalAttributeLineEdit(self.CLASS.nominal_throughput)
        self._txt_time_constant = NumericalAttributeLineEdit(self.CLASS.time_constant)
        self._txt_strobe_rate = NumericalAttributeLineEdit(self.CLASS.strobe_rate)
        self._wdg_window = WindowWidget()

        # Layout
        form = DetectorSpectrometerWidget._init_ui(self)
        form.addRow('Technology', self._cb_technology)
        form.addRow('Nominal throughput', self._txt_nominal_throughput)
        form.addRow('Time constant', self._txt_time_constant)
        form.addRow('Strobe rate', self._txt_strobe_rate)
        form.addRow('Window', self._wdg_window)

        # Signals
        self._cb_technology.currentIndexChanged.connect(self.edited)
        self._txt_nominal_throughput.textEdited.connect(self.edited)
        self._txt_time_constant.textEdited.connect(self.edited)
        self._txt_strobe_rate.textEdited.connect(self.edited)
        self._wdg_window.edited.connect(self.edited)

        return form
开发者ID:pyhmsa,项目名称:pyhmsa-gui,代码行数:25,代码来源:detector.py


示例16: __init__

 def __init__(self, parent=None, logname=None, level=logging.NOTSET):
     QWidget.__init__(self, parent=parent)
     # Create Widgets
     self.label = QLabel('Minimum displayed log level: ', parent=self)
     self.combo = QComboBox(parent=self)
     self.text = QPlainTextEdit(parent=self)
     self.text.setReadOnly(True)
     self.clear_btn = QPushButton("Clear", parent=self)
     # Create layout
     layout = QVBoxLayout()
     level_control = QHBoxLayout()
     level_control.addWidget(self.label)
     level_control.addWidget(self.combo)
     layout.addLayout(level_control)
     layout.addWidget(self.text)
     layout.addWidget(self.clear_btn)
     self.setLayout(layout)
     # Allow QCombobox to control log level
     for log_level, value in LogLevels.as_dict().items():
         self.combo.addItem(log_level, value)
     self.combo.currentIndexChanged[str].connect(self.setLevel)
     # Allow QPushButton to clear log text
     self.clear_btn.clicked.connect(self.clear)
     # Create a handler with the default format
     self.handler = GuiHandler(level=level, parent=self)
     self.logFormat = self.default_format
     self.handler.message.connect(self.write)
     # Create logger. Either as a root or given logname
     self.log = None
     self.level = None
     self.logName = logname or ''
     self.logLevel = level
     self.destroyed.connect(functools.partial(logger_destroyed, self.log))
开发者ID:slaclab,项目名称:pydm,代码行数:33,代码来源:logdisplay.py


示例17: _init_ui

    def _init_ui(self):
        # Widgets
        self._combobox = QComboBox()
        self._stack = QStackedWidget()

        # Layouts
        layout = ParameterWidget._init_ui(self)
        layout.addRow(self._combobox)
        layout.addRow(self._stack)

        # Register classes
        self._widget_indexes = {}

        for entry_point in iter_entry_points('pyhmsa_gui.spec.condition.calibration'):
            widget_class = entry_point.load(require=False)
            widget = widget_class()
            self._combobox.addItem(widget.accessibleName().title())
            self._widget_indexes[widget.CLASS] = self._stack.addWidget(widget)
            widget.edited.connect(self.edited)

        # Signals
        self._combobox.currentIndexChanged.connect(self._on_combo_box)
        self._combobox.currentIndexChanged.connect(self.edited)

        return layout
开发者ID:pyhmsa,项目名称:pyhmsa-gui,代码行数:25,代码来源:calibration.py


示例18: _init_ui

    def _init_ui(self):
        # Widgets
        self._txt_step_count_x = NumericalAttributeLineEdit(self.CLASS.step_count_x)
        self._txt_step_count_x.setFormat('{0:d}')
        self._txt_step_count_y = NumericalAttributeLineEdit(self.CLASS.step_count_y)
        self._txt_step_count_y.setFormat('{0:d}')
        self._txt_step_size_x = NumericalAttributeLineEdit(self.CLASS.step_size_x)
        self._txt_step_size_y = NumericalAttributeLineEdit(self.CLASS.step_size_y)
        self._txt_frame_count = NumericalAttributeLineEdit(self.CLASS.frame_count)
        self._txt_frame_count.setFormat('{0:d}')
        self._cb_location = QComboBox()
        self._cb_location.addItems(list(_POSITION_LOCATIONS))
        self._wdg_position = SpecimenPositionWidget(inline=True)

        # Layouts
        layout = _AcquisitionRasterWidget._init_ui(self)
        layout.insertRow(0, '<i>Step count (x)</i>', self._txt_step_count_x)
        layout.insertRow(1, '<i>Step count (y)</i>', self._txt_step_count_y)
        layout.insertRow(2, 'Step size (x)', self._txt_step_size_x)
        layout.insertRow(3, 'Step size (y)', self._txt_step_size_y)
        layout.addRow('Frame count', self._txt_frame_count)
        layout.addRow('Position', self._cb_location)
        layout.addWidget(self._wdg_position)

        # Signals
        self._txt_step_count_x.textEdited.connect(self.edited)
        self._txt_step_count_y.textEdited.connect(self.edited)
        self._txt_step_size_x.textEdited.connect(self.edited)
        self._txt_step_size_y.textEdited.connect(self.edited)
        self._txt_frame_count.textEdited.connect(self.edited)
        self._cb_location.currentIndexChanged.connect(self.edited)
        self._wdg_position.edited.connect(self.edited)

        return layout
开发者ID:pyhmsa,项目名称:pyhmsa-gui,代码行数:34,代码来源:acquisition.py


示例19: __init__

    def __init__(self):
        # how connect
        super(buttonwidget, self).__init__()
        self.grid = QGridLayout()
        self.btnConnect = QPushButton("Connect")
        self.grid.addWidget(self.btnConnect, 0, 0, 1, 5)

        self.btnLock = QPushButton("Lock Cassette")
        self.grid.addWidget(self.btnLock, 1, 0, 1, 5)

        self.btnPurge = QPushButton("Purge")
        self.grid.addWidget(self.btnPurge, 2, 0, 1, 2)

        self.cbxPurgeType = QComboBox()
        self.cbxPurgeType.addItems(["Normal", "Extended", "Add Conditioner", "Custom"])
        self.grid.addWidget(self.cbxPurgeType, 2, 2, 1, 2)

        self.txtNumPurge = QLineEdit()
        self.grid.addWidget(self.txtNumPurge, 2, 4, 1, 1)

        self.btnRecover = QPushButton("Recover")
        self.grid.addWidget(self.btnRecover, 3, 0, 1, 5)

        self.btnHelp = QPushButton("Help")
        self.grid.addWidget(self.btnHelp, 4, 0, 1, 5)

        self.setLayout(self.grid)
开发者ID:dangraf,项目名称:PycharmProjects,代码行数:27,代码来源:button_panel.py


示例20: setup

    def setup(self, fname):
        """Setup Run Configuration dialog with filename *fname*"""
        combo_label = QLabel(_("Select a run configuration:"))
        self.combo = QComboBox()
        self.combo.setMaxVisibleItems(20)
        self.combo.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength)
        self.combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        
        self.stack = QStackedWidget()

        configurations = _get_run_configurations()
        for index, (filename, options) in enumerate(configurations):
            if fname == filename:
                break
        else:
            # There is no run configuration for script *fname*:
            # creating a temporary configuration that will be kept only if
            # dialog changes are accepted by the user
            configurations.insert(0, (fname, RunConfiguration(fname).get()))
            index = 0
        for filename, options in configurations:
            widget = RunConfigOptions(self)
            widget.set(options)
            self.combo.addItem(filename)
            self.stack.addWidget(widget)
        self.combo.currentIndexChanged.connect(self.stack.setCurrentIndex)
        self.combo.setCurrentIndex(index)

        self.add_widgets(combo_label, self.combo, 10, self.stack)
        self.add_button_box(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)

        self.setWindowTitle(_("Run configuration per file"))
开发者ID:burrbull,项目名称:spyder,代码行数:32,代码来源:runconfig.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python QtWidgets.QDialog类代码示例发布时间:2022-05-26
下一篇:
Python QtWidgets.QCheckBox类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap