Python PyQt5.QtWidgets.QComboBox() Examples

The following are code examples for showing how to use PyQt5.QtWidgets.QComboBox(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 6 votes vote down vote up
def initLeakagePowerTabFrame(self):
        # self.leakagePowerTabFrame
        self.leakagePowerTabWhenLabel = QLabel('when:', self.leakagePowerTabFrame)
        self.leakagePowerTabWhenLabel.setAlignment(Qt.AlignRight)
        self.leakagePowerTabWhenCombo = QComboBox(self.leakagePowerTabFrame)
        self.leakagePowerTabWhenCombo.activated.connect(self.updateLeakagePowerTabRelatedPgPinCombo)

        self.leakagePowerTabRelatedPgPinLabel = QLabel('related_pg_pin:', self.leakagePowerTabFrame)
        self.leakagePowerTabRelatedPgPinLabel.setAlignment(Qt.AlignRight)
        self.leakagePowerTabRelatedPgPinCombo = QComboBox(self.leakagePowerTabFrame)
        self.leakagePowerTabRelatedPgPinCombo.activated.connect(self.updateLeakagePowerTabTable)

        self.leakagePowerTabEmptyLabel = QLabel('')

        # self.leakagePowerTabFrame - Grid
        leakagePowerTabFrameGrid = QGridLayout()

        leakagePowerTabFrameGrid.addWidget(self.leakagePowerTabWhenLabel, 0, 0)
        leakagePowerTabFrameGrid.addWidget(self.leakagePowerTabWhenCombo, 0, 1)
        leakagePowerTabFrameGrid.addWidget(self.leakagePowerTabRelatedPgPinLabel, 0, 2)
        leakagePowerTabFrameGrid.addWidget(self.leakagePowerTabRelatedPgPinCombo, 0, 3)
        leakagePowerTabFrameGrid.addWidget(self.leakagePowerTabEmptyLabel, 0, 4, 1, 6)

        self.leakagePowerTabFrame.setLayout(leakagePowerTabFrameGrid) 
Example 2
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 6 votes vote down vote up
def initTimingTabBundleBusFrame(self):
        # self.timingTabBundleBusFrame
        self.timingTabBundleLabel = QLabel('bundle:', self.timingTabBundleBusFrame)
        self.timingTabBundleLabel.setAlignment(Qt.AlignRight)
        self.timingTabBundleCombo = QComboBox(self.timingTabBundleBusFrame)
        self.timingTabBundleCombo.activated.connect(self.updateTimingTabPinCombo)

        self.timingTabBusLabel = QLabel('bus:', self.timingTabBundleBusFrame)
        self.timingTabBusLabel.setAlignment(Qt.AlignRight)
        self.timingTabBusCombo = QComboBox(self.timingTabBundleBusFrame)
        self.timingTabBusCombo.activated.connect(self.updateTimingTabPinCombo)

        # self.timingTabBundleBusFrame - Grid
        timingTabBundleBusFrameGrid = QGridLayout()

        timingTabBundleBusFrameGrid.addWidget(self.timingTabBundleLabel, 0, 0)
        timingTabBundleBusFrameGrid.addWidget(self.timingTabBundleCombo, 0, 1)
        timingTabBundleBusFrameGrid.addWidget(self.timingTabBusLabel, 1, 0)
        timingTabBundleBusFrameGrid.addWidget(self.timingTabBusCombo, 1, 1)

        self.timingTabBundleBusFrame.setLayout(timingTabBundleBusFrameGrid) 
Example 3
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 6 votes vote down vote up
def initInternalPowerTabBundleBusFrame(self):
        # self.internalPowerTabBundleBusFrame
        self.internalPowerTabBundleLabel = QLabel('bundle:', self.internalPowerTabBundleBusFrame)
        self.internalPowerTabBundleLabel.setAlignment(Qt.AlignRight)
        self.internalPowerTabBundleCombo = QComboBox(self.internalPowerTabBundleBusFrame)
        self.internalPowerTabBundleCombo.activated.connect(self.updateInternalPowerTabPinCombo)

        self.internalPowerTabBusLabel = QLabel('bus:', self.internalPowerTabBundleBusFrame)
        self.internalPowerTabBusLabel.setAlignment(Qt.AlignRight)
        self.internalPowerTabBusCombo = QComboBox(self.internalPowerTabBundleBusFrame)
        self.internalPowerTabBusCombo.activated.connect(self.updateInternalPowerTabPinCombo)

        # self.internalPowerTabBundleBusFrame - Grid
        internalPowerTabBundleBusFrameGrid = QGridLayout()

        internalPowerTabBundleBusFrameGrid.addWidget(self.internalPowerTabBundleLabel, 0, 0)
        internalPowerTabBundleBusFrameGrid.addWidget(self.internalPowerTabBundleCombo, 0, 1)
        internalPowerTabBundleBusFrameGrid.addWidget(self.internalPowerTabBusLabel, 1, 0)
        internalPowerTabBundleBusFrameGrid.addWidget(self.internalPowerTabBusCombo, 1, 1)

        self.internalPowerTabBundleBusFrame.setLayout(internalPowerTabBundleBusFrameGrid) 
Example 4
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 6 votes vote down vote up
def updateLeakagePowerTabWhenCombo(self):
        """
        Update leakagePower tab frame 'when' QComboBox.
        """
        self.leakagePowerTabWhenCombo.clear()
        finish = False

        if self.leakagePowerTabMultiEnable:
            for libraryFileName in self.leakagePowerTabDic.keys():
                for cellName in self.leakagePowerTabDic[libraryFileName]:
                    cellWhenList = list(set(list(self.leakagePowerTabDic[libraryFileName][cellName]['leakage_power']['when'].keys())))
                    self.leakagePowerTabWhenCombo.addItems(cellWhenList)
                    finish = True
                    break
                if finish:
                    break

        self.updateLeakagePowerTabRelatedPgPinCombo() 
Example 5
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 6 votes vote down vote up
def updateLeakagePowerTabRelatedPgPinCombo(self):
        """
        Update leakagePower tab frame 'related_pg_pin' QComboBox.
        """
        self.leakagePowerTabRelatedPgPinCombo.clear()
        finish = False

        if self.leakagePowerTabMultiEnable:
            for libraryFileName in self.leakagePowerTabDic.keys():
                for cellName in self.leakagePowerTabDic[libraryFileName]:
                    cellLeakagePowerWhen = self.leakagePowerTabWhenCombo.currentText().strip()
                    cellRelatedPgPinList = list(set(self.leakagePowerTabDic[libraryFileName][cellName]['leakage_power']['when'][cellLeakagePowerWhen]['related_pg_pin']))
                    self.leakagePowerTabRelatedPgPinCombo.addItems(cellRelatedPgPinList)
                    finish = True
                    break
                if finish:
                    break

        self.updateLeakagePowerTabTable() 
Example 6
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 6 votes vote down vote up
def updateTimingTabBusCombo(self):
        """
        Update timing tab frame 'bus' QComboBox.
        """
        self.timingTabBusCombo.clear()
        finish = False

        if self.timingTabMultiEnable or self.specifiedCellCount == 1:
            for libraryFileName in self.timingTabDic.keys():
                for cellName in self.timingTabDic[libraryFileName]:
                    if 'bus' in self.timingTabDic[libraryFileName][cellName]:
                        cellBusList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bus'].keys())))
                        cellBusList.insert(0, '')
                        self.timingTabBusCombo.addItems(cellBusList)
                        finish = True
                        break
                if finish:
                    break 
Example 7
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 6 votes vote down vote up
def updateInternalPowerTabBundleCombo(self):
        """
        Update internalPower tab frame 'bundle' QComboBox.
        """
        self.internalPowerTabBundleCombo.clear()
        finish = False

        if self.internalPowerTabMultiEnable or self.specifiedCellCount == 1:
            for libraryFileName in self.internalPowerTabDic.keys():
                for cellName in self.internalPowerTabDic[libraryFileName]:
                    if 'bundle' in self.internalPowerTabDic[libraryFileName][cellName]:
                        cellBundleList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['bundle'].keys())))
                        self.internalPowerTabBundleCombo.addItems(cellBundleList)
                        finish = True
                        break
                if finish:
                    break 
Example 8
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 6 votes vote down vote up
def updateInternalPowerTabBusCombo(self):
        """
        Update internalPower tab frame 'bus' QComboBox.
        """
        self.internalPowerTabBusCombo.clear()
        finish = False

        if self.internalPowerTabMultiEnable or self.specifiedCellCount == 1:
            for libraryFileName in self.internalPowerTabDic.keys():
                for cellName in self.internalPowerTabDic[libraryFileName]:
                    if 'bus' in self.internalPowerTabDic[libraryFileName][cellName]:
                        cellBusList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['bus'].keys())))
                        self.internalPowerTabBusCombo.addItems(cellBusList)
                        finish = True
                        break
                if finish:
                    break 
Example 9
Project: idasec   Author: RobinDavid   File: AnalysisWidget.py    GNU Lesser General Public License v2.1 6 votes vote down vote up
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 
Example 10
Project: MovieHeavens   Author: lt94   File: movies.py    GNU General Public License v2.0 6 votes vote down vote up
def init_widgets(self):
        self.setWindowTitle(self.tr("Search Movies"))
        self.setGeometry(self.left, self.top, self.width, self.height)
        self.movie_name_label = QLabel(self.tr("电影名称:"))
        self.movie_name_line_edit = QLineEdit()

        self.movie_source_label = QLabel(self.tr("选择片源:"))
        self.movie_source_combobox = QComboBox()
        self.movie_source_combobox.addItem(self.tr('电影天堂'))

        self.search_push_button = QPushButton(self.tr("查询"))

        self.tip_label = QLabel(self.tr("未开始查询..."))
        self.search_content_label = QLabel(self.tr("查询内容:"))
        self.search_content_text_list = QListWidget()

        self.menu_bar = self.menuBar()

        return self 
Example 11
Project: QuantStudio   Author: Scorpi000   File: ResultDlg.py    GNU General Public License v3.0 6 votes vote down vote up
def _getPlotArgs(self, plot_data):
        nCol = plot_data.shape[1]
        PlotMode = ['Line']*nCol
        PlotAxes = ['左轴']*nCol
        DataTable = QtWidgets.QTableWidget()
        DataTable.setRowCount(nCol)
        DataTable.setVerticalHeaderLabels([str(iCol) for iCol in plot_data.columns])
        DataTable.setColumnCount(2)
        DataTable.setHorizontalHeaderLabels(['图像模式','坐标轴'])
        AllModes = ['Line','Bar','Stack']
        AllAxes = ['左轴','右轴']
        for i in range(nCol):
            iComboBox = QtWidgets.QComboBox(None)
            iComboBox.addItems(AllModes)
            DataTable.setCellWidget(i,0,iComboBox)
            iComboBox = QtWidgets.QComboBox(None)
            iComboBox.addItems(AllAxes)
            DataTable.setCellWidget(i,1,iComboBox)
        Dlg = _TableDlg(None, DataTable)
        Dlg.exec_()
        if not Dlg.isOK: return (None, None)
        for i in range(nCol):
            PlotMode[i] = DataTable.cellWidget(i,0).currentText()
            PlotAxes[i] = DataTable.cellWidget(i,1).currentText()
        return (PlotMode, PlotAxes) 
Example 12
Project: pyweed   Author: iris-edu   File: OptionsWidget.py    GNU Lesser General Public License v3.0 6 votes vote down vote up
def getInputValue(self, key):
        """
        Get the value of a single input. This is intended to Pythonify the Qt values that come natively
        from the widgets. (ie. return a Python date rather than a QDate).

        This is used internally by getOptions()
        """
        one_input = self.inputs.get(key)
        if one_input:
            if isinstance(one_input, QtWidgets.QDateTimeEdit):
                # DateTime
                return one_input.dateTime().toString(QtCore.Qt.ISODate)
            elif isinstance(one_input, QtWidgets.QAbstractButton):
                # Radio/checkbox button
                return str(one_input.isChecked())
            elif isinstance(one_input, QtWidgets.QComboBox):
                return one_input.currentText()
            elif hasattr(one_input, 'text'):
                return one_input.text()
            raise Exception("Couldn't identify the QWidget type for %s (%s)" % (key, one_input))
        return None 
Example 13
Project: cct   Author: awacha   File: settingspage.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def fromConfig(self, config:Config):
        for widget, configname in self._trackedWidgets:
            if isinstance(widget, QtWidgets.QComboBox):
                idx = widget.findText(getattr(config, configname))
                if idx<0:
                    raise ValueError('Cannot find config value {} for item {} in the list for the combo box.'.format(getattr(config, configname), configname))
                widget.setCurrentIndex(idx)
            elif isinstance(widget, QtWidgets.QSpinBox) or isinstance(widget, QtWidgets.QDoubleSpinBox):
                widget.setValue(getattr(config, configname))
            elif isinstance(widget, QtWidgets.QCheckBox):
                widget.setChecked(getattr(config, configname))
            elif isinstance(widget, QtWidgets.QLineEdit):
                widget.setText(getattr(config, configname))
            else:
                raise ValueError(
                    'Unknown widget type {} associated with config item {}'.format(type(widget), configname))
        self.resetChangedWidgets() 
Example 14
Project: cct   Author: awacha   File: settingspage.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def toConfig(self, config:Config, onlychanged:bool=True):
        for widget, configname in self._trackedWidgets:
            if onlychanged and (widget not in self._changedWidgets):
                continue
            if isinstance(widget, QtWidgets.QComboBox):
                setattr(config, configname, widget.currentText())
            elif isinstance(widget, QtWidgets.QSpinBox) or isinstance(widget, QtWidgets.QDoubleSpinBox):
                setattr(config, configname, widget.value())
            elif isinstance(widget, QtWidgets.QCheckBox):
                setattr(config, configname, widget.isChecked())
            elif isinstance(widget, QtWidgets.QLineEdit):
                setattr(config, configname, widget.text())
            else:
                raise ValueError(
                    'Unknown widget type {} associated with config item {}'.format(type(widget), configname))
            self._changedWidgets = [w for w in self._changedWidgets if w is not widget] # remove _all_ occurrences
        self.changed.emit(bool(self._changedWidgets)) 
Example 15
Project: musaic   Author: al165   File: elements.py    GNU General Public License v3.0 6 votes vote down vote up
def leadBox(self):
        lead_box = QtWidgets.QGroupBox('Lead')
        lead_layout = QtWidgets.QVBoxLayout()
        lead_layout.setSpacing(2)
        lead_layout.setContentsMargins(2, 2, 2, 2)
        lead_box.setLayout(lead_layout)

        self.parameters['lead'] = QtWidgets.QComboBox()
        self.parameters['lead'].addItem("None")
        self.parameters['lead'].setToolTip("Lead instrument to follow")
        self.parameters['lead'].setFrame(False)
        self.parameters['lead'].currentIndexChanged.connect(self.parameterChanged)
        lead_layout.addWidget(self.parameters['lead'])

        self.parameters['lead_mode'] = QtWidgets.QComboBox()
        self.parameters['lead_mode'].addItems(['both', 'melody'])
        self.parameters['lead_mode'].setVisible(False)
        self.parameters['lead_mode'].setToolTip("Take either 'melody' from lead instrument or 'both' melody and rhythm")
        self.parameters['lead_mode'].currentIndexChanged.connect(self.parameterChanged)
        lead_layout.addWidget(self.parameters['lead_mode'])

        return lead_box 
Example 16
Project: musaic   Author: al165   File: elements.py    GNU General Public License v3.0 6 votes vote down vote up
def sampleBox(self):
        sample_box = QtWidgets.QGroupBox('Sample')
        sample_layout = QtWidgets.QVBoxLayout()
        sample_layout.setSpacing(2)
        sample_layout.setContentsMargins(2, 2, 2, 2)
        sample_box.setLayout(sample_layout)

        self.parameters['sample_mode'] = QtWidgets.QComboBox()
        self.parameters['sample_mode'].addItems(['best', 'top', 'dist'])
        self.parameters['sample_mode'].setToolTip("Either take the most likely ('best'), from the top 5 best ('top'), or draw from the full distribution of possible notes and rhythms ('dist')")
        self.parameters['sample_mode'].setCurrentText('dist')
        self.parameters['sample_mode'].currentIndexChanged.connect(self.parameterChanged)
        sample_layout.addWidget(self.parameters['sample_mode'])

        self.parameters['chord_mode'] = QtWidgets.QSpinBox()
        self.parameters['chord_mode'].setRange(0, 4)
        self.parameters['chord_mode'].setSpecialValueText('auto')
        self.parameters['chord_mode'].setToolTip('Chord mode')
        self.parameters['chord_mode'].valueChanged.connect(self.parameterChanged)
        sample_layout.addWidget(self.parameters['chord_mode'])

        return sample_box 
Example 17
Project: python-aptly-gui   Author: chnyda   File: repository_tab.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, data_manager, parent=None):
        super(RepositoryTab, self).__init__(data_manager, parent)

        self.repo_box = QComboBox()

        delete_button = self.create_button("Delete", self.remove_package)

        self.add_form_element("Repository", self.repo_box)
        self.add_form_element("")
        self.add_form_element("Action", delete_button)
        self.add_select_buttons()
        self.add_form_element("Packages")

        # controllers
        self.load_repository()
        self.repo_box.currentIndexChanged.connect(self.update_list)

        self.configure_layout() 
Example 18
Project: Lector   Author: BasioMeusPuga   File: dockwidgets.py    GNU General Public License v3.0 6 votes vote down vote up
def populate_combo_box(self):
        def set_toc_position(tocTree):
            currentIndex = tocTree.currentIndex()
            required_position = currentIndex.data(QtCore.Qt.UserRole)
            self.return_focus()
            self.parent.set_content(required_position, True, True)

        # Create the Combobox / Treeview combination
        tocTree = QtWidgets.QTreeView()
        self.tocComboBox.setView(tocTree)
        self.tocComboBox.setModel(self.parent.tocModel)
        tocTree.setRootIsDecorated(False)
        tocTree.setItemsExpandable(False)
        tocTree.expandAll()

        # Set the position of the QComboBox
        self.parent.set_tocBox_index(None, self.tocComboBox)

        # Make clicking do something
        self.tocComboBox.currentIndexChanged.connect(
            lambda: set_toc_position(tocTree)) 
Example 19
Project: beqdesigner   Author: 3ll3d00d   File: export.py    MIT License 6 votes vote down vote up
def setupUi(self, exportSignalDialog):
        exportSignalDialog.setObjectName("exportSignalDialog")
        exportSignalDialog.resize(408, 96)
        self.gridLayout = QtWidgets.QGridLayout(exportSignalDialog)
        self.gridLayout.setObjectName("gridLayout")
        self.buttonBox = QtWidgets.QDialogButtonBox(exportSignalDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Save)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1)
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setObjectName("formLayout")
        self.signal = QtWidgets.QComboBox(exportSignalDialog)
        self.signal.setObjectName("signal")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.signal)
        self.signalLabel = QtWidgets.QLabel(exportSignalDialog)
        self.signalLabel.setObjectName("signalLabel")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.signalLabel)
        self.gridLayout.addLayout(self.formLayout, 0, 0, 1, 1)

        self.retranslateUi(exportSignalDialog)
        self.buttonBox.accepted.connect(exportSignalDialog.accept)
        self.buttonBox.rejected.connect(exportSignalDialog.reject)
        # QtCore.QMetaObject.connectSlotsByName(exportSignalDialog) 
Example 20
Project: ovs-toolbox   Author: nbonnand   File: ovs-toolbox.py    Apache License 2.0 6 votes vote down vote up
def clear_widgets(wtype):
    if(debug):mydebug(inspect.currentframe())

    for w,default_value in cleanable_widget_list[wtype]:
        if(isinstance(w, QtWidgets.QLineEdit)):
            w.setText(default_value)
        elif(isinstance(w, QtWidgets.QCheckBox)):
            w.setChecked(default_value)
        elif(isinstance(w, QtWidgets.QRadioButton)):
            w.setChecked(default_value)
        elif(isinstance(w, QtWidgets.QLabel)):
            w.setText(default_value)
        elif(isinstance(w, QtWidgets.QComboBox)):
            w.setCurrentIndex(default_value)


                
#--------------------------------------------------------------- 
Example 21
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def updateTimingTabPinCombo(self):
        """
        Update timing tab frame 'pin' QComboBox.
        """
        self.timingTabPinCombo.clear()
        finish = False

        if self.timingTabMultiEnable or self.specifiedCellCount == 1:
            for libraryFileName in self.timingTabDic.keys():
                for cellName in self.timingTabDic[libraryFileName]:
                    specifiedBundle = self.timingTabBundleCombo.currentText().strip()
                    specifiedBus = self.timingTabBusCombo.currentText().strip()
                    if specifiedBundle != '':
                        pinList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'].keys())))
                    elif specifiedBus != '':
                        pinList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'].keys())))
                    else:
                        if 'pin' in self.timingTabDic[libraryFileName][cellName]:
                            pinList = list(set(list(self.timingTabDic[libraryFileName][cellName]['pin'].keys())))
                        else:
                            pinList = []
                    self.timingTabPinCombo.addItems(pinList)
                    finish = True
                    break
                if finish:
                    break

        self.updateTimingTabRelatedPinCombo() 
Example 22
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def updateTimingTabRelatedPinCombo(self):
        """
        Update timing tab frame 'related_pin' QComboBox.
        """
        self.timingTabRelatedPinCombo.clear()
        finish = False

        if self.timingTabMultiEnable or self.specifiedCellCount == 1:
            for libraryFileName in self.timingTabDic.keys():
                for cellName in self.timingTabDic[libraryFileName]:
                    pinName = self.timingTabPinCombo.currentText().strip()
                    specifiedBundle = self.timingTabBundleCombo.currentText().strip()
                    specifiedBus = self.timingTabBusCombo.currentText().strip()
                    pinTimingRelatedPinList = []
                    if specifiedBundle != '':
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]:
                            pinTimingRelatedPinList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]['timing']['related_pin'].keys())))
                    elif specifiedBus != '':
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]:
                            pinTimingRelatedPinList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]['timing']['related_pin'].keys())))
                    else:
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['pin'][pinName]:
                            pinTimingRelatedPinList = list(set(list(self.timingTabDic[libraryFileName][cellName]['pin'][pinName]['timing']['related_pin'].keys())))
                    self.timingTabRelatedPinCombo.addItems(pinTimingRelatedPinList)
                    finish = True
                    break
                if finish:
                    break

        self.updateTimingTabRelatedPgPinCombo() 
Example 23
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def updateTimingTabRelatedPgPinCombo(self):
        """
        Update timing tab frame 'related_pg_pin' QComboBox.
        """
        self.timingTabRelatedPgPinCombo.clear()
        finish = False

        if self.timingTabMultiEnable or self.specifiedCellCount == 1:
            for libraryFileName in self.timingTabDic.keys():
                for cellName in self.timingTabDic[libraryFileName]:
                    pinName = self.timingTabPinCombo.currentText().strip()
                    pinTimingRelatedPin = self.timingTabRelatedPinCombo.currentText().strip()
                    specifiedBundle = self.timingTabBundleCombo.currentText().strip()
                    specifiedBus = self.timingTabBusCombo.currentText().strip()
                    pinTimingRelatedPgPinList = []
                    if specifiedBundle != '':
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]:
                            pinTimingRelatedPgPinList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'].keys())))
                    elif specifiedBus != '':
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]:
                            pinTimingRelatedPgPinList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'].keys())))
                    else:
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['pin'][pinName]:
                            pinTimingRelatedPgPinList = list(set(list(self.timingTabDic[libraryFileName][cellName]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'].keys())))
                    self.timingTabRelatedPgPinCombo.addItems(pinTimingRelatedPgPinList)
                    finish = True
                    break
                if finish:
                    break

        self.updateTimingTabTimingSenseCombo() 
Example 24
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def updateTimingTabTimingSenseCombo(self):
        """
        Update timing tab frame 'timing_sense' QComboBox.
        """
        self.timingTabTimingSenseCombo.clear()
        finish = False

        if self.timingTabMultiEnable or self.specifiedCellCount == 1:
            for libraryFileName in self.timingTabDic.keys():
                for cellName in self.timingTabDic[libraryFileName]:
                    pinName = self.timingTabPinCombo.currentText().strip()
                    pinTimingRelatedPin = self.timingTabRelatedPinCombo.currentText().strip()
                    pinTimingRelatedPgPin = self.timingTabRelatedPgPinCombo.currentText().strip()
                    specifiedBundle = self.timingTabBundleCombo.currentText().strip()
                    specifiedBus = self.timingTabBusCombo.currentText().strip()
                    pinTimingTimingSenseList = []
                    if specifiedBundle != '':
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]:
                            pinTimingTimingSenseList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'][pinTimingRelatedPgPin]['timing_sense'].keys())))
                    elif specifiedBus != '':
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]:
                            pinTimingTimingSenseList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'][pinTimingRelatedPgPin]['timing_sense'].keys())))
                    else:
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['pin'][pinName]:
                            pinTimingTimingSenseList = list(set(list(self.timingTabDic[libraryFileName][cellName]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'][pinTimingRelatedPgPin]['timing_sense'].keys())))
                    self.timingTabTimingSenseCombo.addItems(pinTimingTimingSenseList)
                    finish = True
                    break
                if finish:
                    break

        self.updateTimingTabTimingTypeCombo() 
Example 25
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def updateTimingTabWhenCombo(self):
        """
        Update timing tab frame 'when' QComboBox.
        """
        self.timingTabWhenCombo.clear()
        finish = False

        if self.timingTabMultiEnable or self.specifiedCellCount == 1:
            for libraryFileName in self.timingTabDic.keys():
                for cellName in self.timingTabDic[libraryFileName]:
                    pinName = self.timingTabPinCombo.currentText().strip()
                    pinTimingRelatedPin = self.timingTabRelatedPinCombo.currentText().strip()
                    pinTimingRelatedPgPin = self.timingTabRelatedPgPinCombo.currentText().strip()
                    pinTimingTimingSense = self.timingTabTimingSenseCombo.currentText().strip()
                    pinTimingTimingType = self.timingTabTimingTypeCombo.currentText().strip()
                    specifiedBundle = self.timingTabBundleCombo.currentText().strip()
                    specifiedBus = self.timingTabBusCombo.currentText().strip()
                    pinTimingWhenList = []
                    if specifiedBundle != '':
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]:
                            pinTimingWhenList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'][pinTimingRelatedPgPin]['timing_sense'][pinTimingTimingSense]['timing_type'][pinTimingTimingType]['when'].keys())))
                    elif specifiedBus != '':
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]:
                            pinTimingWhenList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'][pinTimingRelatedPgPin]['timing_sense'][pinTimingTimingSense]['timing_type'][pinTimingTimingType]['when'].keys())))
                    else:
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['pin'][pinName]:
                            pinTimingWhenList = list(set(list(self.timingTabDic[libraryFileName][cellName]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'][pinTimingRelatedPgPin]['timing_sense'][pinTimingTimingSense]['timing_type'][pinTimingTimingType]['when'].keys())))
                    self.timingTabWhenCombo.addItems(pinTimingWhenList)
                    finish = True
                    break
                if finish:
                    break

        self.updateTimingTabTableTypeCombo() 
Example 26
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def updateTimingTabTableTypeCombo(self):
        """
        Update timing tab frame 'Table Type' QComboBox.
        """
        self.timingTabTableTypeCombo.clear()
        finish = False

        if self.timingTabMultiEnable or self.specifiedCellCount == 1:
            pinName = self.timingTabPinCombo.currentText().strip()
            pinTimingRelatedPin = self.timingTabRelatedPinCombo.currentText().strip()
            pinTimingRelatedPgPin = self.timingTabRelatedPgPinCombo.currentText().strip()
            pinTimingTimingSense = self.timingTabTimingSenseCombo.currentText().strip()
            pinTimingTimingType = self.timingTabTimingTypeCombo.currentText().strip()
            pinTimingWhen = self.timingTabWhenCombo.currentText().strip()
            specifiedBundle = self.timingTabBundleCombo.currentText().strip()
            specifiedBus = self.timingTabBusCombo.currentText().strip()

            for libraryFileName in self.timingTabDic.keys():
                for cellName in self.timingTabDic[libraryFileName]:
                    pinTimingTableTypeList = []
                    if specifiedBundle != '':
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]:
                            pinTimingTableTypeList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'][pinTimingRelatedPgPin]['timing_sense'][pinTimingTimingSense]['timing_type'][pinTimingTimingType]['when'][pinTimingWhen]['table_type'].keys())))
                    elif specifiedBus != '':
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]:
                            pinTimingTableTypeList = list(set(list(self.timingTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'][pinTimingRelatedPgPin]['timing_sense'][pinTimingTimingSense]['timing_type'][pinTimingTimingType]['when'][pinTimingWhen]['table_type'].keys())))
                    else:
                        if 'timing' in self.timingTabDic[libraryFileName][cellName]['pin'][pinName]:
                            pinTimingTableTypeList = list(set(list(self.timingTabDic[libraryFileName][cellName]['pin'][pinName]['timing']['related_pin'][pinTimingRelatedPin]['related_pg_pin'][pinTimingRelatedPgPin]['timing_sense'][pinTimingTimingSense]['timing_type'][pinTimingTimingType]['when'][pinTimingWhen]['table_type'].keys())))
                    self.timingTabTableTypeCombo.addItems(pinTimingTableTypeList)
                    finish = True
                    break
                if finish:
                    break

        self.updateTimingTabIndexCombo() 
Example 27
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def updateInternalPowerTabRelatedPinCombo(self):
        """
        Update internalPower tab frame 'related_pin' QComboBox.
        """
        self.internalPowerTabRelatedPinCombo.clear()
        finish = False

        if self.internalPowerTabMultiEnable or self.specifiedCellCount == 1:
            for libraryFileName in self.internalPowerTabDic.keys():
                for cellName in self.internalPowerTabDic[libraryFileName]:
                    pinName = self.internalPowerTabPinCombo.currentText().strip()
                    specifiedBundle = self.internalPowerTabBundleCombo.currentText().strip()
                    specifiedBus = self.internalPowerTabBusCombo.currentText().strip()
                    pinInternalPowerRelatedPinList = []
                    if specifiedBundle != '':
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]:
                            pinInternalPowerRelatedPinList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]['internal_power']['related_pin'].keys())))
                    elif specifiedBus != '':
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]:
                            pinInternalPowerRelatedPinList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]['internal_power']['related_pin'].keys())))
                    else:
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['pin'][pinName]:
                            pinInternalPowerRelatedPinList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['pin'][pinName]['internal_power']['related_pin'].keys())))
                    self.internalPowerTabRelatedPinCombo.addItems(pinInternalPowerRelatedPinList)
                    finish = True
                    break
                if finish:
                    break

        self.updateInternalPowerTabRelatedPgPinCombo() 
Example 28
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def updateInternalPowerTabRelatedPgPinCombo(self):
        """
        Update internalPower tab frame 'related_pg_pin' QComboBox.
        """
        self.internalPowerTabRelatedPgPinCombo.clear()
        finish = False

        if self.internalPowerTabMultiEnable or self.specifiedCellCount == 1:
            for libraryFileName in self.internalPowerTabDic.keys():
                for cellName in self.internalPowerTabDic[libraryFileName]:
                    pinName = self.internalPowerTabPinCombo.currentText().strip()
                    pinInternalPowerRelatedPin = self.internalPowerTabRelatedPinCombo.currentText().strip()
                    specifiedBundle = self.internalPowerTabBundleCombo.currentText().strip()
                    specifiedBus = self.internalPowerTabBusCombo.currentText().strip()
                    pinInternalPowerRelatedPgPinList = []
                    if specifiedBundle != '':
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]:
                            pinInternalPowerRelatedPgPinList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]['internal_power']['related_pin'][pinInternalPowerRelatedPin]['related_pg_pin'].keys())))
                    elif specifiedBus != '':
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]:
                            pinInternalPowerRelatedPgPinList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]['internal_power']['related_pin'][pinInternalPowerRelatedPin]['related_pg_pin'].keys())))
                    else:
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['pin'][pinName]:
                            pinInternalPowerRelatedPgPinList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['pin'][pinName]['internal_power']['related_pin'][pinInternalPowerRelatedPin]['related_pg_pin'].keys())))
                    self.internalPowerTabRelatedPgPinCombo.addItems(pinInternalPowerRelatedPgPinList)
                    finish = True
                    break
                if finish:
                    break

        self.updateInternalPowerTabWhenCombo() 
Example 29
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def updateInternalPowerTabWhenCombo(self):
        """
        Update internalPower tab frame 'when' QComboBox.
        """
        self.internalPowerTabWhenCombo.clear()
        finish = False

        if self.internalPowerTabMultiEnable or self.specifiedCellCount == 1:
            for libraryFileName in self.internalPowerTabDic.keys():
                for cellName in self.internalPowerTabDic[libraryFileName]:
                    pinName = self.internalPowerTabPinCombo.currentText().strip()
                    pinInternalPowerRelatedPin = self.internalPowerTabRelatedPinCombo.currentText().strip()
                    pinInternalPowerRelatedPgPin = self.internalPowerTabRelatedPgPinCombo.currentText().strip()
                    specifiedBundle = self.internalPowerTabBundleCombo.currentText().strip()
                    specifiedBus = self.internalPowerTabBusCombo.currentText().strip()
                    pinInternalPowerWhenList = []
                    if specifiedBundle != '':
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]:
                            pinInternalPowerWhenList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]['internal_power']['related_pin'][pinInternalPowerRelatedPin]['related_pg_pin'][pinInternalPowerRelatedPgPin]['when'].keys())))
                    elif specifiedBus != '':
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]:
                            pinInternalPowerWhenList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]['internal_power']['related_pin'][pinInternalPowerRelatedPin]['related_pg_pin'][pinInternalPowerRelatedPgPin]['when'].keys())))
                    else:
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['pin'][pinName]:
                            pinInternalPowerWhenList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['pin'][pinName]['internal_power']['related_pin'][pinInternalPowerRelatedPin]['related_pg_pin'][pinInternalPowerRelatedPgPin]['when'].keys())))
                    self.internalPowerTabWhenCombo.addItems(pinInternalPowerWhenList)
                    finish = True
                    break
                if finish:
                    break

        self.updateInternalPowerTabTableTypeCombo() 
Example 30
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def updateInternalPowerTabTableTypeCombo(self):
        """
        Update internalPower tab frame 'Table Type' QComboBox.
        """
        self.internalPowerTabTableTypeCombo.clear()
        finish = False

        if self.internalPowerTabMultiEnable or self.specifiedCellCount == 1:
            pinName = self.internalPowerTabPinCombo.currentText().strip()
            pinInternalPowerRelatedPin = self.internalPowerTabRelatedPinCombo.currentText().strip()
            pinInternalPowerRelatedPgPin = self.internalPowerTabRelatedPgPinCombo.currentText().strip()
            pinInternalPowerWhen = self.internalPowerTabWhenCombo.currentText().strip()
            specifiedBundle = self.internalPowerTabBundleCombo.currentText().strip()
            specifiedBus = self.internalPowerTabBusCombo.currentText().strip()

            for libraryFileName in self.internalPowerTabDic.keys():
                for cellName in self.internalPowerTabDic[libraryFileName]:
                    pinInternalPowerTableTypeList = []
                    if specifiedBundle != '':
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]:
                            pinInternalPowerTableTypeList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['bundle'][specifiedBundle]['pin'][pinName]['internal_power']['related_pin'][pinInternalPowerRelatedPin]['related_pg_pin'][pinInternalPowerRelatedPgPin]['when'][pinInternalPowerWhen]['table_type'].keys())))
                    elif specifiedBus != '':
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]:
                            pinInternalPowerTableTypeList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['bus'][specifiedBus]['pin'][pinName]['internal_power']['related_pin'][pinInternalPowerRelatedPin]['related_pg_pin'][pinInternalPowerRelatedPgPin]['when'][pinInternalPowerWhen]['table_type'].keys())))
                    else:
                        if 'internal_power' in self.internalPowerTabDic[libraryFileName][cellName]['pin'][pinName]:
                            pinInternalPowerTableTypeList = list(set(list(self.internalPowerTabDic[libraryFileName][cellName]['pin'][pinName]['internal_power']['related_pin'][pinInternalPowerRelatedPin]['related_pg_pin'][pinInternalPowerRelatedPgPin]['when'][pinInternalPowerWhen]['table_type'].keys())))
                    self.internalPowerTabTableTypeCombo.addItems(pinInternalPowerTableTypeList)
                    finish = True
                    break
                if finish:
                    break

        self.updateInternalPowerTabIndexCombo() 
Example 31
Project: idasec   Author: RobinDavid   File: AnalysisWidget.py    GNU Lesser General Public License v2.1 5 votes vote down vote up
def add_policy_item_action(self):
        self.policy_table.setRowCount(self.policy_table.rowCount()+1)
        i = self.policy_table.rowCount()-1
        btn1 = ButtonLineEdit(['*', "'addr'", "[addr1..addr2]", "default"])
        btn2 = ButtonLineEdit(["*", " _ := _", "goto _"])
        btn3 = ButtonLineEdit(["*", "expr", "expr1 <: expr2"])
        btn4 = ButtonLineEdit(["*", "istainted(_)", "term1 && term2", "term1 || term2"])
        btn5 = QtWidgets.QComboBox()
        btn5.addItems(["C", "P", "Pc", "Ps", "S"])
        for col_id, widget in enumerate([btn1, btn2, btn3, btn4, btn5]):
            self.policy_table.setCellWidget(i, col_id, widget)
        return i 
Example 32
Project: kucher   Author: Zubax   File: motor_identification_control_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,
                 parent:    QWidget,
                 commander: Commander):
        super(MotorIdentificationControlWidget, self).__init__(parent)

        self._commander = commander

        self._mode_map = {
            _humanize(mid): mid for mid in MotorIdentificationMode
        }

        self._mode_selector = QComboBox(self)
        self._mode_selector.setEditable(False)
        # noinspection PyTypeChecker
        self._mode_selector.addItems(map(_humanize,
                                         sorted(MotorIdentificationMode,
                                                key=lambda x: x != MotorIdentificationMode.R_L_PHI)))

        go_button = QPushButton(get_icon('play'), 'Launch', self)
        go_button.clicked.connect(self._execute)

        self.setLayout(
            lay_out_vertically(
                lay_out_horizontally(
                    QLabel('Select parameters to estimate:', self),
                    self._mode_selector,
                    (None, 1),
                ),
                lay_out_horizontally(
                    QLabel('Then click', self),
                    go_button,
                    QLabel('and wait. The process will take a few minutes to complete.', self),
                    (None, 1),
                ),
                (None, 1)
            )
        ) 
Example 33
Project: MovieHeavens   Author: lt94   File: movies.py    GNU General Public License v2.0 5 votes vote down vote up
def get_select_movie_source(self, movie_name):
        """
        according to the value of the QComboBox,
        generate the right class of movie search
        """
        movies, url, params = None, None, {
            "kwtype": "0", "searchtype": "title"}
        select_source = self.movie_source_combobox.currentText()
        if select_source == self.tr('电影天堂'):
            movies = MovieHeaven()
            url = "http://s.dydytt.net/plus/search.php"
            params["keyword"] = movie_name.encode('gb2312')
        return movies, url, params 
Example 34
Project: straditize   Author: Chilipp   File: progress_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, straditizer_widgets, item):
        super().__init__()
        self.init_straditizercontrol(straditizer_widgets, item)

        self.combo_display = QtWidgets.QComboBox()
        self.combo_display.setEditable(False)

        for state in [TASK_TODO, DONE, NOTYET]:
            self.combo_display.addItem(QtGui.QIcon(icons[state]), state)
        self.combo_display.addItem(ALL_TASKS)

        self.progress_list = QtWidgets.QListWidget()
        self.info_label = QtWidgets.QLabel()
        self.info_label.setWordWrap(True)
        self.info_label.setStyleSheet('border: 1px solid black')

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(self.combo_display)
        vbox.addWidget(self.progress_list)
        vbox.addWidget(self.info_label)
        self.setLayout(vbox)

        self.populate_list()
        self.setup_menu()
        self.refresh()
        self.combo_display.currentIndexChanged.connect(self.refresh)
        self.progress_list.itemDoubleClicked.connect(self.show_rst)
        self.progress_list.currentItemChanged.connect(self.show_rst)
        self.progress_list.currentItemChanged.connect(self.update_info_label) 
Example 35
Project: pyweed   Author: iris-edu   File: OptionsWidget.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def setInputValue(self, key, value):
        """
        Set the input value based on a string from the options
        """
        one_input = self.inputs.get(key)
        if one_input:
            if isinstance(one_input, QtWidgets.QDateTimeEdit):
                # Ugh, complicated conversion from UTCDateTime
                dt = QtCore.QDateTime.fromString(value, QtCore.Qt.ISODate)
                one_input.setDateTime(dt)
            elif isinstance(one_input, QtWidgets.QDoubleSpinBox):
                # Float value
                one_input.setValue(float(value))
            elif isinstance(one_input, QtWidgets.QComboBox):
                # Combo box
                index = one_input.findText(value)
                if index > -1:
                    one_input.setCurrentIndex(index)
            elif isinstance(one_input, QtWidgets.QLineEdit):
                # Text input
                one_input.setText(value)
            elif isinstance(one_input, QtWidgets.QAbstractButton):
                # Radio/checkbox button
                one_input.setChecked(strtobool(str(value)))
            else:
                raise Exception("Don't know how to set an input for %s (%s)" % (key, one_input)) 
Example 36
Project: cct   Author: awacha   File: backgroundsubtractionmodel.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def createEditor(self, parent: QtWidgets.QWidget, option: QtWidgets.QStyleOptionViewItem,
                     index: QtCore.QModelIndex):
        editor = QtWidgets.QComboBox(parent)
        editor.addItems(['(none)'] + index.model().sampleNameList())
        return editor 
Example 37
Project: cct   Author: awacha   File: backgroundsubtractionmodel.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setEditorData(self, editor: QtWidgets.QWidget, index: QtCore.QModelIndex):
        name = index.data(QtCore.Qt.EditRole)
        assert isinstance(editor, QtWidgets.QComboBox)
        editor.setCurrentIndex(editor.findText(name)) 
Example 38
Project: cct   Author: awacha   File: samplenamecomboboxdelegate.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def createEditor(self, parent: QtWidgets.QWidget, option: QtWidgets.QStyleOptionViewItem,
                     index: QtCore.QModelIndex) -> QtWidgets.QWidget:
        editor = QtWidgets.QComboBox(parent)
        editor.addItem('-- None --')
        editor.addItems(index.model().samplenames())
        editor.setCurrentIndex(0)
        editor.setFrame(False)
        return editor 
Example 39
Project: cct   Author: awacha   File: submethodcomboboxdelegate.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def createEditor(self, parent: QtWidgets.QWidget, option: QtWidgets.QStyleOptionViewItem,
                     index: QtCore.QModelIndex) -> QtWidgets.QWidget:
        sub = index.model()[index]
        assert isinstance(sub, SubtractionJobRecord)
        editor = QtWidgets.QComboBox(parent)
        editor.addItems(sub.ValidMethods)
        editor.setCurrentIndex(0)
        editor.setFrame(False)
        return editor 
Example 40
Project: cct   Author: awacha   File: submethodcomboboxdelegate.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setModelData(self, editor: QtWidgets.QWidget, model: QtCore.QAbstractItemModel,
                     index: QtCore.QModelIndex) -> None:
        assert isinstance(editor, QtWidgets.QComboBox)
        model.setData(index, editor.currentText() if editor.currentIndex()>0 else editor.itemText(0), QtCore.Qt.EditRole) 
Example 41
Project: musaic   Author: al165   File: elements.py    GNU General Public License v3.0 5 votes vote down vote up
def injectionBox(self):
        injection_box = QtWidgets.QGroupBox('Style')
        injection_layout = QtWidgets.QGridLayout()
        injection_layout.setSpacing(2)
        injection_layout.setContentsMargins(2, 2, 2, 2)
        injection_box.setLayout(injection_layout)

        self.parameters['context_mode'] = QtWidgets.QComboBox()
        self.parameters['context_mode'].addItems(['real', 'inject'])
        self.parameters['context_mode'].setToolTip("Use the 'real' previous measures or 'inject' new measures")
        self.parameters['context_mode'].currentIndexChanged.connect(self.parameterChanged)
        injection_layout.addWidget(self.parameters['context_mode'], 0, 0, 1, 3)

        self.injection_params = {
            'scale': QtWidgets.QComboBox(),
            'qb': QtWidgets.QPushButton(),
            'eb': QtWidgets.QPushButton(),
            'lb': QtWidgets.QPushButton(),
            'fb': QtWidgets.QPushButton(),
            'tb': QtWidgets.QPushButton()
        }

        sp = QtWidgets.QSizePolicy()
        sp.setRetainSizeWhenHidden(True)
        sp.setHorizontalStretch(2)

        self.injection_params['scale'].addItems(['maj', 'min', 'pen', '5th'])
        self.injection_params['scale'].setSizePolicy(sp)
        injection_layout.addWidget(self.injection_params['scale'], 0, 3, 1, 2)

        for i, cb in enumerate(['qb', 'eb', 'lb', 'fb', 'tb']):
            button = self.injection_params[cb]
            button.setSizePolicy(sp)
            button.setText(cb)
            button.setCheckable(True)
            button.clicked[bool].connect(self.parameterChanged)
            injection_layout.addWidget(button, 1, i)

        return injection_box 
Example 42
Project: PyLSS   Author: gmrandazzo   File: gui_plotmaps.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def setupUi(self, PlotMaps):
        PlotMaps.setObjectName("PlotMaps")
        PlotMaps.resize(811, 654)
        self.gridLayout = QtWidgets.QGridLayout(PlotMaps)
        self.gridLayout.setObjectName("gridLayout")
        self.label_4 = QtWidgets.QLabel(PlotMaps)
        self.label_4.setObjectName("label_4")
        self.gridLayout.addWidget(self.label_4, 0, 0, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(358, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem, 0, 1, 1, 1)
        self.modelBox = QtWidgets.QComboBox(PlotMaps)
        self.modelBox.setMinimumSize(QtCore.QSize(260, 26))
        self.modelBox.setObjectName("modelBox")
        self.gridLayout.addWidget(self.modelBox, 0, 2, 1, 1)
        self.plotterBox = QtWidgets.QGroupBox(PlotMaps)
        self.plotterBox.setMinimumSize(QtCore.QSize(551, 311))
        self.plotterBox.setObjectName("plotterBox")
        self.gridLayout.addWidget(self.plotterBox, 1, 0, 1, 4)
        spacerItem1 = QtWidgets.QSpacerItem(932, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem1, 2, 0, 1, 3)
        self.closeButton = QtWidgets.QPushButton(PlotMaps)
        self.closeButton.setMaximumSize(QtCore.QSize(110, 32))
        self.closeButton.setObjectName("closeButton")
        self.gridLayout.addWidget(self.closeButton, 2, 3, 1, 1)
        self.closeButton.raise_()
        self.plotterBox.raise_()

        self.retranslateUi(PlotMaps)
        QtCore.QMetaObject.connectSlotsByName(PlotMaps) 
Example 43
Project: PyQt-multifunctional-uart-helper   Author: IronSublimate   File: Ui_piano.py    MIT License 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(400, 300)
        self.gridLayout = QtWidgets.QGridLayout(Form)
        self.gridLayout.setObjectName("gridLayout")
        self.groupBox_settings = QtWidgets.QGroupBox(Form)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.groupBox_settings.sizePolicy().hasHeightForWidth())
        self.groupBox_settings.setSizePolicy(sizePolicy)
        self.groupBox_settings.setObjectName("groupBox_settings")
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.groupBox_settings)
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.label_10 = QtWidgets.QLabel(self.groupBox_settings)
        self.label_10.setObjectName("label_10")
        self.horizontalLayout_6.addWidget(self.label_10)
        self.comboBox_transpose = QtWidgets.QComboBox(self.groupBox_settings)
        self.comboBox_transpose.setObjectName("comboBox_transpose")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.horizontalLayout_6.addWidget(self.comboBox_transpose)
        self.gridLayout.addWidget(self.groupBox_settings, 0, 0, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(219, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem, 0, 1, 1, 1)
        spacerItem1 = QtWidgets.QSpacerItem(375, 208, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem1, 1, 0, 1, 2)

        self.retranslateUi(Form)
        self.comboBox_transpose.setCurrentIndex(3)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 44
Project: pyaudiorestoration   Author: HENDRIX-ZT2   File: widgets.py    GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, with_canvas=True):
		QtWidgets.QWidget.__init__(self,)
		
		display_l = QtWidgets.QLabel("Display")
		display_l.setFont(myFont)
		
		fft_l = QtWidgets.QLabel("FFT Size")
		self.fft_c = QtWidgets.QComboBox(self)
		self.fft_c.addItems(("64", "128", "256", "512", "1024", "2048", "4096", "8192", "16384", "32768", "65536", "131072"))
		self.fft_c.setToolTip("This determines the frequency resolution.")
		self.fft_c.setCurrentIndex(5)
		
		overlap_l = QtWidgets.QLabel("FFT Overlap")
		self.overlap_c = QtWidgets.QComboBox(self)
		self.overlap_c.addItems(("1", "2", "4", "8", "16", "32"))
		self.overlap_c.setToolTip("Increase to improve temporal resolution.")
		self.overlap_c.setCurrentIndex(2)
		
		buttons = [(display_l,), (fft_l, self.fft_c), (overlap_l, self.overlap_c)]
		
		if with_canvas:
			show_l = QtWidgets.QLabel("Show")
			self.show_c = QtWidgets.QComboBox(self)
			self.show_c.addItems(("Both","Traces","Regressions"))
			
			cmap_l = QtWidgets.QLabel("Colors")
			self.cmap_c = QtWidgets.QComboBox(self)
			self.cmap_c.addItems(sorted(color.colormap.get_colormaps().keys()))
			self.cmap_c.setCurrentText("viridis")
		
			
			buttons.extend( ((show_l, self.show_c), (cmap_l,self.cmap_c)) )
			
		vbox(self, grid(buttons))
		
		if with_canvas:
			#only connect in the end
			self.fft_c.currentIndexChanged.connect(self.update_fft_settings)
			self.overlap_c.currentIndexChanged.connect(self.update_fft_settings)
			self.show_c.currentIndexChanged.connect(self.update_show_settings)
			self.cmap_c.currentIndexChanged.connect(self.update_cmap) 
Example 45
Project: pyaudiorestoration   Author: HENDRIX-ZT2   File: widgets.py    GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, ):
		QtWidgets.QWidget.__init__(self,)
		
		resampling_l = QtWidgets.QLabel("\nResampling")
		resampling_l.setFont(myFont)
		mode_l = QtWidgets.QLabel("Mode")
		self.mode_c = QtWidgets.QComboBox(self)
		self.mode_c.addItems(("Linear", "Sinc"))
		self.mode_c.currentIndexChanged.connect(self.toggle_resampling_quality)
		self.sinc_quality_l = QtWidgets.QLabel("Quality")
		self.sinc_quality_s = QtWidgets.QSpinBox()
		self.sinc_quality_s.setRange(1, 100)
		self.sinc_quality_s.setSingleStep(1)
		self.sinc_quality_s.setValue(50)
		self.sinc_quality_s.setToolTip("Number of input samples that contribute to each output sample.\nMore samples = more quality, but slower. Only for sinc mode.")
		self.toggle_resampling_quality()
		
		
		self.mygroupbox = QtWidgets.QGroupBox('Channels')
		self.mygroupbox.setToolTip("Only selected channels will be resampled.")
		self.channel_layout = QtWidgets.QVBoxLayout()
		self.channel_layout.setSpacing(0)
		self.mygroupbox.setLayout(self.channel_layout)
		self.scroll = QtWidgets.QScrollArea()
		self.scroll.setWidget(self.mygroupbox)
		self.scroll.setWidgetResizable(True)
		self.channel_checkboxes = [ ]
		
		buttons = ((resampling_l,), (mode_l, self.mode_c,), (self.sinc_quality_l, self.sinc_quality_s), (self.scroll,))
		vbox(self, grid(buttons)) 
Example 46
Project: MeiTingTrunk   Author: Xunius   File: _MainFrame.py    GNU General Public License v3.0 5 votes vote down vote up
def createFilterList(self):

        frame=QtWidgets.QFrame()
        scroll=QtWidgets.QScrollArea(self)
        scroll.setWidgetResizable(True)
        v_layout=QtWidgets.QVBoxLayout()
        v_layout.setContentsMargins(0,0,0,0)

        self.filter_type_combbox=QtWidgets.QComboBox(self)
        self.filter_type_combbox.addItem('Filter by authors')
        self.filter_type_combbox.addItem('Filter by keywords')
        self.filter_type_combbox.addItem('Filter by publications')
        self.filter_type_combbox.addItem('Filter by tags')
        self.filter_type_combbox.currentIndexChanged.connect(
                self.filterTypeCombboxChange)
        self.filter_type_combbox.setSizeAdjustPolicy(
                QtWidgets.QComboBox.AdjustToMinimumContentsLength)

        self.filter_item_list=QtWidgets.QListWidget(self)
        self.filter_item_list.itemClicked.connect(self.filterItemClicked)

        v_layout.addWidget(self.filter_type_combbox)
        v_layout.addWidget(self.filter_item_list)

        frame.setLayout(v_layout)
        scroll.setWidget(frame)

        show_widgets=self.settings.value('view/show_widgets',[],str)
        if isinstance(show_widgets,str) and show_widgets=='':
            show_widgets=[]

        if 'Toggle Filter List' not in show_widgets:
            scroll.setVisible(False)

        return scroll 
Example 47
Project: Lector   Author: BasioMeusPuga   File: contentwidgets.py    GNU General Public License v3.0 5 votes vote down vote up
def generate_combo_box_action(self, contextMenu):
        contextMenu.addSeparator()

        def set_toc_position(tocTree):
            currentIndex = tocTree.currentIndex()
            required_position = currentIndex.data(QtCore.Qt.UserRole)
            self.pw.parent.set_content(required_position, True, True)

        # Create the Combobox / Treeview combination
        tocComboBox = QtWidgets.QComboBox()
        tocTree = QtWidgets.QTreeView()
        tocComboBox.setView(tocTree)
        tocComboBox.setModel(self.pw.parent.tocModel)
        tocTree.setRootIsDecorated(False)
        tocTree.setItemsExpandable(False)
        tocTree.expandAll()

        # Set the position of the QComboBox
        self.pw.parent.set_tocBox_index(None, tocComboBox)

        # Make clicking do something
        tocComboBox.currentIndexChanged.connect(
            lambda: set_toc_position(tocTree))

        comboboxAction = QtWidgets.QWidgetAction(self.pw)
        comboboxAction.setDefaultWidget(tocComboBox)
        contextMenu.addAction(comboboxAction) 
Example 48
Project: plexdesktop   Author: coryo   File: extra_widgets.py    GNU General Public License v3.0 5 votes vote down vote up
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()) 
Example 49
Project: plexdesktop   Author: coryo   File: extra_widgets.py    GNU General Public License v3.0 5 votes vote down vote up
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 
Example 50
Project: plexdesktop   Author: coryo   File: extra_widgets.py    GNU General Public License v3.0 5 votes vote down vote up
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)