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


Python QtGui.QComboBox方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QComboBox方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QComboBox方法的具体用法?Python QtGui.QComboBox怎么用?Python QtGui.QComboBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui的用法示例。


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

示例1: initUI

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
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) 
开发者ID:goldsborough,项目名称:Writer,代码行数:24,代码来源:datetime.py

示例2: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
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)) 
开发者ID:tjguk,项目名称:networkzero,代码行数:19,代码来源:quiz-controller.py

示例3: initUI

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
def initUI(self):
        # Create layout
      layout = QtGui.QFormLayout()
      label1 = QtGui.QLabel("Clusters")
      combo1 = QtGui.QComboBox(self)
      combo1.addItems(CLUSTER_SETTING_OPTIONS)
      combo1.currentIndexChanged.connect(self.selectionInClusterComboBox)
      combo1.setCurrentIndex(SELECTED_CLUSTER_SETTING_INDEX)
      layout.addRow(label1, combo1)

      label2 = QtGui.QLabel("Compactness")
      combo2 = QtGui.QComboBox(self)
      combo2.addItems(COMPACTNESS_SETTING_OPTIONS)
      combo2.currentIndexChanged.connect(self.selectionInCompactnessComboBox)
      combo2.setCurrentIndex(SELECTED_COMPACTNESS_SETTING_INDEX)
      layout.addRow(label2, combo2)

      self.setLayout(layout) 
开发者ID:oduwa,项目名称:Pic-Numero,代码行数:20,代码来源:gui.py

示例4: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
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) 
开发者ID:juliarizza,项目名称:certificate_generator,代码行数:39,代码来源:certificates.py

示例5: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
def __init__(self, trace=None, parent=None):
        QtGui.QWidget.__init__(self, parent=parent)
        self.setWindowTitle('Registers')

        vbox = QtGui.QVBoxLayout(self)
        vbox.setMargin(2)
        vbox.setSpacing(4)

        self.viewnames = QtGui.QComboBox(self)
        self.viewnames.addItem('all')
        self.regviews = {}

        arch = trace.getMeta('Architecture')

        # FIXME make this in envi or something once and for all...

        if arch == 'i386':
            self.regviews['general'] = ['eax','ebx','ecx','edx','esi','edi','ebp','esp','eip']

        elif arch == 'amd64':
            self.regviews['general'] = ['rax','rbx','rcx','rdx','rsi','rdi','rbp','rsp','rip',
                                        'r8','r9','r10','r11','r12','r13','r14','r15']

        for name in self.regviews.keys():
            self.viewnames.addItem(name)

        sig = QtCore.SIGNAL('currentIndexChanged(QString)')
        self.viewnames.connect(self.viewnames, sig, self.regViewNameSelected)

        self.reglist = VQRegistersListView(trace=trace, parent=self)
        self.regdelegate = RegColorDelegate(self.reglist)
        self.reglist.setItemDelegate(self.regdelegate)

        vbox.addWidget(self.viewnames)
        vbox.addWidget(self.reglist)

        self.setLayout(vbox) 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:39,代码来源:qt.py

示例6: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
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 = widgets.QHBoxLayout()

        self.framecombo = widgets.QComboBox()

        self.startbutton = widgets.QPushButton(">>")
        self.addressinfo = widgets.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 = widgets.QVBoxLayout()
        self.setLayout(vlayout)

        vlayout.addLayout(hlayout)

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

        self.framecombo.activated.connect(self.change_frame) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:38,代码来源:sniffer.py

示例7: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
def __init__(self, parent, defaultItem=None):
        QtGui.QComboBox.__init__(self, parent)

        self.defaultItem = defaultItem
        if self.defaultItem:
            self.addItem(self.defaultItem) 
开发者ID:KanoComputing,项目名称:kano-burners,代码行数:8,代码来源:widgets.py

示例8: addComboBox

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
def addComboBox(self, onClick, defaultItem=None):
        comboBox = ComboBox(self, defaultItem)
        comboBox.clicked.connect(onClick)
        comboBox.resized.connect(self.centerWidgets)

        # the resizing policy will allow the combobox to resize depending on its contents
        comboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
        load_css_for_widget(comboBox, os.path.join(css_path, 'combobox.css'), images_path)
        self.widgets.append(comboBox)
        return comboBox 
开发者ID:KanoComputing,项目名称:kano-burners,代码行数:12,代码来源:widgets.py

示例9: createIconGroupBox

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
def createIconGroupBox(self): # Add the SysTray preferences window grouping
        self.iconGroupBox = QtGui.QGroupBox("Tray Icon")

        self.iconLabel = QtGui.QLabel("Icon:")

        self.iconComboBox = QtGui.QComboBox()
        self.iconComboBox.addItem(QtGui.QIcon('images/Airplay-Light'), "Black Icon")
        self.iconComboBox.addItem(QtGui.QIcon('images/Airplay-Dark'), "White Icon")

        self.showIconCheckBox = QtGui.QCheckBox("Show tray icon")
        self.showIconCheckBox.setChecked(self.settings.value('systrayicon', type=bool))
        print("Got systrayicon from settings:" + str(self.settings.value('systrayicon', type=bool)))

        self.systrayClosePromptCheckBox = QtGui.QCheckBox("Systray Close warning")
        self.systrayClosePromptCheckBox.setChecked(self.settings.value('promptOnClose_systray', type=bool))
        print("Got promptOnClose_systray from settings:" + str(self.settings.value('promptOnClose_systray', type=bool)))

        iconLayout = QtGui.QHBoxLayout()
        iconLayout.addWidget(self.iconLabel)
        iconLayout.addWidget(self.iconComboBox)
        iconLayout.addStretch()
        iconLayout.addWidget(self.showIconCheckBox)
        iconLayout.addWidget(self.systrayClosePromptCheckBox)
        self.iconGroupBox.setLayout(iconLayout)

    # Creates the device selection list. 
开发者ID:openairplay,项目名称:openairplay,代码行数:28,代码来源:main.py

示例10: get_order

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
def get_order(self):
        
        orders = self.uqer_instance.get_order(self.active_strategy_id, False)

        self.tableWidget.setRowCount(len(orders))

        table = self.tableWidget

        for index, order in enumerate(orders):
            table.setItem(index, 0, QTableWidgetItem(order.get('ticker')))
            table.setItem(index, 1, QTableWidgetItem(order.get('name')))

            self.signalMapper = QtCore.QSignalMapper(self)
            self.signalMapper.mapped[QtGui.QWidget].connect(self.buy_sell_changed)
            
            temp_combobox = QtGui.QComboBox()
            temp_combobox.addItem(u'卖')
            temp_combobox.addItem(u'买')
            
            temp_combobox.currentIndexChanged.connect(self.signalMapper.map)
            temp_combobox.row = index

            table.setItem(index, 2, QTableWidgetItem(order.get('side') == u'BUY' and u'买' or u'卖'))
            if order.get('side') == u'BUY':
                temp_combobox.setCurrentIndex(1)
            else:
                temp_combobox.setCurrentIndex(0)

            table.setCellWidget(index, 2, temp_combobox)
            self.signalMapper.setMapping(temp_combobox, temp_combobox)

            table.setItem(index, 3, QTableWidgetItem(str(order.get('amount'))))
            
            place_time = dt.datetime.fromtimestamp(int(order.get('place_time'))/1000)
            table.setItem(index, 4, QTableWidgetItem(place_time.strftime('%H:%M:%S'))) 
开发者ID:musequant,项目名称:uqtrader,代码行数:37,代码来源:trader.py

示例11: setupVector

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
def setupVector(self,Form):
        """Set up slots for value_vector.
        
        It is possible to plot the data over the x_axis and display the numeric
        values in a table.
        Args:
            self: Object of the Ui_Form class.
            Form: PlotWindow object that inherits the used calls here from the
                underlying QWidget class.
        Returns:
            No return variable. The function operates on the given object.
        """
        self.PlotTypeSelector = QtGui.QComboBox(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.PlotTypeSelector.sizePolicy().hasHeightForWidth())
        self.PlotTypeSelector.setSizePolicy(sizePolicy)
        self.PlotTypeSelector.setObjectName(_fromUtf8("PlotTypeSelector"))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        self.horizontalLayout.addWidget(self.PlotTypeSelector)
        self.PlotTypeSelector.setItemText(0, _translate("Form", "Line Plot", None))
        self.PlotTypeSelector.setItemText(1, _translate("Form", "Table", None))
        
        spacerItem = QtGui.QSpacerItem(40, 1, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self._addIndicatorLabels(Form,sizePolicy,indicators=["PointX","PointY"]) 
开发者ID:qkitgroup,项目名称:qkit,代码行数:30,代码来源:plot_view.py

示例12: setLang

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
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] 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:41,代码来源:universal_tool_template_1116.py

示例13: qui

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
def qui(self, ui_list_string, parentObject_string='', opt=''):
        # pre-defined user short name syntax
        type_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txtEdit': 'LNTextEdit', 'txt': 'QTextEdit',
            'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        # get ui_list, creation or existing ui object
        ui_list = [x.strip() for x in ui_list_string.split('|')]
        for i in range(len(ui_list)):
            if ui_list[i] in self.uiList:
                # - exisiting object
                ui_list[i] = self.uiList[ui_list[i]]
            else:
                # - string creation: 
                # get part info
                partInfo = ui_list[i].split(';',1)
                uiName = partInfo[0].split('@')[0]
                uiType = uiName.rsplit('_',1)[-1]
                if uiType in type_dict:
                    uiType = type_dict[uiType]
                # set quickUI string format
                ui_list[i] = partInfo[0]+';'+uiType
                if len(partInfo)==1:
                    # give empty button and label a place holder name
                    if uiType in ('btn', 'btnMsg', 'QPushButton','label', 'QLabel'):
                        ui_list[i] = partInfo[0]+';'+uiType + ';'+uiName 
                elif len(partInfo)==2:
                    ui_list[i]=ui_list[i]+";"+partInfo[1]
        # get parentObject or exisiting object
        parentObject = parentObject_string
        if parentObject in self.uiList:
            parentObject = self.uiList[parentObject]
        # process quickUI
        self.quickUI(ui_list, parentObject, opt) 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:40,代码来源:UITranslator.py

示例14: qui

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
def qui(self, ui_list_string, parentObject_string='', opt=''):
        # pre-defined user short name syntax
        type_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        # get ui_list, creation or existing ui object
        ui_list = [x.strip() for x in ui_list_string.split('|')]
        for i in range(len(ui_list)):
            if ui_list[i] in self.uiList:
                # - exisiting object
                ui_list[i] = self.uiList[ui_list[i]]
            else:
                # - string creation: 
                # get part info
                partInfo = ui_list[i].split(';',1)
                uiName = partInfo[0].split('@')[0]
                uiType = uiName.rsplit('_',1)[-1]
                if uiType in type_dict:
                    uiType = type_dict[uiType]
                # set quickUI string format
                ui_list[i] = partInfo[0]+';'+uiType
                if len(partInfo)==1:
                    # give empty button and label a place holder name
                    if uiType in ('btn', 'btnMsg', 'QPushButton','label', 'QLabel'):
                        ui_list[i] = partInfo[0]+';'+uiType + ';'+uiName 
                elif len(partInfo)==2:
                    ui_list[i]=ui_list[i]+";"+partInfo[1]
        # get parentObject or exisiting object
        parentObject = parentObject_string
        if parentObject in self.uiList:
            parentObject = self.uiList[parentObject]
        # process quickUI
        self.quickUI(ui_list, parentObject, opt) 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:40,代码来源:universal_tool_template_0903.py

示例15: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QComboBox [as 别名]
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version="0.1"
        self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file."
        
        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        
        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)
            
        self.name = self.__class__.__name__
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)
        
        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        self.qui_user_dict = {}
        #------------------------------ 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:40,代码来源:universal_tool_template_0904.py


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