Python PyQt5.QtWidgets 模块,QComboBox() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt5.QtWidgets.QComboBox()

项目:PySAT_Point_Spectra_GUI    作者:USGS-Astrogeology    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        self.gridLayout = QtWidgets.QGridLayout(Form)
        self.gridLayout.setObjectName("gridLayout")
        self.chooseDataLabel = QtWidgets.QLabel(Form)
        self.chooseDataLabel.setObjectName("chooseDataLabel")
        self.gridLayout.addWidget(self.chooseDataLabel, 0, 0, 1, 1)
        self.chooseDataComboBox = QtWidgets.QComboBox(Form)
        self.chooseDataComboBox.setObjectName("chooseDataComboBox")
        self.gridLayout.addWidget(self.chooseDataComboBox, 0, 1, 1, 1)
        self.refreshTablePushButton = QtWidgets.QPushButton(Form)
        self.refreshTablePushButton.setObjectName("refreshTablePushButton")
        self.gridLayout.addWidget(self.refreshTablePushButton, 2, 1, 1, 1)
        self.tableView = QtWidgets.QTableView(Form)
        self.tableView.setObjectName("tableView")
        self.gridLayout.addWidget(self.tableView, 4, 0, 1, 2)
        self.refreshDataPushButton = QtWidgets.QPushButton(Form)
        self.refreshDataPushButton.setObjectName("refreshDataPushButton")
        self.gridLayout.addWidget(self.refreshDataPushButton, 1, 1, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:taobao    作者:laogewen    | 项目源码 | 文件源码
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(564, 270)
        self.centralWidget = QtWidgets.QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        self.pushButton = QtWidgets.QPushButton(self.centralWidget)
        self.pushButton.setGeometry(QtCore.QRect(320, 60, 93, 28))
        self.pushButton.setObjectName("pushButton")
        self.textEdit = QtWidgets.QTextEdit(self.centralWidget)
        self.textEdit.setGeometry(QtCore.QRect(60, 60, 151, 31))
        self.textEdit.setObjectName("textEdit")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralWidget)
        self.pushButton_2.setGeometry(QtCore.QRect(320, 150, 111, 28))
        self.pushButton_2.setObjectName("pushButton_2")
        self.label = QtWidgets.QLabel(self.centralWidget)
        self.label.setGeometry(QtCore.QRect(60, 30, 151, 16))
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralWidget)
        self.label_2.setGeometry(QtCore.QRect(60, 110, 151, 41))
        self.label_2.setObjectName("label_2")
        self.comboBox = QtWidgets.QComboBox(self.centralWidget)
        self.comboBox.setGeometry(QtCore.QRect(60, 160, 87, 22))
        self.comboBox.setObjectName("comboBox")
        MainWindow.setCentralWidget(self.centralWidget)
        self.menuBar = QtWidgets.QMenuBar(MainWindow)
        self.menuBar.setGeometry(QtCore.QRect(0, 0, 564, 26))
        self.menuBar.setObjectName("menuBar")
        MainWindow.setMenuBar(self.menuBar)
        self.mainToolBar = QtWidgets.QToolBar(MainWindow)
        self.mainToolBar.setObjectName("mainToolBar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
        self.statusBar = QtWidgets.QStatusBar(MainWindow)
        self.statusBar.setObjectName("statusBar")
        MainWindow.setStatusBar(self.statusBar)

        self.comboBox.addItems(["%s" % x for x in range(1, 100)])
        self.pushButton.clicked.connect(self.start)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app ):
        super().__init__( app, T_('Shell') )

        if self.app is None:
            self.prefs = None
        else:
            self.prefs = self.app.prefs.shell

        terminal_program_list = wb_shell_commands.getTerminalProgramList()
        file_browser_program_list = wb_shell_commands.getFileBrowserProgramList()

        self.terminal_program = QtWidgets.QComboBox()
        self.terminal_program.addItems( terminal_program_list )
        self.terminal_init = QtWidgets.QLineEdit( '' )
        self.file_browser_program = QtWidgets.QComboBox()
        self.file_browser_program.addItems( file_browser_program_list )

        if self.prefs is not None:
            self.terminal_program.setCurrentText( self.prefs.terminal_program )
            self.terminal_init.setText( self.prefs.terminal_init )
            self.file_browser_program.setCurrentText( self.prefs.file_browser )

        self.addRow( T_('Terminal Program'), self.terminal_program )
        self.addRow( T_('Terminal Init Command'), self.terminal_init )
        self.addRow( T_('File Browser Program'), self.file_browser_program )
项目:sequana    作者:sequana    | 项目源码 | 文件源码
def get_settings(self):
        # get all items to save in settings
        items = {}
        names = self._get_widget_names()
        for name in names:
            widget = getattr(self.ui, name)
            if isinstance(widget, QW.QLineEdit):
                value = widget.text()
            elif isinstance(widget, QW.QSpinBox):
                value = widget.value()
            elif isinstance(widget, QW.QCheckBox):
                value = widget.isChecked()
            elif isinstance(widget, QW.QComboBox):
                value = widget.currentText()
            else:
                raise NotImplementedError("for developers")
            items[name] = value
        items["tab_position"] = self.ui.tabs.currentIndex()
        return items
项目:axopy    作者:ucdrascal    | 项目源码 | 文件源码
def __init__(self, configurations=None, parent=None):
        super(SessionInfoWidget, self).__init__(parent=parent)

        main_layout = QtWidgets.QVBoxLayout()
        self.setLayout(main_layout)

        form_layout = QtWidgets.QFormLayout()
        form_layout.setFormAlignment(QtCore.Qt.AlignVCenter)
        main_layout.addLayout(form_layout)

        if configurations is not None:
            self._config_combo_box = QtWidgets.QComboBox()
            form_layout.addRow("Configuration", self._config_combo_box)

            for config in configurations:
                self._config_combo_box.addItem(config)

        self._subject_line_edit = QtWidgets.QLineEdit()
        form_layout.addRow("Subject", self._subject_line_edit)

        self._button = QtWidgets.QPushButton("Start")
        main_layout.addWidget(self._button)

        self._button.clicked.connect(self._on_button_click)
项目:Milis-Yukleyici    作者:sonakinci41    | 项目源码 | 文件源码
def __init__(self, ebeveyn=None):
        super(Konum, self).__init__(ebeveyn)
        self.e = ebeveyn
        kutu = QGridLayout()
        kutu.setAlignment(Qt.AlignCenter)
        self.setLayout(kutu)
        self.bigli_label = QLabel()
        kutu.addWidget(self.bigli_label,0,0,1,2)

        self.harita = HaritaWidget(self)
        kutu.addWidget(self.harita,1,0,1,2)

        self.bolge_label = QLabel()
        kutu.addWidget(self.bolge_label,2,0,1,1)

        self.sehir_label = QLabel()
        kutu.addWidget(self.sehir_label,2,1,1,1)

        self.bolge_combo = QComboBox()
        self.bolge_combo.currentTextChanged.connect(self.sehir_combo_doldur)
        kutu.addWidget(self.bolge_combo,3,0,1,1)
        self.sehir_combo = QComboBox()
        self.sehir_combo.currentTextChanged.connect(self.sehir_combo_degisti)
        kutu.addWidget(self.sehir_combo,3,1,1,1)
        self.bolge_combo_doldur()
        self.bolge_combo.setCurrentText("Europe")
        self.sehir_combo.setCurrentText("Istanbul")
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def __init__(self, text, items_list = None, default_item = None, parent = None):
        """
        Initialization of the CfgComboBox class (drop-down menu).
        @param text: text string associated with the combobox
        @param items_list: string list containing all the available options
        @param default_item: string containing the default selected item
        """
        QWidget.__init__(self, parent)

        self.combobox = QComboBox(parent)

        if isinstance(items_list, (list, tuple)):
            self.setSpec({'string_list': items_list, 'comment': ''})
        if default_item is not None:
            self.setValue(default_item)

        self.label = QLabel(text, parent)
        self.layout = QHBoxLayout(parent);

        self.combobox.setMinimumWidth(200) #Provide better alignment with other items
        self.layout.addWidget(self.label)
        self.layout.addStretch()
        self.layout.addWidget(self.combobox)
        self.setLayout(self.layout)
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def __init__(self):
        QWidget.__init__(self)

        layout=QVBoxLayout()
        label=QLabel()
        label.setText(_("Modulation type"))
        layout.addWidget(label)

        self.mode = QComboBox(self)
        self.mode.setEditable(False)

        layout.addWidget(self.mode)

        self.setLayout(layout)

        self.update()

        self.mode.currentIndexChanged.connect(self.call_back_mode_changed)
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def tab_set_value(tab,y,x,value):
    if type(tab.cellWidget(y, x))==QComboBox:
        tab.cellWidget(y, x).blockSignals(True)
        tab.cellWidget(y, x).setCurrentIndex(tab.cellWidget(y, x).findText(value))
        tab.cellWidget(y, x).blockSignals(False)
    elif type(tab.cellWidget(y, x))==QComboBoxLang:
        tab.cellWidget(y, x).blockSignals(True)
        tab.cellWidget(y, x).setCurrentIndex(tab.cellWidget(y, x).findText(value))
        tab.cellWidget(y, x).blockSignals(False)
    elif type(tab.cellWidget(y,x))==gpvdm_select:
        tab.cellWidget(y, x).blockSignals(True)
        tab.cellWidget(y, x).setText(value)
        tab.cellWidget(y, x).blockSignals(False)
    elif type(tab.cellWidget(y,x))==gtkswitch:
        tab.cellWidget(y, x).blockSignals(True)
        tab.cellWidget(y, x).set_value(str2bool(value))
        tab.cellWidget(y, x).blockSignals(False)
    else:
        item = QTableWidgetItem(str(value))
        tab.setItem(y,x,item)
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def callback_edit(self, file_name,token,widget):
        if type(widget)==QLineEdit:
            a=undo_list_class()
            a.add([file_name, token, inp_get_token_value(self.file_name, token),widget])
            inp_update_token_value(file_name, token, widget.text())
        elif type(widget)==gtkswitch:
            inp_update_token_value(file_name, token, widget.get_value())
        elif type(widget)==leftright:
            inp_update_token_value(file_name, token, widget.get_value())
        elif type(widget)==gpvdm_select:
            inp_update_token_value(file_name, token, widget.text())
        elif type(widget)==QComboBox:
            inp_update_token_value(file_name, token, widget.itemText(widget.currentIndex()))
        elif type(widget)==QComboBoxLang:
            inp_update_token_value(file_name, token, widget.currentText_english())
        elif type(widget)==QColorPicker:
            inp_update_token_array(file_name, token, [str(widget.r),str(widget.g),str(widget.b)])
        elif type(widget)==QChangeLog:
            a=undo_list_class()
            a.add([file_name, token, inp_get_token_value(self.file_name, token),widget])
            inp_update_token_array(file_name, token, widget.toPlainText().split("\n"))

        help_window().help_set_help(["document-save-as","<big><b>Saved to disk</b></big>\n"])

        self.changed.emit()
项目:Py2DSpectroscopy    作者:SvenBo90    | 项目源码 | 文件源码
def __init__(self, map_tab_widget):

        # set object name
        map_tab_widget.setObjectName("mapTab")

        # create plot widget
        self.plot_widget = QWidget(map_tab_widget)
        self.plot_widget.setGeometry(QRect(10, 10, 600, 350))
        self.plot_widget.setObjectName("plotWidget")

        # create toolbar widget
        self.toolbar_widget = QWidget(map_tab_widget)
        self.toolbar_widget.setGeometry(QRect(10, 350, 450, 80))
        self.toolbar_widget.setObjectName("toolbarWidget")

        # data selection box
        self.data_selection_combo_box = QComboBox(map_tab_widget)
        self.data_selection_combo_box.setGeometry(QRect(460, 360, 150, 30))
项目:Py2DSpectroscopy    作者:SvenBo90    | 项目源码 | 文件源码
def __init__(self, colormap_dialog):

        # set window title, object name and window size
        colormap_dialog.setWindowTitle("Choose Colormap")
        colormap_dialog.setObjectName("ColormapDialog")
        colormap_dialog.setFixedWidth(455)
        colormap_dialog.setFixedHeight(100)

        # button box
        self.button_box = QDialogButtonBox(colormap_dialog)
        self.button_box.setEnabled(True)
        self.button_box.setGeometry(QRect(10, 60, 435, 30))
        self.button_box.setOrientation(Qt.Horizontal)
        self.button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
        self.button_box.setObjectName("button_box")

        # colormap selector
        self.colormap_combobox = QComboBox(colormap_dialog)
        self.colormap_combobox.setGeometry(QRect(10, 10, 435, 30))
        self.colormap_combobox.setIconSize(QSize(435, 20))

        # connect accept and reject
        self.button_box.accepted.connect(colormap_dialog.accept)
        self.button_box.rejected.connect(colormap_dialog.reject)
项目:pisi-player    作者:mthnzbk    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__()
        self.parent = parent
        self.setVisible(False)
        self.setStyleSheet("QDialog {background-color: rgba(22, 22, 22, 150); border-color:  rgba(22, 22, 22, 150);" \
                           "border-width: 1px; border-style outset; border-radius: 10px; color:white; font-weight:bold;}")

        layout = QHBoxLayout()
        self.setLayout(layout)

        label = QLabel()
        label.setStyleSheet("QLabel {color:white;}")
        label.setText("Kodlama:")

        layout.addWidget(label)

        self.combobox = QComboBox()
        self.combobox.addItems(["ISO 8859-9", "UTF-8"])
        self.combobox.setStyleSheet("QComboBox {background-color: rgba(22, 22, 22, 150); border-color:  rgba(22, 22, 22, 150);" \
                           " color:white; font-weight:bold;}")
        self.combobox.setCurrentText(settings().value("Subtitle/codec"))

        layout.addWidget(self.combobox)

        self.combobox.currentTextChanged.connect(self.textCodecChange)
项目:crispy    作者:mretegan    | 项目源码 | 文件源码
def __init__(self, *args):
        super(PlotWidget, self).__init__(
            logScale=False, grid=True, yInverted=False,
            roi=False, mask=False, print_=False)
        self.setActiveCurveHandling(True)
        self.setGraphGrid('both')

        self.spectraComboBox = QComboBox()
        self.spectraComboBox.setMinimumWidth(150)

        # toolBar = self.toolBar()
        # toolBar = QToolBar()
        # self.addToolBar(Qt.TopToolBarArea, toolBar)
        # toolBar.addSeparator()
        # position = PositionInfo(plot=self)
        # toolBar.addWidget(position)

        # limitsToolBar = LimitsToolBar(plot=self)
        # self.addToolBar(Qt.BottomToolBarArea, limitsToolBar)

        # toolbar = self.toolBar()
        # toolbar.addSeparator()
        # toolbar.addWidget(self.spectraComboBox)
项目:lilii    作者:LimeLinux    | 项目源码 | 文件源码
def __init__(self, parent):
        super().__init__()
        self.parent = parent
        self.setFixedSize(300, 150)
        self.setLayout(QVBoxLayout())

        hlayout = QHBoxLayout()
        self.layout().addLayout(hlayout)

        label = QLabel()
        label.setText(self.tr("Mount Point:"))
        hlayout.addWidget(label)

        self.combobox = QComboBox()
        hlayout.addWidget(self.combobox)

        self.dialbutton = QDialogButtonBox()
        self.dialbutton.setStandardButtons(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
        self.layout().addWidget(self.dialbutton)

        self.dialbutton.button(QDialogButtonBox.Ok).setText(self.tr("Ok"))
        self.dialbutton.button(QDialogButtonBox.Cancel).setText(self.tr("Cancel"))

        self.dialbutton.accepted.connect(self.editAccept)
        self.dialbutton.rejected.connect(self.close)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def setupUi(self, SchemaMainWindow):
        SchemaMainWindow.setObjectName("SchemaMainWindow")
        SchemaMainWindow.resize(417, 594)
        self.centralwidget = QtWidgets.QWidget(SchemaMainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.schemaLabel = QtWidgets.QLabel(self.centralwidget)
        self.schemaLabel.setObjectName("schemaLabel")
        self.gridLayout.addWidget(self.schemaLabel, 0, 0, 1, 2)
        self.schemaSelection = QtWidgets.QComboBox(self.centralwidget)
        self.schemaSelection.setObjectName("schemaSelection")
        self.gridLayout.addWidget(self.schemaSelection, 0, 2, 1, 2)
        self.schemaView = QtWidgets.QTextBrowser(self.centralwidget)
        self.schemaView.setObjectName("schemaView")
        self.gridLayout.addWidget(self.schemaView, 1, 0, 1, 4)
        self.instanceLabel = QtWidgets.QLabel(self.centralwidget)
        self.instanceLabel.setObjectName("instanceLabel")
        self.gridLayout.addWidget(self.instanceLabel, 2, 0, 1, 2)
        self.instanceSelection = QtWidgets.QComboBox(self.centralwidget)
        self.instanceSelection.setObjectName("instanceSelection")
        self.gridLayout.addWidget(self.instanceSelection, 2, 2, 1, 2)
        self.instanceEdit = QtWidgets.QTextEdit(self.centralwidget)
        self.instanceEdit.setObjectName("instanceEdit")
        self.gridLayout.addWidget(self.instanceEdit, 3, 0, 1, 4)
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 4, 0, 1, 1)
        self.validationStatus = QtWidgets.QLabel(self.centralwidget)
        self.validationStatus.setObjectName("validationStatus")
        self.gridLayout.addWidget(self.validationStatus, 4, 1, 1, 2)
        self.validateButton = QtWidgets.QPushButton(self.centralwidget)
        self.validateButton.setObjectName("validateButton")
        self.gridLayout.addWidget(self.validateButton, 4, 3, 1, 1)
        SchemaMainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(SchemaMainWindow)
        self.statusbar.setObjectName("statusbar")
        SchemaMainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(SchemaMainWindow)
        QtCore.QMetaObject.connectSlotsByName(SchemaMainWindow)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def setupUi(self, SchemaMainWindow):
        SchemaMainWindow.setObjectName("SchemaMainWindow")
        SchemaMainWindow.resize(417, 594)
        self.centralwidget = QtWidgets.QWidget(SchemaMainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.schemaLabel = QtWidgets.QLabel(self.centralwidget)
        self.schemaLabel.setObjectName("schemaLabel")
        self.gridLayout.addWidget(self.schemaLabel, 0, 0, 1, 2)
        self.schemaSelection = QtWidgets.QComboBox(self.centralwidget)
        self.schemaSelection.setObjectName("schemaSelection")
        self.gridLayout.addWidget(self.schemaSelection, 0, 2, 1, 2)
        self.schemaView = QtWidgets.QTextBrowser(self.centralwidget)
        self.schemaView.setObjectName("schemaView")
        self.gridLayout.addWidget(self.schemaView, 1, 0, 1, 4)
        self.instanceLabel = QtWidgets.QLabel(self.centralwidget)
        self.instanceLabel.setObjectName("instanceLabel")
        self.gridLayout.addWidget(self.instanceLabel, 2, 0, 1, 2)
        self.instanceSelection = QtWidgets.QComboBox(self.centralwidget)
        self.instanceSelection.setObjectName("instanceSelection")
        self.gridLayout.addWidget(self.instanceSelection, 2, 2, 1, 2)
        self.instanceEdit = QtWidgets.QTextEdit(self.centralwidget)
        self.instanceEdit.setObjectName("instanceEdit")
        self.gridLayout.addWidget(self.instanceEdit, 3, 0, 1, 4)
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 4, 0, 1, 1)
        self.validationStatus = QtWidgets.QLabel(self.centralwidget)
        self.validationStatus.setObjectName("validationStatus")
        self.gridLayout.addWidget(self.validationStatus, 4, 1, 1, 2)
        self.validateButton = QtWidgets.QPushButton(self.centralwidget)
        self.validateButton.setObjectName("validateButton")
        self.gridLayout.addWidget(self.validateButton, 4, 3, 1, 1)
        SchemaMainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(SchemaMainWindow)
        self.statusbar.setObjectName("statusbar")
        SchemaMainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(SchemaMainWindow)
        QtCore.QMetaObject.connectSlotsByName(SchemaMainWindow)
项目:Laborejo    作者:hilbrichtsoftware    | 项目源码 | 文件源码
def __init__(self, mainWindow, what):
        super().__init__(mainWindow, "Transpose {}".format(what.title()))
        assert what in ("item", "score")
        self.what = what

        self.layout.insertRow(0, QtWidgets.QLabel("Construct Interval from relative distance"))

        self.fromNote = QtWidgets.QComboBox()
        self.fromNote.addItems(constantsAndConfigs.sortedNoteNameList)
        self.fromNote.setCurrentIndex(constantsAndConfigs.sortedNoteNameList.index("c'"))
        self.layout.addRow("from", self.fromNote)

        self.to = QtWidgets.QComboBox()
        self.to.addItems(constantsAndConfigs.sortedNoteNameList)
        self.to.setCurrentIndex(constantsAndConfigs.sortedNoteNameList.index("c'"))
        self.layout.addRow("to", self.to)
        self.__call__()
项目:idasec    作者:RobinDavid    | 项目源码 | 文件源码
def add_input_action(self):
        self.inputs_table.setRowCount(self.inputs_table.rowCount()+1)
        i = self.inputs_table.rowCount()-1
        type_combo = QtWidgets.QComboBox()
        type_combo.addItems(["REG", "MEM"])
        action_combo = QtWidgets.QComboBox()
        action_combo.addItems(["DEFAULT", "PATCH", "CONC", "SYMB", "IGNORE"])
        when_combo = QtWidgets.QComboBox()
        when_combo.addItems(["BEFORE", "AFTER"])
        info = [type_combo, QtWidgets.QTableWidgetItem(), QtWidgets.QTableWidgetItem(), QtWidgets.QTableWidgetItem(),
                action_combo, when_combo]

        for col_id, widget in enumerate(info):
            if isinstance(widget, QtWidgets.QTableWidgetItem):
                self.inputs_table.setItem(i, col_id, widget)
            else:
                self.inputs_table.setCellWidget(i, col_id, widget)
        return i
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def __init__(self):
        QWidget.__init__(self, flags=Qt.Widget)
        # ?? ??
        self.gb = QGroupBox(self.tr("Serial"))
        self.cb_port = QComboBox()
        self.cb_baud_rate = QComboBox()
        self.cb_data_bits = QComboBox()
        self.cb_flow_control = QComboBox()
        self.cb_parity = QComboBox()
        self.cb_stop_bits = QComboBox()

        # ??? ???? ??
        # ??? ??? ?? ? ??
        self.serial = QSerialPort()
        self.serial_info = QSerialPortInfo()
        self.serial_read_thread = SerialReadThread(self.serial)
        self.serial_read_thread.received_data.connect(lambda v: self.received_data.emit(v))
        self.serial_read_thread.start()

        self.init_widget()
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def init_widget(self):
        """
        ?? ??? ???? ???
        """
        self.setWindowTitle("QComboBox Widget")
        form_lbx = QBoxLayout(QBoxLayout.TopToBottom, parent=self)
        self.setLayout(form_lbx)

        lb = QLabel()

        qb = QComboBox()
        qb.addItem("Banana")  # ?? ??? ???
        qb.addItems(["Apple", "Tomato", "Carrot"])  # ?? ??? ???
        qb.insertSeparator(2)  # ?? ?
        qb.currentTextChanged.connect(lb.setText)  # ?? ???? ???? ?? ?

        form_lbx.addWidget(qb)
        form_lbx.addWidget(lb)
项目:OpenTutorials_PyQt    作者:RavenKyu    | 项目源码 | 文件源码
def init_widget(self):
        self.setWindowTitle("QComboBox Widget")
        self.setMinimumWidth(150)
        form_lbx = QBoxLayout(QBoxLayout.TopToBottom, parent=self)
        self.setLayout(form_lbx)

        data = [
            {"name": "Apple", "image": IMAGE_PATH + "apple.jpg"},
            {"name": "Banana", "image": IMAGE_PATH + "banana.jpg"}
        ]
        model = UserModel(data)

        lb = QLabel()

        qb = QComboBox()
        qb.setModel(model)
        qb.currentTextChanged.connect(lb.setText)  # ?? ???? ???? ?? ?

        form_lbx.addWidget(qb)
        form_lbx.addWidget(lb)
项目:PySAT_Point_Spectra_GUI    作者:USGS-Astrogeology    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        self.verticalLayout = QtWidgets.QVBoxLayout(Form)
        self.verticalLayout.setObjectName("verticalLayout")
        self.groupBox = QtWidgets.QGroupBox(Form)
        self.groupBox.setObjectName("groupBox")
        self.gridLayout = QtWidgets.QGridLayout(self.groupBox)
        self.gridLayout.setObjectName("gridLayout")
        self.renameDataLabel = QtWidgets.QLabel(self.groupBox)
        self.renameDataLabel.setObjectName("renameDataLabel")
        self.gridLayout.addWidget(self.renameDataLabel, 0, 0, 1, 1)
        self.renameDataComboBox = QtWidgets.QComboBox(self.groupBox)
        self.renameDataComboBox.setObjectName("renameDataComboBox")
        self.gridLayout.addWidget(self.renameDataComboBox, 0, 1, 1, 1)
        self.toDataLabel = QtWidgets.QLabel(self.groupBox)
        self.toDataLabel.setObjectName("toDataLabel")
        self.gridLayout.addWidget(self.toDataLabel, 0, 2, 1, 1)
        self.toDataLineEdit = QtWidgets.QLineEdit(self.groupBox)
        self.toDataLineEdit.setObjectName("toDataLineEdit")
        self.gridLayout.addWidget(self.toDataLineEdit, 0, 3, 1, 1)
        self.verticalLayout.addWidget(self.groupBox)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:PySAT_Point_Spectra_GUI    作者:USGS-Astrogeology    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
        Form.setSizePolicy(sizePolicy)
        self.verticalLayout = QtWidgets.QVBoxLayout(Form)
        self.verticalLayout.setObjectName("verticalLayout")
        self.formGroupBox = QtWidgets.QGroupBox(Form)
        self.formGroupBox.setObjectName("formGroupBox")
        self.formLayout = QtWidgets.QFormLayout(self.formGroupBox)
        self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout.setObjectName("formLayout")
        self.chooseDataToDerivLabel = QtWidgets.QLabel(self.formGroupBox)
        self.chooseDataToDerivLabel.setObjectName("chooseDataToDerivLabel")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.chooseDataToDerivLabel)
        self.chooseDataToDerivComboBox = QtWidgets.QComboBox(self.formGroupBox)
        self.chooseDataToDerivComboBox.setObjectName("chooseDataToDerivComboBox")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.chooseDataToDerivComboBox)
        self.verticalLayout.addWidget(self.formGroupBox)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:blog    作者:benhoff    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        self.label = QtWidgets.QLabel()
        number_label = QtWidgets.QLabel('Number of Pictures to Take')
        self.number_chooser = QtWidgets.QComboBox()
        self.number_chooser.addItems(['4', '5', '6', '7', '8', '9', '10'])
        self.delay_label = QtWidgets.QLabel('Number of Seconds to Delay')
        self.delay_chooser = QtWidgets.QComboBox()
        self.delay_chooser.addItems(['1', '1.5', '2', '4', '5', '7', '10'])

        self.go_button = QtWidgets.QPushButton('Run')

        form_layout = QtWidgets.QFormLayout()
        form_layout.addRow(number_label, self.number_chooser)
        form_layout.addRow(self.delay_label, self.delay_chooser)

        layout = QtWidgets.QVBoxLayout()
        layout.addLayout(form_layout)
        layout.addWidget(self.label)
        layout.addWidget(self.go_button)

        self.setLayout(layout)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def setupUi(self, SchemaMainWindow):
        SchemaMainWindow.setObjectName("SchemaMainWindow")
        SchemaMainWindow.resize(417, 594)
        self.centralwidget = QtWidgets.QWidget(SchemaMainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.schemaLabel = QtWidgets.QLabel(self.centralwidget)
        self.schemaLabel.setObjectName("schemaLabel")
        self.gridLayout.addWidget(self.schemaLabel, 0, 0, 1, 2)
        self.schemaSelection = QtWidgets.QComboBox(self.centralwidget)
        self.schemaSelection.setObjectName("schemaSelection")
        self.gridLayout.addWidget(self.schemaSelection, 0, 2, 1, 2)
        self.schemaView = QtWidgets.QTextBrowser(self.centralwidget)
        self.schemaView.setObjectName("schemaView")
        self.gridLayout.addWidget(self.schemaView, 1, 0, 1, 4)
        self.instanceLabel = QtWidgets.QLabel(self.centralwidget)
        self.instanceLabel.setObjectName("instanceLabel")
        self.gridLayout.addWidget(self.instanceLabel, 2, 0, 1, 2)
        self.instanceSelection = QtWidgets.QComboBox(self.centralwidget)
        self.instanceSelection.setObjectName("instanceSelection")
        self.gridLayout.addWidget(self.instanceSelection, 2, 2, 1, 2)
        self.instanceEdit = QtWidgets.QTextEdit(self.centralwidget)
        self.instanceEdit.setObjectName("instanceEdit")
        self.gridLayout.addWidget(self.instanceEdit, 3, 0, 1, 4)
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 4, 0, 1, 1)
        self.validationStatus = QtWidgets.QLabel(self.centralwidget)
        self.validationStatus.setObjectName("validationStatus")
        self.gridLayout.addWidget(self.validationStatus, 4, 1, 1, 2)
        self.validateButton = QtWidgets.QPushButton(self.centralwidget)
        self.validateButton.setObjectName("validateButton")
        self.gridLayout.addWidget(self.validateButton, 4, 3, 1, 1)
        SchemaMainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(SchemaMainWindow)
        self.statusbar.setObjectName("statusbar")
        SchemaMainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(SchemaMainWindow)
        QtCore.QMetaObject.connectSlotsByName(SchemaMainWindow)
项目:opensnitch    作者:evilsocket    | 项目源码 | 文件源码
def init_widgets(self):
        self.app_name_label = self.findChild(QtWidgets.QLabel,
                                             "appNameLabel")
        self.message_label = self.findChild(QtWidgets.QLabel,
                                            "messageLabel")
        self.action_combo_box = self.findChild(QtWidgets.QComboBox,
                                               "actionComboBox")
        self.allow_button = self.findChild(QtWidgets.QPushButton,
                                           "allowButton")
        self.deny_button = self.findChild(QtWidgets.QPushButton,
                                          "denyButton")
        self.whitelist_button = self.findChild(QtWidgets.QPushButton,
                                               "whitelistButton")
        self.block_button = self.findChild(QtWidgets.QPushButton,
                                           "blockButton")
        self.icon_label = self.findChild(QtWidgets.QLabel, "iconLabel")
项目:pytc-gui    作者:harmslab    | 项目源码 | 文件源码
def layout(self):

        # --------------- Guess -----------------       
        self._guess = QW.QLineEdit()
        self._guess.editingFinished.connect(self._guess_handler)
        self._current_guess = None

        # --------------- Lower -----------------       
        self._lower = QW.QLineEdit()
        self._lower.editingFinished.connect(self._lower_handler)
        self._current_lower = None

        # --------------- Upper -----------------       
        self._upper = QW.QLineEdit()
        self._upper.editingFinished.connect(self._upper_handler)
        self._current_upper = None

        # --------------- Fixed -----------------
        self._fixed = QW.QCheckBox()
        self._fixed.stateChanged.connect(self._fixed_handler)
        self._current_fixed = None

        # --------------- Alias -----------------
        self._alias = QW.QComboBox()
        self._alias.addItem("Unlink")
        self._alias.addItem("Add global")
        self._alias.addItem("Add connector")
        self._alias.currentIndexChanged.connect(self._alias_handler)
        self._current_alias = None

        # Load in parameters from FitParameter object
        self.update()
项目:pytc-gui    作者:harmslab    | 项目源码 | 文件源码
def layout(self):
        """
        Populate the window.
        """

        self._main_layout = QW.QVBoxLayout(self)
        self._form_layout = QW.QFormLayout()

        # Combobox widget holding possible connectors
        self._connector_select_widget = QW.QComboBox(self)

        connector_names = list(self._fit.avail_connectors.keys())
        connector_names.sort()
        for n in connector_names:
            self._connector_select_widget.addItem(n)

        self._connector_select_widget.setCurrentIndex(0)
        self._connector_select_widget.activated.connect(self._update_dialog)

        # Input box holding name
        self._connector_name_input = QW.QLineEdit(self)
        self._connector_name_input.setText("connector")
        self._connector_name_input.textChanged.connect(self._update_connector_name)

        # Final OK button
        self._OK_button = QW.QPushButton("OK", self)
        self._OK_button.clicked.connect(self._ok_button_handler)

        # Add to form
        self._form_layout.addRow(QW.QLabel("Select Model:"), self._connector_select_widget)
        self._form_layout.addRow(QW.QLabel("Name:"), self._connector_name_input)

        # Populate widgets
        self._arg_widgets = {}
        self._update_dialog()

        # add to main layout
        self._main_layout.addLayout(self._form_layout)
        self._main_layout.addWidget(self._OK_button)

        self.setWindowTitle('Add new global connector')
项目:binja_dynamics    作者:nccgroup    | 项目源码 | 文件源码
def __init__(self, registers=None):
        super(RegisterWindow, self).__init__()
        self.setWindowTitle("Registers")
        self.setLayout(QtWidgets.QVBoxLayout())
        self._layout = self.layout()

        # Set up display mode combobox
        self._picker = QtWidgets.QComboBox()
        for mode in self._display_modes:
            self._picker.addItem(mode)
        self._picker.setCurrentIndex(2)
        self._layout.addWidget(self._picker)
        self._picker.currentIndexChanged.connect(self.change_display_mode)

        # Set up register table
        self._table = QtWidgets.QTableWidget()
        self._table.setColumnCount(2)
        self._table.setHorizontalHeaderLabels(['Register', 'Value'])
        self._table.horizontalHeader().setStretchLastSection(True)
        self._table.verticalHeader().setVisible(False)
        self._layout.addWidget(self._table)

        # Set up flag viewer
        self._flags = QtWidgets.QTableWidget()
        self._flags.setColumnCount(len(flagbits.keys()))
        self._flags.setHorizontalHeaderLabels(flagbits.keys())
        self._flags.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
        self._flags.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Fixed)
        self._flags.verticalHeader().setVisible(False)
        self._flags.setMaximumHeight(55)
        self._flags.setRowCount(1)
        for index, value in enumerate(flagnames):
            self._flags.horizontalHeaderItem(index).setToolTip(value)
        self._layout.addWidget(self._flags)

        self.setObjectName('Register_Window')

        self.should_clean = False

        if registers is not None:
            self.update_registers(registers)
项目:activity-browser    作者:LCA-ActivityBrowser    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        self.wizard = self.parent()
        self.description_label = QtWidgets.QLabel('Choose ecoinvent version and system model:')
        self.version_combobox = QtWidgets.QComboBox()
        self.system_model_combobox = QtWidgets.QComboBox()

        layout = QtWidgets.QGridLayout()
        layout.addWidget(self.description_label, 0, 0, 1, 3)
        layout.addWidget(QtWidgets.QLabel('Version: '), 1, 0)
        layout.addWidget(self.version_combobox, 1, 1, 1, 2)
        layout.addWidget(QtWidgets.QLabel('System model: '), 2, 0)
        layout.addWidget(self.system_model_combobox, 2, 1, 1, 2)
        self.setLayout(layout)
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, dialog, name, present, value, all_choices ):
        SingleProperty.__init__( self, dialog, name, present )

        value_ctrl = QtWidgets.QComboBox()
        value_ctrl.addItems( all_choices )

        if self.was_present:
            value_ctrl.setCurrentText( value )

        else:
            value_ctrl.setCurrentIndex( 0 )

        self.setValueCtrl( value_ctrl, value )
项目:sequana    作者:sequana    | 项目源码 | 文件源码
def __init__(self, option, value, values):
        super().__init__(option)
        self.choice = QW.QComboBox()
        self.choice.addItems(values)
        self.choice.setStyleSheet("QComboBox { selection-background-color: #5964FF; }");
        self.layout.addWidget(self.choice)
        self.choice.setCurrentText(value)
项目:sequana    作者:sequana    | 项目源码 | 文件源码
def read_settings(self):
        settings = QtCore.QSettings(self._application, self._section)
        for key in settings.allKeys():
            value = settings.value(key)
            try:
                # This is required to skip the tab_position key/value
                this = getattr(self.ui, key)
            except:
                continue
            if isinstance(this, QW.QLineEdit):
                this.setText(value)
            elif isinstance(this, QW.QSpinBox):
                this.setValue(int(value))
            elif isinstance(this, QW.QComboBox):
                index = this.findText(value)
                this.setCurrentIndex(index)
            elif isinstance(this, QW.QCheckBox):
                if value in ['false']:
                    this.setChecked(False)
                else:
                    this.setChecked(True)
            else:
                print('could not handle : %s' % this)
        # The last tab position
        self._tab_pos = settings.value("tab_position", 0, type=int)
        self.ui.tabs.setCurrentIndex(self._tab_pos)
项目:pymoskito    作者:cklb    | 项目源码 | 文件源码
def setEditorData(self, editor, index):
        if isinstance(editor, QComboBox):
            self.comboDel.setEditorData(editor, index)
        else:
            QItemDelegate.setEditorData(self, editor, index)
项目:pymoskito    作者:cklb    | 项目源码 | 文件源码
def setModelData(self, editor, model, index):
        if isinstance(editor, QComboBox):
            self.comboDel.setModelData(editor, model, index)
        else:
            QItemDelegate.setModelData(self, editor, model, index)
项目:pymoskito    作者:cklb    | 项目源码 | 文件源码
def createEditor(self, parent, option, index):
        editor = QComboBox(parent)
        editor.addItems(self.extract_entries(index))
        editor.currentIndexChanged.connect(self.current_index_changed)
        return editor
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def __init__(self, extraData, sheetview, sheethandler):
            super().__init__()

            self.setMinimumSize(200, 200)

            self.sheetview = sheetview
            self.sheethandler = sheethandler

            self.containerWidget = QWidget(self)
            self.containerWidget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
            self.containerWidgetLayout = QGridLayout(self.containerWidget)
            self.containerWidgetLayout.setContentsMargins(0, 0, 0, 0)


            self.sheetLabel = QLabel(self.containerWidget)
            self.sheetLabel.setText("Select sheet:")
            self.containerWidgetLayout.addWidget(self.sheetLabel, 0, 0, 1, 1)

            self.sheetCombobox = QComboBox(self.containerWidget)
            for sheet in self.sheethandler.sheets:
                if not sheet == self.sheethandler.currentSheet:
                    self.sheetCombobox.addItem(sheet.name)
            self.containerWidgetLayout.addWidget(self.sheetCombobox, 1, 0, 1, 1)

            self.okButton = QPushButton(self.containerWidget)
            self.okButton.setText("Ok")
            self.okButton.clicked.connect(self.okclicked)
            self.containerWidgetLayout.addWidget(self.okButton, 2, 0, 1, 1)
项目:PySAT    作者:USGS-Astrogeology    | 项目源码 | 文件源码
def make_combobox(choices):
    combo = QtWidgets.QComboBox()
    # combo.setMaximumWidth(200)
    font = QtGui.QFont()
    font.setPointSize(10)
    combo.setFont(font)
    for i, choice in enumerate(choices):
        combo.addItem("")
        combo.setItemText(i, choice)

    return combo
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def __init__(self, media_object, parent=None):
        super().__init__(parent)
        self.setWindowTitle('Preferences')
        self.form = QtWidgets.QFormLayout(self)
        server = media_object.container.server
        settings = server.container(media_object.key)
        self.ids = []
        for item in settings['_children']:
            itype = item['type']
            if itype == 'bool':
                input_widget = QtWidgets.QCheckBox()
                input_widget.setCheckState(QtCore.Qt.Checked if item['value'] == 'true' else QtCore.Qt.Unchecked)
            elif itype == 'enum':
                input_widget = QtWidgets.QComboBox()
                input_widget.addItems(item['values'].split('|'))
                input_widget.setCurrentIndex(int(item['value']))
            elif itype == 'text':
                input_widget = QtWidgets.QLineEdit(item['value'])
                if item['secure'] == 'true':
                    input_widget.setEchoMode(QtWidgets.QLineEdit.PasswordEchoOnEdit)
            else:
                input_widget = QtWidgets.QLabel('...')
            self.form.addRow(QtWidgets.QLabel(item['label']), input_widget)
            self.ids.append((item['id'], input_widget))

        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self)
        self.form.addRow(self.buttons)
        self.buttons.rejected.connect(self.reject)
        self.buttons.accepted.connect(self.accept)
        if self.exec_() == QtWidgets.QDialog.Accepted:
            media_object.container.server.request(media_object.key + '/set', params=self.extract_values())
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def extract_values(self):
        values = {}
        for pid, widget in self.ids:
            if isinstance(widget, QtWidgets.QLineEdit):
                values[pid] = widget.text()
            elif isinstance(widget, QtWidgets.QComboBox):
                values[pid] = widget.currentIndex()
            elif isinstance(widget, QtWidgets.QCheckBox):
                values[pid] = 'true' if widget.checkState() == QtCore.Qt.Checked else 'false'
        return values
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        s = plexdesktop.settings.Settings()
        self.setWindowTitle('Preferences')
        self.form = QtWidgets.QFormLayout(self)

        i = QtWidgets.QComboBox()
        i.addItems(plexdesktop.style.Style.Instance().themes)
        i.setCurrentIndex(i.findText(s.value('theme')))
        self.form.addRow(QtWidgets.QLabel('theme'), i)

        bf = QtWidgets.QSpinBox()
        bf.setValue(int(s.value('browser_font', 9)))
        self.form.addRow(QtWidgets.QLabel('browser font size'), bf)

        icon_size = QtWidgets.QLineEdit(str(s.value('thumb_size', 240)))
        icon_size.setValidator(QtGui.QIntValidator(0, 300))
        self.form.addRow(QtWidgets.QLabel('thumbnail size'), icon_size)

        widget_player = QtWidgets.QCheckBox()
        widget_player.setCheckState(QtCore.Qt.Checked if bool(int(s.value('widget_player', 0))) else QtCore.Qt.Unchecked)
        self.form.addRow(QtWidgets.QLabel('use widget player'), widget_player)

        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal, self)
        self.form.addRow(self.buttons)
        self.buttons.rejected.connect(self.reject)
        self.buttons.accepted.connect(self.accept)

        if self.exec_() == QtWidgets.QDialog.Accepted:
            # s = Settings()
            theme = i.currentText()
            s.setValue('theme', theme)
            plexdesktop.style.Style.Instance().theme(theme)

            s.setValue('browser_font', bf.value())

            s.setValue('thumb_size', int(icon_size.text()))

            s.setValue('widget_player', 1 if widget_player.checkState() == QtCore.Qt.Checked else 0)
项目:binja_dynamics    作者:ehennenfent    | 项目源码 | 文件源码
def __init__(self, registers=None):
        super(RegisterWindow, self).__init__()
        self.setWindowTitle("Registers")
        self.setLayout(QtWidgets.QVBoxLayout())
        self._layout = self.layout()

        # Set up display mode combobox
        self._picker = QtWidgets.QComboBox()
        for mode in self._display_modes:
            self._picker.addItem(mode)
        self._picker.setCurrentIndex(2)
        self._layout.addWidget(self._picker)
        self._picker.currentIndexChanged.connect(self.change_display_mode)

        # Set up register table
        self._table = QtWidgets.QTableWidget()
        self._table.setColumnCount(2)
        self._table.setHorizontalHeaderLabels(['Register', 'Value'])
        self._table.horizontalHeader().setStretchLastSection(True)
        self._table.verticalHeader().setVisible(False)
        self._layout.addWidget(self._table)

        # Set up flag viewer
        self._flags = QtWidgets.QTableWidget()
        self._flags.setColumnCount(len(flagbits.keys()))
        self._flags.setHorizontalHeaderLabels(flagbits.keys())
        self._flags.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
        self._flags.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Fixed)
        self._flags.verticalHeader().setVisible(False)
        self._flags.setMaximumHeight(55)
        self._flags.setRowCount(1)
        for index, value in enumerate(flagnames):
            self._flags.horizontalHeaderItem(index).setToolTip(value)
        self._layout.addWidget(self._flags)

        self.setObjectName('Register_Window')

        self.should_clean = False

        if registers is not None:
            self.update_registers(registers)
项目:BAG_framework    作者:ucb-art    | 项目源码 | 文件源码
def __init__(self):
        QtWidgets.QWidget.__init__(self)

        # combo box label
        self.label = QtWidgets.QLabel('Log File: ', parent=self)
        # populate log selection combo box.
        self.combo_box = QtWidgets.QComboBox(parent=self)
        self.log_files = []
        self.reader = None

        self.logger = LogWidget(parent=self)

        # setup GUI
        self.setWindowTitle('BAG Simulation Log Viewer')
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        self.layout = QtWidgets.QGridLayout(self)
        self.layout.addWidget(self.label, 0, 0, alignment=QtCore.Qt.AlignRight)
        self.layout.addWidget(self.combo_box, 0, 1, alignment=QtCore.Qt.AlignLeft)
        self.layout.addWidget(self.logger, 1, 0, -1, -1)
        self.layout.setRowStretch(0, 0.0)
        self.layout.setRowStretch(1, 1.0)
        self.layout.setColumnStretch(0, 0.0)
        self.layout.setColumnStretch(1, 0.0)

        # setup file watcher
        self.cur_paths = None
        self.watcher = QtCore.QFileSystemWatcher(parent=self)
        # setup signals
        self.watcher.fileChanged.connect(self.update_logfile)
        self.combo_box.currentIndexChanged.connect(self.change_log)

        # start thread
        self.thread = StdinThread(self)
        self.thread.update.connect(self.parse_cmd)
        self.thread.start()
项目:Enibar    作者:ENIB    | 项目源码 | 文件源码
def __init__(self, cid, pid, name, cat_name, prices, percentage=None):
        QtWidgets.QComboBox.__init__(self)
        BaseProduct.__init__(self, cid, pid, name, cat_name, prices)
        self.product_view = QtWidgets.QListWidget()
        self.product_view.wheelEvent = self.on_wheel
        self.setModel(self.product_view.model())
        self.widgets = []
        self.call = None
        self.should_accept_adding_products = False

        self.name_item = QtWidgets.QListWidgetItem("")
        self.name_layout = QtWidgets.QHBoxLayout()
        self.setLayout(self.name_layout)

        if percentage:
            self.name_label = QtWidgets.QLabel(f"{name} <span style=\"color: red; font-size: 7px\">{percentage} °</span>", self)
        else:
            self.name_label = QtWidgets.QLabel(name)
        self.name_label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
        self.name_layout.addWidget(self.name_label)

        self.product_view.addItem(self.name_item)
        for price in prices:
            widget = QtWidgets.QListWidgetItem(price)
            widget.setTextAlignment(QtCore.Qt.AlignHCenter |
                QtCore.Qt.AlignVCenter)
            widget.setSizeHint(QtCore.QSize(100, 35))
            self.product_view.addItem(widget)

        self.setView(self.product_view)
        self.activated.connect(self.callback)
        self.product_view.pressed.connect(self.on_click)
项目:Enibar    作者:ENIB    | 项目源码 | 文件源码
def on_click(self, _):
        """ Called when we click on an item to close the QComboBox and not when
            we press enter. It allows us to add a product only in this case
        """
        self.should_accept_adding_products = True
项目:Enibar    作者:ENIB    | 项目源码 | 文件源码
def selection_changed(self):
        selected = [obj.text() for obj in self.note_list.selectedItems()]
        to_del = []

        if len(selected) > len(self.selected_notes):  # Something was added
            for note in selected:
                if note not in self.selected_notes:
                    cb = QtWidgets.QComboBox()
                    cb.addItems(["1/4", "1/2"] + list(map(str, range(1, 11))))
                    cb.setCurrentIndex(2)

                    item = QtWidgets.QTreeWidgetItem(self.selected_notes_report, [note, "1"])
                    self.selected_notes_report.setItemWidget(item, 1, cb)
                    item.setFlags(QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled)
                    self.selected_notes[note] = item
        else:
            for note in self.selected_notes:
                if note not in selected:
                    to_del.append(note)

        for note in to_del:
            item = self.selected_notes[note]
            del self.selected_notes[note]
            sip.delete(item)

        self.note_list.search_input.clear()
        self.note_list.search_input.setFocus(True)
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def __init__(self):
        QWidget.__init__(self)
        self.dump_dir=os.path.join(get_sim_path(),"light_dump")

        self.layout=QVBoxLayout()
        label=QLabel(_("Optical model")+":")
        self.layout.addWidget(label)

        self.cb = QComboBox()
        self.cb.activated.connect(self.on_cb_model_changed)
        self.layout.addWidget(self.cb)
        self.update()
        self.setLayout(self.layout)
        self.show()
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def tab_get_value(tab,y,x):
    if type(tab.cellWidget(y, x))==QComboBox:
        return tab.cellWidget(y, x).currentText()
    elif type(tab.cellWidget(y, x))==QComboBoxLang:
        return tab.cellWidget(y, x).currentText_english()
    elif type(tab.cellWidget(y,x))==gpvdm_select:
        return tab.cellWidget(y, x).text()
    elif type(tab.cellWidget(y,x))==leftright:
        return tab.cellWidget(y, x).get_value()
    elif type(tab.cellWidget(y,x))==gtkswitch:
        return tab.cellWidget(y, x).get_value()
    else:
        return tab.item(y, x).text()
项目:CRIkit2    作者:CoherentRamanNIST    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(389, 239)
        Dialog.setStyleSheet("font: 10pt \"Arial\";")
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtWidgets.QLabel(Dialog)
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(10)
        font.setItalic(False)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label, 0, QtCore.Qt.AlignTop)
        self.comboBox = QtWidgets.QComboBox(Dialog)
        self.comboBox.setObjectName("comboBox")
        self.verticalLayout.addWidget(self.comboBox)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem1)
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setObjectName("label_2")
        self.verticalLayout.addWidget(self.label_2)
        self.plainTextEditDescription = QtWidgets.QPlainTextEdit(Dialog)
        self.plainTextEditDescription.setReadOnly(True)
        self.plainTextEditDescription.setObjectName("plainTextEditDescription")
        self.verticalLayout.addWidget(self.plainTextEditDescription)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)