本文整理汇总了Python中PySide.QtGui.QComboBox方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QComboBox方法的具体用法?Python QtGui.QComboBox怎么用?Python QtGui.QComboBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QComboBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QComboBox [as 别名]
def initUI(self):
self.resize(400,100)
self.setWindowTitle('select a shape to be imported')
self.mainLayout = QtGui.QGridLayout() # a VBoxLayout for the whole form
self.shapeCombo = QtGui.QComboBox(self)
l = sorted(self.labelList)
self.shapeCombo.addItems(l)
self.buttons = QtGui.QDialogButtonBox(self)
self.buttons.setOrientation(QtCore.Qt.Horizontal)
self.buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole)
self.buttons.addButton("Choose", QtGui.QDialogButtonBox.AcceptRole)
self.connect(self.buttons, QtCore.SIGNAL("accepted()"), self, QtCore.SLOT("accept()"))
self.connect(self.buttons, QtCore.SIGNAL("rejected()"), self, QtCore.SLOT("reject()"))
self.mainLayout.addWidget(self.shapeCombo,0,0,1,1)
self.mainLayout.addWidget(self.buttons,1,0,1,1)
self.setLayout(self.mainLayout)
示例2: createIconGroupBox
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QComboBox [as 别名]
def createIconGroupBox(self):
self.iconGroupBox = QtGui.QGroupBox("Tray Icon")
self.iconLabel = QtGui.QLabel("Icon:")
self.iconComboBox = QtGui.QComboBox()
self.iconComboBox.addItem(QtGui.QIcon(':/icons/miner.svg'), "Miner")
self.iconComboBox.addItem(QtGui.QIcon(':/images/heart.svg'), "Heart")
self.iconComboBox.addItem(QtGui.QIcon(':/images/trash.svg'), "Trash")
self.showIconCheckBox = QtGui.QCheckBox("Show icon")
self.showIconCheckBox.setChecked(True)
iconLayout = QtGui.QHBoxLayout()
iconLayout.addWidget(self.iconLabel)
iconLayout.addWidget(self.iconComboBox)
iconLayout.addStretch()
iconLayout.addWidget(self.showIconCheckBox)
self.iconGroupBox.setLayout(iconLayout)
示例3: OnCreate
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QComboBox [as 别名]
def OnCreate(self, form):
self.parent = self.FormToPySideWidget(form)
self.tableWidget = QtGui.QTableWidget()
self.seg_combo = QtGui.QComboBox()
self.refcount_box = QtGui.QLineEdit()
self.export_btn = QtGui.QPushButton("Export")
self.export_btn.setDisabled(True)
self.scan_btn = QtGui.QPushButton("Scan")
self.minfilter_box = QtGui.QLineEdit()
self.maxfilter_box = QtGui.QLineEdit()
self.filter_btn = QtGui.QPushButton("Filter")
self.filter_btn.setDisabled(True)
self.sort_order = [QtCore.Qt.AscendingOrder, QtCore.Qt.AscendingOrder]
self.PopulateForm()
示例4: createEditor
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QComboBox [as 别名]
def createEditor(self, parent, option, index):
if index.column() < 1:
return None
editor = QtGui.QComboBox(parent)
try:
editor.addItems(self.ui.diamList)
except:
FreeCAD.Console.PrintLog(str(sys.exc_info()) + "\n")
return editor;
示例5: get_QComboBox
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QComboBox [as 别名]
def get_QComboBox():
"""QComboBox getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QComboBox
except ImportError:
import PyQt5.QtWidgets as QtWidgets
return QtWidgets.QComboBox
示例6: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QComboBox [as 别名]
def __init__(self, *args, **kwargs):
QtGui.QComboBox.__init__(self)
Custom.__init__(self, *args, **kwargs)
self.currentIndexChanged.connect(self.interactivechange)
示例7: height
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QComboBox [as 别名]
def height(self):
return QtGui.QComboBox.height(self)
示例8: width
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QComboBox [as 别名]
def width(self):
return QtGui.QComboBox.width(self)
示例9: generateWidget
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QComboBox [as 别名]
def generateWidget( self, parameterDict, constraint_to_animate ):
self.parameterDict = parameterDict
self.constraint_to_animate = constraint_to_animate
combobox = QtGui.QComboBox()
for i in self.defaultValue:
combobox.addItem(i)
try:
combobox.setCurrentIndex( self.defaultValue.index(self.getDefaultValue()) )
except IndexError:
pass
self.combobox = combobox
return Qt_label_widget( self.label, combobox )
示例10: setLang
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.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]
示例11: qui
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.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)
示例12: qui
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.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)
示例13: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.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 = {}
#------------------------------
示例14: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QComboBox [as 别名]
def __init__(self):
QtGui.QWidget.__init__(self)
self.protocol_dir = prefs.PROTOCOLDIR
topLabel = QtGui.QLabel("Protocols:")
# List available protocols
protocol_list = os.listdir(self.protocol_dir)
protocol_list = [os.path.splitext(p)[0] for p in protocol_list]
self.protocol_listbox = QtGui.QListWidget()
self.protocol_listbox.insertItems(0, protocol_list)
self.protocol_listbox.currentItemChanged.connect(self.protocol_changed)
# Make Step combobox
self.step_selection = QtGui.QComboBox()
self.step_selection.currentIndexChanged.connect(self.step_changed)
layout = QtGui.QVBoxLayout()
layout.addWidget(topLabel)
layout.addWidget(self.protocol_listbox)
layout.addWidget(self.step_selection)
self.setLayout(layout)
# Dict to return values
self.values = {}
示例15: generateWidget
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QComboBox [as 别名]
def generateWidget( self, dimensioningProcess ):
self.dimensioningProcess = dimensioningProcess
combobox = QtGui.QComboBox()
for i in self.defaultValue:
combobox.addItem(i)
try:
combobox.setCurrentIndex( self.defaultValue.index(self.getDefaultValue()) )
except IndexError:
pass
combobox.currentIndexChanged.connect( self.valueChanged )
self.combobox = combobox
return DimensioningTaskDialog_generate_row_hbox( self.label, combobox )