Python PyQt4.QtGui 模块,QComboBox() 实例源码

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

项目:Comictagger    作者:dickloraine    | 项目源码 | 文件源码
def clearChildren (self, widget ):

        if ( isinstance(widget, QtGui.QLineEdit) or   
                isinstance(widget, QtGui.QTextEdit)):
            widget.setText("")
        if ( isinstance(widget, QtGui.QComboBox) ):
            widget.setCurrentIndex( 0 )
        if ( isinstance(widget, QtGui.QCheckBox) ):
            widget.setChecked( False )
        if ( isinstance(widget, QtGui.QTableWidget) ):
            while widget.rowCount() > 0:
                widget.removeRow(0)

        # recursive call on chillun
        for child in widget.children():
            self.clearChildren( child )
项目:networkzero    作者:tjguk    | 项目源码 | 文件源码
def __init__(self, controller, position, *args, **kwargs):
        super(Panel, self).__init__(position.title(), *args, **kwargs)
        self.instructions = controller
        self.position = position.lower()

        layout = QtGui.QVBoxLayout()
        self.selector = QtGui.QComboBox()
        self.selector.currentIndexChanged.connect(self.on_selector)

        layout.addWidget(self.selector)
        self.stack = QtGui.QStackedWidget()
        layout.addWidget(self.stack)
        self.setLayout(layout)

        for cls in screen.ScreenWidget.__subclasses__():
            self.selector.addItem(cls.name)
            self.stack.addWidget(cls(controller, position))
项目: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)
项目:olive-gui    作者:dturevski    | 项目源码 | 文件源码
def getOpenFileNameAndEncoding(self, title, dir, filter):
        dialog = QtGui.QFileDialog()
        dialog.setOption(QtGui.QFileDialog.DontUseNativeDialog, True)
        dialog.setFilter(filter)
        dialog.setWindowTitle(title)

        encodings = Conf.value('import-post-decode')
        keys = sorted(encodings.keys())
        combo = QtGui.QComboBox()
        combo.addItems(["%s (%s)" % (k, encodings[k]) for k in keys])
        combo.setCurrentIndex(
            keys.index(
                Conf.value('import-post-decode-default')))

        grid = dialog.layout()
        grid.addWidget(QtGui.QLabel(Lang.value('MISC_Encoding')), 4, 0)
        grid.addWidget(combo, 4, 1)

        fileName = False
        if dialog.exec_() and len(dialog.selectedFiles()):
            fileName = dialog.selectedFiles()[0]
        return fileName, keys[combo.currentIndex()]
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def setData(self, sysex):
        self.sysex = sysex
        data = sysex[5:-2]
        self.receiving = True
#        if self.data:
#            for i, v in enumerate(self.data):
#                if v != data[i]:
#                    print 'value {} changed from {} to {}'.format(i, v, data[i])
        for w, p in self.param_dict.items():
            if isinstance(w, QtGui.QSpinBox):
                w.setValue(data[p.index] + p.delta)
            elif isinstance(w, PopupSpin):
                w.setIndex(data[p.index])
            elif isinstance(w, QtGui.QComboBox):
                w.setCurrentIndex(data[p.index])
            else:
                w.setChecked(data[p.index])

        self.data = data
        self.original_data = data[:]
        self.receiving = False
        self.show()
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, parent):
        QtGui.QComboBox.__init__(self, parent)
        self.model = QtGui.QStandardItemModel()
        self.state_item = QtGui.QStandardItem('all')
        self.state_item.setEnabled(False)
        self.model.appendRow(self.state_item)
        all_item = QtGui.QStandardItem('select all')
        self.model.appendRow(all_item)
        none_item = QtGui.QStandardItem('select none')
        self.model.appendRow(none_item)
        self.bank_items = []
        for i in range(8):
            item = QtGui.QStandardItem(uppercase[i])
            item.setCheckable(True)
            item.setCheckState(2)
            item.setTristate(False)
            self.model.appendRow(item)
            self.bank_items.append(item)
        self.setModel(self.model)
        self.activated.connect(self.check)
        self.setCurrentIndex(0)
        self.installEventFilter(self)
项目:ddt4all    作者:cedricp    | 项目源码 | 文件源码
def __init__(self, dataitem, parent=None):
        super(otherPanel, self).__init__(parent)
        self.setFrameStyle(gui.QFrame.Sunken)
        self.setFrameShape(gui.QFrame.Box)
        self.data = dataitem

        layout = gui.QGridLayout()
        labelnob = gui.QLabel(_("Number of bytes"))
        lableunit = gui.QLabel(_("Unit"))

        layout.addWidget(labelnob, 0, 0)
        layout.addWidget(lableunit, 1, 0)
        layout.setRowStretch(2, 1)

        self.inputnob = gui.QSpinBox()
        self.inputnob.setRange(1, 10240)
        self.inputtype = gui.QComboBox()
        self.inputtype.addItem("ASCII")
        self.inputtype.addItem("BCD/HEX")

        layout.addWidget(self.inputnob, 0, 1)
        layout.addWidget(self.inputtype, 1, 1)

        self.setLayout(layout)
        self.init()
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QComboBox.__init__(self, parent)
        self.setEditable(True)
        self.setInsertPolicy(QtGui.QComboBox.NoInsert)
        self.setMaximumWidth(100)
        self.p_model = QtGui.QStandardItemModel()
        self.name_model = QtGui.QStandardItemModel()
        self.setModel(self.p_model)

        metrics = QtGui.QFontMetrics(self.view().font())
        ctrl_width = []
        note_width = []
        for i in range(128):
            ctrl = Controllers[i]
            ctrl_str = '{} - {}'.format(i, ctrl)
            ctrl_item = QtGui.QStandardItem(ctrl_str)
            ctrl_item.setData(i, IdRole)
            ctrl_item.setData(ctrl, NameRole)
            ctrl_width.append(metrics.width(ctrl_str))
            ctrl_name_item = QtGui.QStandardItem(ctrl)
            ctrl_name_item.setData(i, IdRole)
            note = NoteNames[i].title()
            note_str = '{} - {}'.format(i, note)
            note_item = QtGui.QStandardItem(note_str)
            note_item.setData(i, IdRole)
            note_item.setData(note, NameRole)
            note_width.append(metrics.width(note_str))
            note_name_item = QtGui.QStandardItem(note)
            note_name_item.setData(i, IdRole)
            self.p_model.appendRow([ctrl_item, note_item])
            self.name_model.appendRow([ctrl_name_item, note_name_item])

        self.ctrl_width = max(ctrl_width)
        self.note_width = max(note_width)
        self.ref_size = self.width()

        self.activated.connect(lambda i: self.lineEdit().setCursorPosition(0))
        self.currentIndexChanged.connect(lambda i: self.lineEdit().setCursorPosition(0))
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def focusOutEvent(self, event):
        QtGui.QComboBox.focusOutEvent(self, event)
        text = str(self.lineEdit().text())
        found = self.p_model.findItems(text, QtCore.Qt.MatchFixedString, self.modelColumn())
        if found: return
        text = text.strip()
        if not text.isdigit():
            found = self.name_model.findItems(text, QtCore.Qt.MatchFixedString, self.modelColumn())
            if found:
                self.setCurrentIndex(found[0].data(IdRole).toPyObject())
            else:
                self.lineEdit().setText(self.p_model.item(self.currentIndex(), self.modelColumn()).text())
        elif not 0 <= int(text) <= 127:
            self.lineEdit().setText(self.p_model.item(self.currentIndex(), self.modelColumn()).text())
        else:
            self.setCurrentIndex(int(text))
        self.lineEdit().setCursorPosition(0)
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def set_data(self, widget, hint):
            item = self.index.model().itemFromIndex(self.index)
            if isinstance(widget, QtGui.QComboBox) or isinstance(widget, ParamCombo):
                found = widget.model().findItems(widget.currentText(), QtCore.Qt.MatchFixedString, widget.modelColumn())+widget.name_model.findItems(widget.currentText(), QtCore.Qt.MatchFixedString, widget.modelColumn())
                if found:
                    id = found[0].row()
                    text = widget.model().item(id, widget.modelColumn()).text()
                else:
                    id = widget.currentIndex()
                    text = widget.model().item(widget.currentIndex(), widget.modelColumn()).text()
                item.setData(id, IdRole)
                item.setText(text)
            elif isinstance(widget, QtGui.QSpinBox):
                if self.index.column() == 1:
                    item.setData(widget.value()-1, IdRole)
                    if widget.value() == 0:
                        item.setText('All')
                else:
                    item.setData(widget.value(), IdRole)
            else:
                item.setText(widget.valid)
                item.setData(widget.sysex, SysExRole)
项目:python_qt_tutorial    作者:awesomebytes    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(Main, self).__init__(parent)

        options = ['First option', 'Second option', 'Third option']
        default_option = 0
        self.combo_box = QtGui.QComboBox()
        for idx, option in enumerate(options):
            self.combo_box.insertItem(idx, option)
            if option == default_option:
                self.combo_box.setCurrentIndex(idx)

        # From http://doc.qt.io/qt-4.8/qcombobox.html#signals
        self.combo_box.currentIndexChanged.connect(self.on_dropdown_change)
        self.text_dropdown = QtGui.QLineEdit("")

        self.layout = QtGui.QHBoxLayout()
        self.layout.addWidget(self.combo_box)
        self.layout.addWidget(self.text_dropdown)

        self.central_widget = QtGui.QWidget()
        self.central_widget.setLayout(self.layout)

        self.setCentralWidget(self.central_widget)
项目:python_mini_projeler    作者:o11    | 项目源码 | 文件源码
def comboBoxsAndLineedit(self):
        self.cbKt = QtGui.QComboBox(self.groupBox)
        self.cbKt.setGeometry(QtCore.QRect(20, 60, 201, 27))
        self.cbKt.setObjectName(_fromUtf8("cbKt"))
        self.cbOs = QtGui.QComboBox(self.groupBox)
        self.cbOs.setGeometry(QtCore.QRect(20, 130, 201, 27))
        self.cbOs.setObjectName(_fromUtf8("cbOs"))
        self.cbVade = QtGui.QComboBox(self.groupBox)
        self.cbVade.setGeometry(QtCore.QRect(340, 130, 201, 27))
        self.cbVade.setObjectName(_fromUtf8("cbVade"))

        self.txtKtu = QtGui.QLineEdit(self.groupBox)
        self.txtKtu.setGeometry(QtCore.QRect(340, 60, 201, 27))
        self.txtKtu.setObjectName(_fromUtf8("txtKtu"))
        self.txtFaiz = QtGui.QLineEdit(self.groupBox)
        self.txtFaiz.setGeometry(QtCore.QRect(440, 175, 101, 27))
        self.txtFaiz.setObjectName(_fromUtf8("txtFaiz"))

        self.addItemToComboBoxs()
项目:fman    作者:bfaure    | 项目源码 | 文件源码
def initUI(self):

        self.box = QtGui.QComboBox(self)

        for i in self.formats:
            self.box.addItem(strftime(i))

        insert = QtGui.QPushButton("Insert",self)
        insert.clicked.connect(self.insert)

        cancel = QtGui.QPushButton("Cancel",self)
        cancel.clicked.connect(self.close)

        layout = QtGui.QGridLayout()

        layout.addWidget(self.box,0,0,1,2)
        layout.addWidget(insert,1,0)
        layout.addWidget(cancel,1,1)

        self.setGeometry(300,300,400,80)
        self.setWindowTitle("Date and Time")
        self.setLayout(layout)
项目:TMV3    作者:HenricusRex    | 项目源码 | 文件源码
def addItem(self,row,text1,text2,text3,text4):
        _item1 = QtGui.QTableWidgetItem(text1)
        _item2 = QtGui.QTableWidgetItem(text2)
        _item3 = QtGui.QTableWidgetItem(text3)
        _item4 = QtGui.QTableWidgetItem(text4)

        assert isinstance(self.ui.tableWidget,QtGui.QTableWidget)
        self.ui.tableWidget.insertRow(row)
        self.ui.tableWidget.setItem(row,0,_item1)
        self.ui.tableWidget.setItem(row,1,_item2)
        self.ui.tableWidget.setItem(row,2,_item3)
        self.ui.tableWidget.setItem(row,3,_item4)

#        _itemC = QtGui.QComboBox()
#        if text1 == 'Antenna':
#            _itemC.addItems(self.AntennaList)
#        if text1 == 'Cable':
#            _itemC.addItems(self.CableList)
#        self.ui.tableWidget.setCellWidget(row,2,_itemC)

  #      _itemD = QtGui.QDateEdit()
  #      self.ui.tableWidget.setCellWidget(row,4,_itemD)
项目:TMV3    作者:HenricusRex    | 项目源码 | 文件源码
def addItem(self,row,text2,text3):
        _item2 = QtGui.QTableWidgetItem(text2)
        _item3 = QtGui.QTableWidgetItem('?')
        _item5 = QtGui.QTableWidgetItem(text3)

        assert isinstance(self.ui.tableWidget,QtGui.QTableWidget)
        self.ui.tableWidget.insertRow(row)
        self.ui.tableWidget.setItem(row,0,_item2)
        self.ui.tableWidget.setItem(row,2,_item3)
        self.ui.tableWidget.setItem(row,4,_item5)

        _itemC = QtGui.QComboBox()
        _itemC.addItem(text2)
        _itemC.addItems(self.LimitList)
        self.ui.tableWidget.setCellWidget(row,1,_itemC)

        _itemD = QtGui.QDateEdit()
        self.ui.tableWidget.setCellWidget(row,3,_itemD)
项目:TMV3    作者:HenricusRex    | 项目源码 | 文件源码
def addItem(self,row,text1,text2,text3):
        _item1 = QtGui.QTableWidgetItem(text1)
        _item2 = QtGui.QTableWidgetItem(text2)
        _item3 = QtGui.QTableWidgetItem('?')
        _item5 = QtGui.QTableWidgetItem(text3)

        assert isinstance(self.ui.tableWidget,QtGui.QTableWidget)
        self.ui.tableWidget.insertRow(row)
        self.ui.tableWidget.setItem(row,0,_item1)
        self.ui.tableWidget.setItem(row,1,_item2)
        self.ui.tableWidget.setItem(row,3,_item3)
        self.ui.tableWidget.setItem(row,5,_item5)

        _itemC = QtGui.QComboBox()
        if text1 == 'Antenna':
            _itemC.addItems(self.AntennaList)
        if text1 == 'Cable':
            _itemC.addItems(self.CableList)
        self.ui.tableWidget.setCellWidget(row,2,_itemC)

        _itemD = QtGui.QDateEdit()
        self.ui.tableWidget.setCellWidget(row,4,_itemD)
项目:nettools    作者:germandutchwindtunnels    | 项目源码 | 文件源码
def config_row(self, row_number):
        """ Configure a row of the table """
        # Init all fields, this is needed to make all slots work when we fill everything out
        comboBoxPatchport = QComboBox(self.tableWidget)
        self.tableWidget.setCellWidget(row_number, 0, comboBoxPatchport)

        if row_number > 0:
            for i in range(1, 6):
                originalItem = self.tableWidget.item(row_number - 1, i)
                newItem = QTableWidgetItem(originalItem)
                self.tableWidget.setItem(row_number, i, newItem)

        comboBoxVlans = QComboBox(self.tableWidget)
        self.tableWidget.setCellWidget(row_number, 2, comboBoxVlans)

        buttonSubmit = QPushButton("Submit", self.tableWidget)
        buttonSubmit.setEnabled(False)
        self.tableWidget.setCellWidget(row_number, 6, buttonSubmit)

        # Connect selection signals
        comboBoxPatchport.currentIndexChanged.connect(
            lambda i, row_number=row_number: self._patchport_selected(row_number))
        comboBoxVlans.currentIndexChanged.connect(
            lambda i, row_number=row_number: self._vlanname_selected(row_number))
        buttonSubmit.clicked.connect(
            lambda i, row_number=row_number: self._submit_pressed(row_number))

        self.fillPatchports(comboBoxPatchport)
        self.fillVlans(comboBoxVlans)

        # Connect slots to add a row
        comboBoxVlans.currentIndexChanged.connect(
            lambda i, row_number=row_number: self._row_edited(row_number))
        comboBoxPatchport.currentIndexChanged.connect(
            lambda i, row_number=row_number: self._row_edited(row_number))

        # Resize
        self.tableWidget.resizeColumnsToContents()
项目:Comictagger    作者:dickloraine    | 项目源码 | 文件源码
def connectChildDirtyFlagSignals (self, widget ):

        if ( isinstance(widget, QtGui.QLineEdit)):
            widget.textEdited.connect(self.setDirtyFlag)
        if ( isinstance(widget, QtGui.QTextEdit)):
            widget.textChanged.connect(self.setDirtyFlag)
        if ( isinstance(widget, QtGui.QComboBox) ):
            widget.currentIndexChanged.connect(self.setDirtyFlag)
        if ( isinstance(widget, QtGui.QCheckBox) ):
            widget.stateChanged.connect(self.setDirtyFlag)

        # recursive call on chillun
        for child in widget.children():
            if child != self.pageListEditor:
                self.connectChildDirtyFlagSignals( child )
项目:fsc    作者:ptravers    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()
        #add box for this hbox
        self.publisher_menu = QtGui.QComboBox(self)
        self.subscriber_menu = QtGui.QComboBox(self)
        self.layout = QtGui.QHBoxLayout(self)
        self.setLayout(self.layout)
        self.populate_menus()
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(312, 31)
        self.verticalLayout = QtGui.QVBoxLayout(Form)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setMargin(0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.frame = QtGui.QFrame(Form)
        self.frame.setFrameShape(QtGui.QFrame.Box)
        self.frame.setFrameShadow(QtGui.QFrame.Sunken)
        self.frame.setLineWidth(2)
        self.frame.setObjectName(_fromUtf8("frame"))
        self.horizontalLayout = QtGui.QHBoxLayout(self.frame)
        self.horizontalLayout.setSpacing(4)
        self.horizontalLayout.setMargin(0)
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.label = QtGui.QLabel(self.frame)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName(_fromUtf8("label"))
        self.horizontalLayout.addWidget(self.label)
        self.items = QtGui.QComboBox(self.frame)
        self.items.setObjectName(_fromUtf8("items"))
        self.horizontalLayout.addWidget(self.items)
        self.button = QtGui.QPushButton(self.frame)
        self.button.setMaximumSize(QtCore.QSize(60, 16777215))
        self.button.setObjectName(_fromUtf8("button"))
        self.horizontalLayout.addWidget(self.button)
        self.verticalLayout.addWidget(self.frame)

        self.retranslateUi(Form)
        QtCore.QObject.connect(self.button, QtCore.SIGNAL(_fromUtf8("clicked()")), Form.clicked)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(312, 31)
        self.verticalLayout = QtGui.QVBoxLayout(Form)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setMargin(0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.frame = QtGui.QFrame(Form)
        self.frame.setFrameShape(QtGui.QFrame.Box)
        self.frame.setFrameShadow(QtGui.QFrame.Sunken)
        self.frame.setLineWidth(2)
        self.frame.setObjectName(_fromUtf8("frame"))
        self.horizontalLayout = QtGui.QHBoxLayout(self.frame)
        self.horizontalLayout.setSpacing(4)
        self.horizontalLayout.setMargin(0)
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.label = QtGui.QLabel(self.frame)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName(_fromUtf8("label"))
        self.horizontalLayout.addWidget(self.label)
        self.items = QtGui.QComboBox(self.frame)
        self.items.setObjectName(_fromUtf8("items"))
        self.horizontalLayout.addWidget(self.items)
        self.button = QtGui.QPushButton(self.frame)
        self.button.setMaximumSize(QtCore.QSize(60, 16777215))
        self.button.setObjectName(_fromUtf8("button"))
        self.horizontalLayout.addWidget(self.button)
        self.verticalLayout.addWidget(self.frame)

        self.retranslateUi(Form)
        QtCore.QObject.connect(self.button, QtCore.SIGNAL(_fromUtf8("clicked()")), Form.clicked)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(312, 31)
        self.verticalLayout = QtGui.QVBoxLayout(Form)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setMargin(0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.frame = QtGui.QFrame(Form)
        self.frame.setFrameShape(QtGui.QFrame.Box)
        self.frame.setFrameShadow(QtGui.QFrame.Sunken)
        self.frame.setLineWidth(2)
        self.frame.setObjectName(_fromUtf8("frame"))
        self.horizontalLayout = QtGui.QHBoxLayout(self.frame)
        self.horizontalLayout.setSpacing(4)
        self.horizontalLayout.setMargin(0)
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.label = QtGui.QLabel(self.frame)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName(_fromUtf8("label"))
        self.horizontalLayout.addWidget(self.label)
        self.items = QtGui.QComboBox(self.frame)
        self.items.setObjectName(_fromUtf8("items"))
        self.horizontalLayout.addWidget(self.items)
        self.button = QtGui.QPushButton(self.frame)
        self.button.setMaximumSize(QtCore.QSize(60, 16777215))
        self.button.setObjectName(_fromUtf8("button"))
        self.horizontalLayout.addWidget(self.button)
        self.verticalLayout.addWidget(self.frame)

        self.retranslateUi(Form)
        QtCore.QObject.connect(self.button, QtCore.SIGNAL(_fromUtf8("clicked()")), Form.clicked)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(316, 70)
        self.gridLayout = QtGui.QGridLayout(Form)
        self.gridLayout.setContentsMargins(0, 2, 0, 2)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.line = QtGui.QFrame(Form)
        self.line.setFrameShape(QtGui.QFrame.HLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName(_fromUtf8("line"))
        self.gridLayout.addWidget(self.line, 0, 0, 1, 3)
        self.dataOptions = QtGui.QComboBox(Form)
        self.dataOptions.setObjectName(_fromUtf8("dataOptions"))
        self.gridLayout.addWidget(self.dataOptions, 2, 0, 1, 3)
        self.enable = QtGui.QCheckBox(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.enable.sizePolicy().hasHeightForWidth())
        self.enable.setSizePolicy(sizePolicy)
        self.enable.setMinimumSize(QtCore.QSize(20, 0))
        self.enable.setText(_fromUtf8(""))
        self.enable.setObjectName(_fromUtf8("enable"))
        self.gridLayout.addWidget(self.enable, 1, 0, 1, 1)
        self.title = QtGui.QLabel(Form)
        self.title.setObjectName(_fromUtf8("title"))
        self.gridLayout.addWidget(self.title, 1, 1, 1, 1)
        self.toolButton = QtGui.QToolButton(Form)
        icon = QtGui.QIcon.fromTheme(_fromUtf8("window-close"))
        self.toolButton.setIcon(icon)
        self.toolButton.setObjectName(_fromUtf8("toolButton"))
        self.gridLayout.addWidget(self.toolButton, 1, 2, 1, 1)
        self.line_2 = QtGui.QFrame(Form)
        self.line_2.setFrameShape(QtGui.QFrame.HLine)
        self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
        self.line_2.setObjectName(_fromUtf8("line_2"))
        self.gridLayout.addWidget(self.line_2, 3, 0, 1, 3)

        self.retranslateUi(Form)
        QtCore.QObject.connect(self.toolButton, QtCore.SIGNAL(_fromUtf8("clicked()")), Form.remove)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:PyFRAP    作者:alexblaessle    | 项目源码 | 文件源码
def genSettingCombo(parent,lblText,comboList,callback=None,idx=0):

    """Generates ``QLabel`` and ``QPushButton`` with given label and connects 
    to correct callback.

    .. note:: ``QPushButton`` is conncect with ``clicked`` slot.

    Args:
        parent (QtGui.QWidget): Some parenting widget.
        lblText (str): Text displayed in label.
        comboList (list): List of strings that are added to QComboBox.

    Keyword Args:
        callback (function): Some callback function.
        idx (int): Starting index of combo.

    Returns:
        tuple: Tuple containing:

            * lbl (QtGui.QLabel): Label.
            * combo (QtGui.QComboBox): Combobox.

    """

    lbl = QtGui.QLabel(lblText, parent)
    combo=QtGui.QComboBox(parent)

    for x in comboList:
        combo.addItem(x)

    if callback!=None:
        combo.activated[str].connect(callback)   

    combo.setCurrentIndex(idx)

    return lbl,combo
项目:EasyStorj    作者:lakewik    | 项目源码 | 文件源码
def setupUi(self, FileManager):
        FileManager.setObjectName(_fromUtf8("FileManager"))
        FileManager.resize(977, 313)
        self.label = QtGui.QLabel(FileManager)
        self.label.setGeometry(QtCore.QRect(290, 0, 141, 61))
        self.label.setObjectName(_fromUtf8("label"))
        self.file_delete_bt = QtGui.QPushButton(FileManager)
        self.file_delete_bt.setGeometry(QtCore.QRect(760, 100, 211, 31))
        self.file_delete_bt.setObjectName(_fromUtf8("file_delete_bt"))
        self.file_mirrors_bt = QtGui.QPushButton(FileManager)
        self.file_mirrors_bt.setGeometry(QtCore.QRect(760, 60, 211, 31))
        self.file_mirrors_bt.setObjectName(_fromUtf8("file_mirrors_bt"))
        self.line = QtGui.QFrame(FileManager)
        self.line.setGeometry(QtCore.QRect(740, 60, 20, 241))
        self.line.setFrameShape(QtGui.QFrame.VLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName(_fromUtf8("line"))
        self.quit_bt = QtGui.QPushButton(FileManager)
        self.quit_bt.setGeometry(QtCore.QRect(760, 240, 211, 61))
        self.quit_bt.setObjectName(_fromUtf8("quit_bt"))
        self.files_list_tableview = QtGui.QTableView(FileManager)
        self.files_list_tableview.setGeometry(QtCore.QRect(10, 60, 731, 241))
        self.files_list_tableview.setObjectName(_fromUtf8("files_list_tableview"))
        self.file_download_bt = QtGui.QPushButton(FileManager)
        self.file_download_bt.setGeometry(QtCore.QRect(760, 140, 211, 31))
        self.file_download_bt.setObjectName(_fromUtf8("file_download_bt"))
        self.new_file_upload_bt = QtGui.QPushButton(FileManager)
        self.new_file_upload_bt.setGeometry(QtCore.QRect(760, 180, 211, 51))
        self.new_file_upload_bt.setObjectName(_fromUtf8("new_file_upload_bt"))
        self.label_2 = QtGui.QLabel(FileManager)
        self.label_2.setGeometry(QtCore.QRect(600, 20, 131, 31))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.bucket_select_combo_box = QtGui.QComboBox(FileManager)
        self.bucket_select_combo_box.setGeometry(QtCore.QRect(740, 20, 231, 31))
        self.bucket_select_combo_box.setObjectName(_fromUtf8("bucket_select_combo_box"))

        self.retranslateUi(FileManager)
        QtCore.QMetaObject.connectSlotsByName(FileManager)
项目:albion    作者:Oslandia    | 项目源码 | 文件源码
def add_to_toolbar(self, toolbar, iface):
        self.iface = iface
        self.iface.currentLayerChanged.connect(self.__update_state)

        # add combo box
        self.combo = QComboBox()
        self.combo.setMinimumContentsLength(10)
        toolbar.addWidget(self.combo)
        self.combo.currentIndexChanged.connect(self.__currentIndexChanged)
        # add tag action
        self.action = toolbar.addAction(icon('3_tag_layer_graph.svg'),
                                        'mark as graph')
        self.action.setCheckable(True)
        self.action.triggered.connect(self.__on_click)
项目:community-plugins    作者:makehumancommunity    | 项目源码 | 文件源码
def __init__(self,data = None, onChange = None):
        super(ComboBox, self).__init__()
        self.currentIndexChanged.connect(self._onChange)
        if data:
            self.setData(data)
        if onChange:
            self.onChangeMethod = onChange

        # Padding is because Qt has a bug that ignores style color in a 
        # combobox without it (for some incomprehensible reason)
        self.setStyleSheet("QComboBox { color: white; padding: 2px }")
项目:qrtools    作者:primetang    | 项目源码 | 文件源码
def __init__(self):
        QtGui.QDialog.__init__(self)

        self.videoDevices = []
        for vd in self.getVideoDevices():
            self.videoDevices.append(vd)

        self.setWindowTitle(self.tr('Decode from Webcam'))
        self.cameraIcon = QtGui.QIcon.fromTheme("camera")
        self.icon = QtGui.QLabel()
        self.icon.setPixmap(self.cameraIcon.pixmap(64,64).scaled(64,64))
        self.videoDevice = QtGui.QComboBox()
        self.videoDevice.addItems([vd[0] for vd in self.videoDevices])
        self.label = QtGui.QLabel(self.tr("You are about to decode from your webcam. Please put the code in front of your camera with a good light source and keep it steady.\nOnce you see a green rectangle you can close the window by pressing any key.\n\nPlease select the video device you want to use for decoding:"))
        self.label.setWordWrap(True)
        self.Buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
        self.Buttons.accepted.connect(self.accept)
        self.Buttons.rejected.connect(self.reject)
        self.layout = QtGui.QVBoxLayout()
        self.hlayout = QtGui.QHBoxLayout()
        self.vlayout = QtGui.QVBoxLayout()
        self.hlayout.addWidget(self.icon, 0, QtCore.Qt.AlignTop)
        self.vlayout.addWidget(self.label)
        self.vlayout.addWidget(self.videoDevice)
        self.hlayout.addLayout(self.vlayout)
        self.layout.addLayout(self.hlayout)
        self.layout.addStretch()
        self.layout.addWidget(self.Buttons)

        self.setLayout(self.layout)
项目:Modular_Rigging_Thesis    作者:LoganKelly    | 项目源码 | 文件源码
def setupUi(self, hipComponentWidget):
        hipComponentWidget.setObjectName(_fromUtf8("hipComponentWidget"))
        hipComponentWidget.resize(206, 270)
        self.gridLayout = QtGui.QGridLayout(hipComponentWidget)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem, 6, 0, 1, 2)
        self.nameLabel = QtGui.QLabel(hipComponentWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.nameLabel.sizePolicy().hasHeightForWidth())
        self.nameLabel.setSizePolicy(sizePolicy)
        self.nameLabel.setMaximumSize(QtCore.QSize(40, 16777215))
        self.nameLabel.setObjectName(_fromUtf8("nameLabel"))
        self.gridLayout.addWidget(self.nameLabel, 3, 0, 1, 1)
        self.name = QtGui.QLineEdit(hipComponentWidget)
        self.name.setObjectName(_fromUtf8("name"))
        self.gridLayout.addWidget(self.name, 3, 1, 1, 1)
        self.colorLabel = QtGui.QLabel(hipComponentWidget)
        self.colorLabel.setObjectName(_fromUtf8("colorLabel"))
        self.gridLayout.addWidget(self.colorLabel, 4, 0, 1, 1)
        self.colorComboBox = QtGui.QComboBox(hipComponentWidget)
        self.colorComboBox.setObjectName(_fromUtf8("colorComboBox"))
        self.gridLayout.addWidget(self.colorComboBox, 4, 1, 1, 1)
        self.iconLabel = QtGui.QLabel(hipComponentWidget)
        self.iconLabel.setObjectName(_fromUtf8("iconLabel"))
        self.gridLayout.addWidget(self.iconLabel, 5, 0, 1, 1)
        self.iconComboBox = QtGui.QComboBox(hipComponentWidget)
        self.iconComboBox.setObjectName(_fromUtf8("iconComboBox"))
        self.gridLayout.addWidget(self.iconComboBox, 5, 1, 1, 1)
        self.versionLabel = QtGui.QLabel(hipComponentWidget)
        self.versionLabel.setObjectName(_fromUtf8("versionLabel"))
        self.gridLayout.addWidget(self.versionLabel, 0, 0, 1, 1)
        self.version = QtGui.QLabel(hipComponentWidget)
        self.version.setText(_fromUtf8(""))
        self.version.setObjectName(_fromUtf8("version"))
        self.gridLayout.addWidget(self.version, 0, 1, 1, 1)

        self.retranslateUi(hipComponentWidget)
        QtCore.QMetaObject.connectSlotsByName(hipComponentWidget)
项目:Modular_Rigging_Thesis    作者:LoganKelly    | 项目源码 | 文件源码
def setupUi(self, globalComponentWidget):
        globalComponentWidget.setObjectName(_fromUtf8("globalComponentWidget"))
        globalComponentWidget.resize(206, 270)
        self.gridLayout = QtGui.QGridLayout(globalComponentWidget)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem, 6, 0, 1, 2)
        self.nameLabel = QtGui.QLabel(globalComponentWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.nameLabel.sizePolicy().hasHeightForWidth())
        self.nameLabel.setSizePolicy(sizePolicy)
        self.nameLabel.setMaximumSize(QtCore.QSize(40, 16777215))
        self.nameLabel.setObjectName(_fromUtf8("nameLabel"))
        self.gridLayout.addWidget(self.nameLabel, 3, 0, 1, 1)
        self.name = QtGui.QLineEdit(globalComponentWidget)
        self.name.setObjectName(_fromUtf8("name"))
        self.gridLayout.addWidget(self.name, 3, 1, 1, 1)
        self.colorLabel = QtGui.QLabel(globalComponentWidget)
        self.colorLabel.setObjectName(_fromUtf8("colorLabel"))
        self.gridLayout.addWidget(self.colorLabel, 4, 0, 1, 1)
        self.colorComboBox = QtGui.QComboBox(globalComponentWidget)
        self.colorComboBox.setObjectName(_fromUtf8("colorComboBox"))
        self.gridLayout.addWidget(self.colorComboBox, 4, 1, 1, 1)
        self.iconLabel = QtGui.QLabel(globalComponentWidget)
        self.iconLabel.setObjectName(_fromUtf8("iconLabel"))
        self.gridLayout.addWidget(self.iconLabel, 5, 0, 1, 1)
        self.iconComboBox = QtGui.QComboBox(globalComponentWidget)
        self.iconComboBox.setObjectName(_fromUtf8("iconComboBox"))
        self.gridLayout.addWidget(self.iconComboBox, 5, 1, 1, 1)
        self.versionLabel = QtGui.QLabel(globalComponentWidget)
        self.versionLabel.setObjectName(_fromUtf8("versionLabel"))
        self.gridLayout.addWidget(self.versionLabel, 0, 0, 1, 1)
        self.version = QtGui.QLabel(globalComponentWidget)
        self.version.setText(_fromUtf8(""))
        self.version.setObjectName(_fromUtf8("version"))
        self.gridLayout.addWidget(self.version, 0, 1, 1, 1)

        self.retranslateUi(globalComponentWidget)
        QtCore.QMetaObject.connectSlotsByName(globalComponentWidget)
项目:certificate_generator    作者:juliarizza    | 项目源码 | 文件源码
def __init__(self, certificates_instance, event_id):
        """
            Setup widgets and select data from database.
        """
        super(AddClientDialog, self).__init__()
        # Window config
        self.setWindowTitle(u"Adicionar cliente")
        self.certificates_instance = certificates_instance
        self.event_id = event_id

        # Select clients in alphabetical order
        cursor.execute("SELECT * FROM clients ORDER BY name ASC")
        self.clients = cursor.fetchall()

        # Define layouts
        self.mainLayout = QtGui.QVBoxLayout()

        # Frame config
        self.titleLabel = QtGui.QLabel(u"Selecione um cliente")
        self.titleLabel.setFont(titleFont)

        # Fill combo with clients info
        self.clientsList = QtGui.QComboBox()
        for client in self.clients:
            self.clientsList.addItem(unicode(client[1]))

        # Create the main button
        self.saveBtn = QtGui.QPushButton(u"Selecionar")
        self.saveBtn.clicked.connect(self.add_client)

        # Add all widgets to the mainLayout
        self.mainLayout.addWidget(self.titleLabel)
        self.mainLayout.addWidget(self.clientsList)
        self.mainLayout.addWidget(self.saveBtn)

        # Set mainLayout as the visible layout
        self.setLayout(self.mainLayout)
项目:olive-gui    作者:dturevski    | 项目源码 | 文件源码
def __init__(self, Lang):
        form = QtGui.QFormLayout()
        self.comboColor = QtGui.QComboBox()
        self.comboColor.addItems(model.COLORS)
        form.addRow(Lang.value('PP_Color'), self.comboColor)

        self.piece_types = sorted(model.FairyHelper.glyphs.iterkeys())
        self.comboType = QtGui.QComboBox()
        self.comboType.addItems(
            [x + ' (' + model.FairyHelper.glyphs[x]['name'] + ')' for x in self.piece_types])
        form.addRow(Lang.value('PP_Type'), self.comboType)

        vbox = QtGui.QVBoxLayout()
        vbox.addLayout(form, 1)
        vbox.addWidget(QtGui.QLabel(Lang.value('PP_Fairy_properties')))

        self.checkboxes = [QtGui.QCheckBox(x) for x in model.FAIRYSPECS]
        for box in self.checkboxes:
            vbox.addWidget(box)

        self.mainWidget = QtGui.QWidget()
        self.mainWidget.setLayout(vbox)
        super(AddFairyPieceDialog, self).__init__(Lang)

        self.setWindowTitle(Lang.value('MI_Add_piece'))
项目:olive-gui    作者:dturevski    | 项目源码 | 文件源码
def __init__(self):
        super(DistinctionWidget, self).__init__()
        hbox = QtGui.QHBoxLayout()
        self.special = QtGui.QCheckBox(Lang.value('DSTN_Special'))
        hbox.addWidget(self.special)
        self.lo = QtGui.QSpinBox()
        hbox.addWidget(self.lo)
        self.hi = QtGui.QSpinBox()
        hbox.addWidget(self.hi)
        self.name = QtGui.QComboBox()
        self.name.addItems(
            ['X' * 15 for i in DistinctionWidget.names])  # spacers
        hbox.addWidget(self.name)
        self.comment = QtGui.QLineEdit()
        hbox.addWidget(self.comment)
        hbox.addStretch(1)
        self.setLayout(hbox)

        self.special.stateChanged.connect(self.onChanged)
        self.name.currentIndexChanged.connect(self.onChanged)
        self.lo.valueChanged.connect(self.onChanged)
        self.hi.valueChanged.connect(self.onChanged)
        self.comment.textChanged.connect(self.onChanged)

        Mainframe.sigWrapper.sigModelChanged.connect(self.onModelChanged)
        Mainframe.sigWrapper.sigLangChanged.connect(self.onLangChanged)
        self.skip_model_changed = False
        self.onLangChanged()
项目:tinderNNBot    作者:dsouzarc    | 项目源码 | 文件源码
def createUIComponents(self):
        self.currentImageLabel = QtGui.QLabel(self)
        self.currentStatusLabel = QtGui.QLabel(self)

        self.swipeRightButton = QtGui.QPushButton('Like', self);
        self.swipeLeftButton = QtGui.QPushButton('Pass', self);
        self.superLikeButton = QtGui.QPushButton('Super-Like', self);

        self.swipeRightButton.clicked.connect(self.swipeRight);
        self.swipeLeftButton.clicked.connect(self.swipeLeft);
        self.superLikeButton.clicked.connect(self.superLike);

        self.personDescriptionTextEdit = QtGui.QTextEdit();
        self.personDescriptionTextEdit.setEnabled(False);

        self.swipeInformationTextEdit = QtGui.QTextEdit();
        self.swipeInformationTextEdit.setEnabled(False);

        self.eyeColorLabel = QtGui.QLabel(self);
        self.eyeColorLabel.setText("Eye Color: ");
        self.eyeColorComboBox = QtGui.QComboBox(self);
        self.eyeColorComboBox.activated[str].connect(self.changedEyeColor);
        self.addEyeColorOptions();

        self.hairColorLabel = QtGui.QLabel(self);
        self.hairColorLabel.setText("Hair Color: ");
        self.hairColorComboBox = QtGui.QComboBox(self);
        self.hairColorComboBox.activated[str].connect(self.changedHairColor);
        self.addHairColorOptions();
项目:picasso    作者:jungmannlab    | 项目源码 | 文件源码
def initTable(self, colorcounts, tableshort, tablelong):
        noseq = _np.count_nonzero(colorcounts)
        # table defintion
        self.table.setRowCount(noseq-1)
        rowRunner = 0
        for i in range(len(colorcounts)-1):
            if colorcounts[i] > 0:
                self.table.setItem(rowRunner, 0,  QtGui.QTableWidgetItem(str(i+1)))
                self.table.setItem(rowRunner, 1,  QtGui.QTableWidgetItem("Ext "+str(i+1)))
                self.table.item(rowRunner,  1).setBackground(allcolors[i+1])
                self.table.setItem(rowRunner, 3,  QtGui.QTableWidgetItem(tableshort[i]))
                self.table.setItem(rowRunner, 4,  QtGui.QTableWidgetItem(tablelong[i]))
                rowRunner += 1

        self.ImagersShort = allSeqShort.split(", ")
        self.ImagersLong = allSeqLong.split(", ")

        comb = dict()

        for i in range(self.table.rowCount()):
            comb[i] = QtGui.QComboBox()

        for element in self.ImagersShort:
            for i in range(self.table.rowCount()):
                comb[i].addItem(element)

        for i in range(self.table.rowCount()):
            self.table.setCellWidget(i,  2,  comb[i])
            comb[i].currentIndexChanged.connect(lambda state,  indexval=i: self.changeComb(indexval))
项目:picasso    作者:jungmannlab    | 项目源码 | 文件源码
def __init__(self, window):
        super().__init__(window)
        self.window = window
        # vars = self.view.locs[0].dtype.names
        self.setWindowTitle('Apply expression')
        vbox = QtGui.QVBoxLayout(self)
        layout = QtGui.QGridLayout()
        vbox.addLayout(layout)
        layout.addWidget(QtGui.QLabel('Channel:'), 0, 0)
        self.channel = QtGui.QComboBox()
        self.channel.addItems(self.window.view.locs_paths)
        layout.addWidget(self.channel, 0, 1)
        self.channel.currentIndexChanged.connect(self.update_vars)
        layout.addWidget(QtGui.QLabel('Pre-defined variables:'), 1, 0)
        self.label = QtGui.QLabel()
        layout.addWidget(self.label, 1, 1)
        self.update_vars(0)
        layout.addWidget(QtGui.QLabel('Expression:'), 2, 0)
        self.cmd = QtGui.QLineEdit()
        layout.addWidget(self.cmd, 2, 1)
        hbox = QtGui.QHBoxLayout()
        vbox.addLayout(hbox)
        # OK and Cancel buttons
        self.buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel,
                                              QtCore.Qt.Horizontal,
                                              self)
        vbox.addWidget(self.buttons)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

    # static method to create the dialog and return (date, time, accepted)
项目:picasso    作者:jungmannlab    | 项目源码 | 文件源码
def __init__(self, window):
        super().__init__(window)
        self.window = window
        self.setWindowTitle('Enter movie info')
        vbox = QtGui.QVBoxLayout(self)
        grid = QtGui.QGridLayout()
        grid.addWidget(QtGui.QLabel('Byte Order:'), 0, 0)
        self.byte_order = QtGui.QComboBox()
        self.byte_order.addItems(['Little Endian (loads faster)', 'Big Endian'])
        grid.addWidget(self.byte_order, 0, 1)
        grid.addWidget(QtGui.QLabel('Data Type:'), 1, 0)
        self.dtype = QtGui.QComboBox()
        self.dtype.addItems(['float16', 'float32', 'float64', 'int8', 'int16', 'int32', 'uint8', 'uint16', 'uint32'])
        grid.addWidget(self.dtype, 1, 1)
        grid.addWidget(QtGui.QLabel('Frames:'), 2, 0)
        self.frames = QtGui.QSpinBox()
        self.frames.setRange(1, 1e9)
        grid.addWidget(self.frames, 2, 1)
        grid.addWidget(QtGui.QLabel('Height:'), 3, 0)
        self.movie_height = QtGui.QSpinBox()
        self.movie_height.setRange(1, 1e9)
        grid.addWidget(self.movie_height, 3, 1)
        grid.addWidget(QtGui.QLabel('Width'), 4, 0)
        self.movie_width = QtGui.QSpinBox()
        self.movie_width.setRange(1, 1e9)
        grid.addWidget(self.movie_width, 4, 1)
        self.save = QtGui.QCheckBox('Save info to yaml file')
        self.save.setChecked(True)
        grid.addWidget(self.save, 5, 0, 1, 2)
        vbox.addLayout(grid)
        hbox = QtGui.QHBoxLayout()
        vbox.addLayout(hbox)
        # OK and Cancel buttons
        self.buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel,
                                              QtCore.Qt.Horizontal,
                                              self)
        vbox.addWidget(self.buttons)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

    # static method to create the dialog and return (date, time, accepted)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def createEditor(self, parent, option, index):
        self.proxy = index.model()
        self.index = self.proxy.mapToSource(index)
        combo = QtGui.QComboBox(parent)
        model = QtGui.QStandardItemModel()
        [model.appendRow(QtGui.QStandardItem(cat)) for cat in categories]
        combo.setModel(model)
        combo.setCurrentIndex(index.data(CatRole).toPyObject())
        combo.activated.connect(lambda i: parent.setFocus())
        return combo
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def createEditor(self, parent, option, index):
        self.index = index
        combo = QtGui.QComboBox(parent)
        combo.addItems(['Unchanged'] + index.data(ValuesRole).toPyObject())
#        model = QtGui.QStandardItemModel()
#        [model.appendRow(QtGui.QStandardItem(value)) for value in index.data(ValuesRole).toPyObject()]
#        combo.setModel(model)
        combo.setCurrentIndex(index.data(EditedRole).toPyObject() + 1)
        combo.activated.connect(lambda i: parent.setFocus())
        return combo
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def hidePopup(self):
        if not self.view().rect().contains(self.view().mapFromGlobal(QtGui.QCursor().pos())):
            QtGui.QComboBox.hidePopup(self)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def _setValue(self, id):
        self.blockSignals(True)
        self.setCurrentIndex(id)
        self.blockSignals(False)
#        self.currentIndex = id
#        self.current = self.value_list[id]
        self.update()

#    def setCurrentIndex(self, id):
#        print 'ofkssd'
#        self._setValue(id)
#        self.indexChanged.emit(id)
#        self.update()
#        QtGui.QComboBox.setCurrentIndex(self, id)
项目:ddt4all    作者:cedricp    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(sniffer, self).__init__(parent)
        self.ecu_file = None
        self.ecurequests = None
        self.snifferthread = None
        self.currentrequest = None
        self.names = []
        self.oktostart = False
        self.ecu_filter = ""

        hlayout = gui.QHBoxLayout()

        self.framecombo = gui.QComboBox()

        self.startbutton = gui.QPushButton(">>")
        self.addressinfo = gui.QLabel("0000")

        self.startbutton.setCheckable(True)
        self.startbutton.toggled.connect(self.startmonitoring)

        self.addressinfo.setFixedWidth(90)
        self.startbutton.setFixedWidth(90)

        hlayout.addWidget(self.addressinfo)
        hlayout.addWidget(self.framecombo)
        hlayout.addWidget(self.startbutton)

        vlayout = gui.QVBoxLayout()
        self.setLayout(vlayout)

        vlayout.addLayout(hlayout)

        self.table = gui.QTableWidget()
        vlayout.addWidget(self.table)

        self.framecombo.activated.connect(self.change_frame)
项目:afDist    作者:jsgounot    | 项目源码 | 文件源码
def initUI(self) :
        self.main_widget = QtGui.QWidget(self)
        self.layout = QtGui.QVBoxLayout(self.main_widget)
        self.layout_top_right = QtGui.QHBoxLayout()
        self.layout_top = QtGui.QHBoxLayout()

        # Search bar with auto completer
        model = QtGui.QStringListModel()
        model.setStringList(self.genes.keys())
        self.completer = QtGui.QCompleter()
        self.completer.setModel(model)
        self.search_bar = QtGui.QLineEdit("Search gene")
        self.search_bar.keyPressEvent = self.search_bar_key_event
        self.search_bar.mousePressEvent = self.search_bar_mouse_event
        self.search_bar.setCompleter(self.completer)

        self.af_bar = QtGui.QLineEdit("Set af bar")
        self.af_bar.keyPressEvent = self.af_bar_key_event
        self.af_bar.mousePressEvent = self.af_bar_mouse_event

        self.chromosome_combobox = QtGui.QComboBox()
        self.start_bar = QtGui.QLineEdit("Start coordinate")
        self.start_bar.keyPressEvent = self.start_bar_key_event
        self.start_bar.mousePressEvent = self.start_bar_mouse_event
        self.end_bar = QtGui.QLineEdit("End coordinate")
        self.end_bar.keyPressEvent = self.end_bar_key_event
        self.end_bar.mousePressEvent = self.end_bar_mouse_event
        self.layout_top_right.addWidget(self.chromosome_combobox)
        self.layout_top_right.addWidget(self.start_bar)
        self.layout_top_right.addWidget(self.end_bar)

        self.layout_top.addWidget(self.search_bar)
        self.layout_top.addWidget(self.af_bar)
        self.layout_top.addLayout(self.layout_top_right)

        self.tab_widget = QtGui.QTabWidget(self)
        self.tab_widget.currentChanged.connect(self.change_tab)
        self.statut_bar = QtGui.QStatusBar(self)
        self.layout.addLayout(self.layout_top)
        self.layout.addWidget(self.tab_widget)
        self.layout.addWidget(self.statut_bar)
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def showEvent(self, event):
        QtGui.QComboBox.showEvent(self, event)
        completer_model = self.lineEdit().completer().model()
        new_model = QtGui.QStandardItemModel(self)
        for r in range(self.p_model.rowCount()):
            new_model.appendRow([completer_model.item(r, 0).clone(), completer_model.item(r, 1).clone()])
            new_model.appendRow([self.name_model.item(r, 0).clone(), self.name_model.item(r, 1).clone()])
        self.lineEdit().completer().setModel(new_model)
        self.lineEdit().completer().setCompletionMode(QtGui.QCompleter.PopupCompletion)
        self.lineEdit().completer().activated['QModelIndex'].connect(self.completer_activated)
        self.lineEdit().completer().highlighted['QModelIndex'].connect(self.completer_activated)
        self.setModelColumn(self.modelColumn())
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def setModelColumn(self, col):
        QtGui.QComboBox.setModelColumn(self, col if col <= 1 else 1)
        if not self.isVisible(): return
        if col == 0:
            self.ref_size = self.ctrl_width if self.ctrl_width >= self.width() else self.width()
        else:
            self.ref_size = self.note_width if self.note_width >= self.width() else self.width()
        self.view().setMinimumWidth(self.ref_size)
        self.view().setMaximumWidth(self.ref_size)
        self.lineEdit().completer().popup().setMinimumWidth(self.ref_size)
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def createEditor(self, parent, option, index):
            self.table = parent.parent()
            self.index = index
            combo = QtGui.QComboBox(parent)
            model = QtGui.QStandardItemModel()
            [model.appendRow(item.clone()) for item in event_model]
            combo.setModel(model)
            combo.setCurrentIndex(index.data(EventIdRole).toPyObject())
            combo.activated.connect(lambda i: parent.setFocus())
            return combo
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name]
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name]
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setupUI(self):
        #==============================

        # main_layout for QMainWindow
        main_widget = QtGui.QWidget()
        self.setCentralWidget(main_widget)        
        main_layout = self.quickLayout('vbox') # grid for auto fill window size
        main_widget.setLayout(main_layout)
        '''
        # main_layout for QDialog
        main_layout = self.quickLayout('vbox')
        self.setLayout(main_layout)
        '''

        #------------------------------
        # ui element creation part
        info_split = self.quickSplitUI( "info_split", self.quickUI(["dict_table;QTableWidget","source_txtEdit;LNTextEdit","result_txtEdit;LNTextEdit"]), "v" )
        fileBtn_layout = self.quickUI(["filePath_input;QLineEdit", "fileLoad_btn;QPushButton;Load", "fileLang_choice;QComboBox", "fileExport_btn;QPushButton;Export"],"fileBtn_QHBoxLayout")
        self.quickUI( [info_split, "process_btn;QPushButton;Process and Update Memory From UI", fileBtn_layout], main_layout)
        self.uiList["source_txtEdit"].setWrap(0)
        self.uiList["result_txtEdit"].setWrap(0)

        '''
        self.uiList['secret_btn'] = QtGui.QPushButton(self) # invisible but functional button
        self.uiList['secret_btn'].setText("")
        self.uiList['secret_btn'].setGeometry(0, 0, 50, 20)
        self.uiList['secret_btn'].setStyleSheet("QPushButton{background-color: rgba(0, 0, 0,0);} QPushButton:pressed{background-color: rgba(0, 0, 0,0); border: 0px;} QPushButton:hover{background-color: rgba(0, 0, 0,0); border: 0px;}")
        #:hover:pressed:focus:hover:disabled
        '''
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name]