本文整理汇总了Python中PySide.QtGui.QListWidget.setMinimumWidth方法的典型用法代码示例。如果您正苦于以下问题:Python QListWidget.setMinimumWidth方法的具体用法?Python QListWidget.setMinimumWidth怎么用?Python QListWidget.setMinimumWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QListWidget
的用法示例。
在下文中一共展示了QListWidget.setMinimumWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ServiceBrowser
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import setMinimumWidth [as 别名]
#.........这里部分代码省略.........
implementationRef = self.serviceManager.loadInterface(selectedImpl)
else:
implementationRef = self.serviceManager.loadInterface(selectedImpl.interfaceName())
self.attributesListWidget.clear()
if not implementationRef:
self.attributesListWidget.addItem(self.tr("(Error loading service plugin)"))
return
metaObject = implementationRef.metaObject()
self.attributesGroup.setTitle(self.tr("Invokable attributes for %s class" % metaObject.className()))
for i in range(metaObject.methodCount()):
method = metaObject.method(i)
self.attributesListWidget.addItem("[METHOD] " + method.signature())
for i in range(metaObject.propertyCount()):
p = metaObject.property(i)
self.attributesListWidget.addItem("[PROPERTY] " + p.name())
def setDefaultInterfaceImplementation(self):
item = self.interfacesListWidget.currentItem()
if not item:
return
descriptor = item.data(Qt.UserRole)
if descriptor.isValid():
if self.serviceManager.setInterfaceDefault(descriptor):
currentIndex = self.interfacesListWidget.row(item)
self.reloadInterfaceImplementationsList()
self.interfacesListWidget.setCurrentRow(currentIndex)
else:
print "Unable to set default service for interface:", descriptor.interfaceName()
def registerExampleServices(self):
exampleXmlFiles = ["filemanagerservice.xml", "bluetoothtransferservice.xml"]
for fileName in exampleXmlFiles:
path = "./xmldata/" + fileName
self.serviceManager.addService(path)
def unregisterExampleServices(self):
self.serviceManager.removeService("FileManagerService")
self.serviceManager.removeService("BluetoothTransferService")
def reloadAttributesRadioButtonText(self):
item = self.interfacesListWidget.currentItem()
if not item:
return
selectedImpl = item.data(Qt.UserRole)
defaultImpl = self.serviceManager.interfaceDefault(selectedImpl.interfaceName())
self.defaultImplRadioButton.setText(self.tr("Default implementation for %s\n(currently provided by %s)" % (str(defaultImpl.interfaceName()), str(defaultImpl.serviceName()))))
def initWidgets(self):
self.showAllServicesItem = QListWidgetItem(self.tr("(All registered services)"))
self.servicesListWidget = QListWidget()
self.interfacesListWidget = QListWidget()
self.interfacesListWidget.addItem(self.tr("(Select a service)"))
self.attributesListWidget = QListWidget()
self.attributesListWidget.addItem(self.tr("(Select an interface implementation)"))
self.interfacesListWidget.setMinimumWidth(450)
self.servicesListWidget.currentItemChanged.connect(self.reloadInterfaceImplementationsList)
self.interfacesListWidget.currentItemChanged.connect(self.currentInterfaceImplChanged)
self.defaultInterfaceButton = QPushButton(self.tr("Set as default implementation"))
self.defaultInterfaceButton.setEnabled(False)
self.defaultInterfaceButton.clicked.connect(self.setDefaultInterfaceImplementation)
self.selectedImplRadioButton = QRadioButton(self.tr("Selected interface implementation"))
self.defaultImplRadioButton = QRadioButton(self.tr("Default implementation"))
self.selectedImplRadioButton.setChecked(True)
self.radioButtons = QButtonGroup(self)
self.radioButtons.addButton(self.selectedImplRadioButton)
self.radioButtons.addButton(self.defaultImplRadioButton)
self.radioButtons.buttonClicked.connect(self.reloadAttributesList)
self.servicesGroup = QGroupBox(self.tr("Show services for:"))
servicesLayout = QVBoxLayout()
servicesLayout.addWidget(self.servicesListWidget)
self.servicesGroup.setLayout(servicesLayout)
self.interfacesGroup = QGroupBox(self.tr("Interface implementations"))
interfacesLayout = QVBoxLayout()
interfacesLayout.addWidget(self.interfacesListWidget)
interfacesLayout.addWidget(self.defaultInterfaceButton)
self.interfacesGroup.setLayout(interfacesLayout)
self.attributesGroup = QGroupBox(self.tr("Invokable attributes"))
attributesLayout = QVBoxLayout()
self.attributesGroup.setLayout(attributesLayout)
attributesLayout.addWidget(self.attributesListWidget)
attributesLayout.addWidget(QLabel(self.tr("Show attributes for:")))
attributesLayout.addWidget(self.selectedImplRadioButton)
attributesLayout.addWidget(self.defaultImplRadioButton)
self.attributesGroup.setLayout(attributesLayout)
layout = QGridLayout()
layout.addWidget(self.servicesGroup, 0, 0)
layout.addWidget(self.attributesGroup, 0, 1, 2, 1)
layout.addWidget(self.interfacesGroup, 1, 0)
self.setLayout(layout)
示例2: AnimMungeDialog
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import setMinimumWidth [as 别名]
class AnimMungeDialog(QDialog):
types = ['FirstPerson/Soldier',
'Prop/Vehicle']
types2 = {'FirstPerson/Soldier': '/comp_debug 0 /debug',
'Prop/Vehicle': '/specialquathack'}
def __init__(self, files, main, parent=None):
super(AnimMungeDialog, self).__init__(parent)
self.outd = os.getcwd() + '\\munge\\output'
self.ind = os.getcwd() + '\\munge\\input'
self.files = files
self.clear_input_files()
self.clear_output_files()
for filename in self.files:
shutil.copy(filename, self.ind)
self.initUI()
def munge(self):
self.statlabel.setText('<b>AnimMunging</b>')
params = self.types2[self.type_box.currentText()]
add_params = ''
if self.add_params.text() != 'Additional Params':
add_params = ' {0}'.format(self.add_params.text())
if self.bf1mode.isChecked():
os.system(os.getcwd() + '\\zenasset1.exe /multimsh /src {0}{1} /keepframe0 {2} /dest {3}\\{4}.zaf'.format(self.ind, add_params, params, self.outd, self.animname.text()))
os.system(os.getcwd() + '\\binmunge1.exe -inputfile munge\\output\\*.zaa -chunkid zaa_ -ext zaabin -outputdir {1}\\'.format(self.outd, self.outd))
os.system(os.getcwd() + '\\binmunge1.exe -inputfile munge\\output\\*.zaf -chunkid zaf_ -ext zafbin -outputdir {1}\\'.format(self.outd, self.outd))
else:
os.system(os.getcwd() + '\\zenasset.exe /multimsh /writefiles /src {0}{1} /keepframe0 {2} /dest {3}\\{4}.zaf'.format(self.ind, add_params, params, self.outd, self.animname.text()))
os.system(os.getcwd() + '\\binmunge.exe -inputfile munge\\output\\*.zaa -chunkid zaa_ -ext zaabin -outputdir {1}'.format(self.outd, self.outd))
os.system(os.getcwd() + '\\binmunge.exe -inputfile munge\\output\\*.zaf -chunkid zaf_ -ext zafbin -outputdir {1}'.format(self.outd, self.outd))
self.clear_byproduct()
files = []
for filename in os.listdir(self.outd):
files.append(filename)
self.outfiles.addItems(files)
self.statlabel.setText('<b>AnimMunged</b>')
def initUI(self):
grp = QGroupBox('Anim Munge')
grplay = QGridLayout()
self.bf1mode = QCheckBox()
grplay.addWidget(QLabel('<b>SWBF1</b>'), 0, 1)
grplay.addWidget(self.bf1mode, 0, 2)
grplay.addWidget(QLabel('<b>Input</b>'), 1, 1)
grplay.addWidget(QLabel('<b>Output</b>'), 1, 3)
self.infiles = QListWidget()
self.infiles.setMinimumWidth(150)
self.infiles.addItems([os.path.basename(item) for item in self.files])
grplay.addWidget(self.infiles, 2, 1, 1, 2)
self.outfiles = QListWidget()
self.outfiles.setMinimumWidth(150)
grplay.addWidget(self.outfiles, 2, 3, 1, 2)
self.add_params = QLineEdit()
self.add_params.setText('Additional Params')
self.add_params.setToolTip('<b>Additional Munge Parameters.</b> Like scale 1.5')
grplay.addWidget(self.add_params, 0, 3, 1, 2)
self.statlabel = QLabel('<b>AnimMunger</b>')
grplay.addWidget(self.statlabel, 4, 1, 1, 1)
self.animname = QLineEdit()
self.animname.setText('AnimName')
self.animname.setToolTip('<b>Animation Name.</b> Name of the final animation files. IE: name.zafbin, name.zaabin, name.anims.')
grplay.addWidget(self.animname, 3, 1)
self.type_box = QComboBox()
self.type_box.addItems(self.types)
self.type_box.setToolTip('<b>Munge Mode.</b> This switches munge parameters.')
grplay.addWidget(QLabel('<b>Munge Mode:</b>'), 3, 2)
grplay.addWidget(self.type_box, 3, 3, 1, 2)
munge_btn = QPushButton('Munge')
munge_btn.clicked.connect(self.munge)
munge_btn.setToolTip('<b>Munge.</b> Munges the input files with the selected mode.')
grplay.addWidget(munge_btn, 4, 2)
save_out = QPushButton('Save')
save_out.clicked.connect(self.save)
save_out.setToolTip('<b>Save.</b> Saves the output files.')
grplay.addWidget(save_out, 4, 3)
cancel_btn = QPushButton('Cancel')
cancel_btn.clicked.connect(self.cancel)
cancel_btn.setToolTip('<b>Cancel.</b> Closes the dialog and removes all temporary files.')
grplay.addWidget(cancel_btn, 4, 4)
grp.setLayout(grplay)
mainlay = QVBoxLayout()
mainlay.addWidget(grp)
self.setLayout(mainlay)
self.setGeometry(340, 340, 320, 300)
self.setWindowTitle('MSH Suite - Animation Munge')
self.show()
def save(self):
filepath = QFileDialog.getExistingDirectory(self, 'Select .MSH', os.getcwd())
for filename in os.listdir(self.outd):
shutil.copy(os.path.join(self.outd, filename), filepath)
self.cancel()
def cancel(self):
self.statlabel.setText('<b>AnimSeeYa</b>')
#.........这里部分代码省略.........
示例3: ProfileSelection
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import setMinimumWidth [as 别名]
class ProfileSelection(QDialog):
'''
classdocs
'''
removeProfile = Signal(Athlete_Model)
profileSelected = Signal(Athlete_Model)
profileUpdate_request = Signal(Athlete_Model, Athlete_Model)
lastProfileDeleted = Signal()
def __init__(self, athletesList):
'''
Constructor
'''
QDialog.__init__(self)
self.setWindowTitle("Profile Selection")
self.athletesList = athletesList
self._initGUI()
def _initGUI(self):
topHLayout = QHBoxLayout()
hLayout = QHBoxLayout()
vLayout = QVBoxLayout()
# Label
greeterText = QLabel("Welcome to <b>Pushup app</b>." + \
"<br><br> Select a profile:")
vLayout.addWidget(greeterText)
# List
self.list = QListWidget()
self.list.setMinimumWidth(150)
self.list.setSelectionMode(QAbstractItemView.SingleSelection)
# SingleSelection is the default value, but I prefer to be sure
self.list.itemSelectionChanged.connect(self._activateButtons)
for athlete in self.athletesList:
iconW = QIcon.fromTheme("user-available")
# doens't work on Mac and Windows
# http://qt-project.org/doc/qt-4.8/qicon.html#fromTheme
listW = QListWidgetItem(iconW, athlete._name)
listW.setData(Qt.UserRole, athlete)
self.list.addItem(listW)
topHLayout.addWidget(self.list)
self.profileWidget = ProfileFormWidget()
self.profileWidget.hide()
topHLayout.addWidget(self.profileWidget)
vLayout.addLayout(topHLayout)
vLayout.addLayout(hLayout)
# Buttons
self.okBtn = QPushButton("Ok")
self.okBtn.setDisabled(True)
self.okBtn.setDefault(True)
self.okBtn.clicked.connect(self._okButtonSlot)
self.list.itemDoubleClicked.connect(self._okButtonSlot)
cancelBtn = QPushButton("Cancel")
cancelBtn.clicked.connect(self._cancelButtonSlot)
self.editBtn = QPushButton("Edit")
self.editBtn.setDisabled(True)
self.editBtn.setCheckable(True)
self.editBtn.clicked.connect(self._toggleProfileEdit)
self.saveBtn = QPushButton("Save changes") # Saves the changes made on the profile
self.saveBtn.hide()
self.saveBtn.clicked.connect(self._saveButtonSlot)
self.removeProfileBtn = QPushButton("Remove Profile")
self.removeProfileBtn.setDisabled(True)
self.removeProfileBtn.clicked.connect(self._removeProfile_Dialog)
hLayout.addWidget(self.editBtn)
hLayout.addWidget(self.removeProfileBtn)
hLayout.addWidget(cancelBtn)
hLayout.addWidget(self.okBtn)
hLayout.addWidget(self.saveBtn)
self.setLayout(vLayout)
def getSelectedProfile(self):
selectedListItem = self.list.selectedItems()[0]
athleteProfile = selectedListItem.data(Qt.UserRole)
return athleteProfile
def updateList(self, athletes):
self.list.clear()
self.athletesList = athletes
for athlete in self.athletesList:
iconW = QIcon.fromTheme("user-available")
#.........这里部分代码省略.........