本文整理汇总了Python中PySide.QtGui.QListWidget.addItems方法的典型用法代码示例。如果您正苦于以下问题:Python QListWidget.addItems方法的具体用法?Python QListWidget.addItems怎么用?Python QListWidget.addItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QListWidget
的用法示例。
在下文中一共展示了QListWidget.addItems方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GUIdot_cleanMac
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import addItems [as 别名]
class GUIdot_cleanMac(QDialog):
def __init__(self, parent = None):
super(GUIdot_cleanMac, self).__init__(parent)
siguiente_btn = QPushButton('Siguiente')
layout = QVBoxLayout()
layout.addWidget(QLabel('Seleccione memoria:'))
hlayout = QHBoxLayout()
hlayout.addStretch()
hlayout.addWidget(siguiente_btn)
self.lista = QListWidget()
nodos = self.getNodos()
self.lista.addItems(nodos)
layout.addWidget(self.lista)
layout.addLayout(hlayout)
layout.addWidget(QLabel('Hecho por: www.ehmsoft.com'))
self.setLayout(layout)
self.connect(siguiente_btn, SIGNAL('clicked()'), self.siguienteClicked)
self.setWindowTitle('Dot Clean')
if len(nodos) > 0:
self.lista.setCurrentRow(0)
def getNodos(self): #Lista todos los volumenes y quita el Disco Duro del sistema
path = '/Volumes'
folders = os.listdir(path)
try:
folders.remove('Macintosh HD')
except ValueError:
carpetas = copy.copy(folders)
for folder in carpetas:
if os.path.isdir(os.path.join('/Volumes', folder)):
if os.path.exists(os.path.join('/Volumes', folder, 'Applications')):
folders.remove(folder)
finally:
return folders
def dot_clean(self, path):
return os.system('dot_clean %s' % path)
def siguienteClicked(self):
if self.lista.currentItem():
selected = self.lista.currentItem().text()
path = os.path.join('/Volumes', selected)
if self.dot_clean(path) == 0:
title = 'Proceso exitoso'
msg = u'Se limpió la memoria con éxito'
else:
title = 'Proceso fallido'
msg = u'Ocurrió un error inesperado. Verifique que la memoria esté montada.'
else:
title = 'Proceso fallido'
msg = u'No se encuentra ninguna memoria, por favor introduzca una y vuelva a iniciar la apliación'
QMessageBox.information(self, title, msg)
self.close()
示例2: AnimMungeDialog
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import addItems [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: MainWindow
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import addItems [as 别名]
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.resize(800,600)
self.setWindowTitle('PDF Merger')
about = QAction('About', self)
self.connect(about, SIGNAL('triggered()'), self.show_about)
exit = QAction('Exit', self)
exit.setShortcut('Ctrl+Q')
self.connect(exit, SIGNAL('triggered()'), SLOT('close()'))
self.statusBar()
menubar = self.menuBar()
file = menubar.addMenu('File')
file.addAction(about)
file.addAction(exit)
self.main_widget = QWidget(self)
self.setCentralWidget(self.main_widget)
self.up_down_widget = QWidget(self)
self.options_widget = QWidget(self)
input_files_label = QLabel("Input PDFs\nThis is the order in which the files will be merged too")
self.files_list = QListWidget()
self.files_list.setSelectionMode(QAbstractItemView.ExtendedSelection)
add_button = QPushButton("Add PDF(s) to merge...")
add_button.clicked.connect(self.clicked_add)
up_button = QPushButton("Up")
up_button.clicked.connect(self.move_file_up)
down_button = QPushButton("Down")
down_button.clicked.connect(self.move_file_down)
remove_button = QPushButton("Remove PDF")
remove_button.clicked.connect(self.remove_file)
select_path_label = QLabel("Output PDF")
self.dest_path_edit = QLineEdit()
self.dest_path_edit.setReadOnly(True)
select_path = QPushButton("Select...")
select_path.clicked.connect(self.select_save_path)
start = QPushButton("Start")
start.clicked.connect(self.merge_pdf)
up_down_vbox = QVBoxLayout(self.up_down_widget)
up_down_vbox.addWidget(up_button)
up_down_vbox.addWidget(down_button)
up_down_vbox.addWidget(remove_button)
self.up_down_widget.setLayout(up_down_vbox)
group_input = QGroupBox()
grid_input = QGridLayout()
grid_input.addWidget(add_button, 0, 0)
grid_input.addWidget(input_files_label, 1, 0)
grid_input.addWidget(self.files_list, 2, 0)
grid_input.addWidget(self.up_down_widget, 2, 1)
group_input.setLayout(grid_input)
group_output = QGroupBox()
grid_output = QGridLayout()
grid_output.addWidget(select_path_label, 0, 0)
grid_output.addWidget(self.dest_path_edit, 1, 0)
grid_output.addWidget(select_path, 1, 1)
group_output.setLayout(grid_output)
vbox_options = QVBoxLayout(self.options_widget)
vbox_options.addWidget(group_input)
vbox_options.addWidget(group_output)
vbox_options.addWidget(start)
self.options_widget.setLayout(vbox_options)
splitter_filelist = QSplitter()
splitter_filelist.setOrientation(Qt.Vertical)
splitter_filelist.addWidget(self.options_widget)
vbox_main = QVBoxLayout(self.main_widget)
vbox_main.addWidget(splitter_filelist)
vbox_main.setContentsMargins(0,0,0,0)
def show_about(self):
#TODO add hyperlinks and create simple base website
#TODO versioning system
QMessageBox.about(self, 'About', 'PDF Merger\n2013 Nikola Peric\n\n'
+ 'http://www.example.com/\nhttps://github.com/nikolap/pdfmerger/\n\n'
+ 'Licensed under The MIT License\nhttp://opensource.org/licenses/MIT' )
def clicked_add(self):
fname, _ = QFileDialog.getOpenFileNames(self, 'Select two or more PDFs to merge',
QDir.homePath(), "*.pdf")
self.files_list.addItems(fname)
def move_file_up(self):
sorted_selected_items = self.get_sorted_selected_items()
if 0 not in sorted_selected_items:
for row in sorted_selected_items:
item = self.files_list.takeItem(row)
self.files_list.insertItem(row - 1, item)
def move_file_down(self):
sorted_selected_items = self.get_sorted_selected_items(descending=True)
if (self.files_list.count() - 1) not in sorted_selected_items:
for row in sorted_selected_items:
#.........这里部分代码省略.........
示例4: mainwin
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import addItems [as 别名]
#.........这里部分代码省略.........
self.comboBox.selectAll()
def setevent(self):
self.comboBox.selectAll()
self.bkm_addfav.setEnabled(True)
lis = []
eng = self.comboBox.text()
cur.execute("SELECT rowid, TAMW FROM ENGTAM WHERE ENGW like ? limit 1", (eng,))
cuf = cur.fetchall()
if len(cuf) == 0:
self.tamtext.setText("No words found. . . ")
self.listview.addItem("No Suggestions. . .")
else:
for i in range(len(cuf)):
tam = cuf[0][1]
rowid = cuf[0][0]
self.tamtext.setText(tam)
if rowid <= 25:
start = 0
end = 50
elif rowid >= 190513:
start = rowid - 190487
end = rowid + 190537
else:
start = rowid - 25
end = rowid + 25
cur.execute("SELECT ENGW FROM ENGTAM WHERE rowid>=? and rowid<=?", (start, end, ))
cuff = cur.fetchall()
for i in range(len(cuff)):
engw = cuff[i][0]
lis.append(engw)
if self.listview.count() is not None:
self.listview.clear()
self.listview.addItems(lis)
self.addtoli(eng, self.histlis)
if self.histlis[0] >= 2:
self.go_prev.setEnabled(True)
self.comboBox.setFocus()
if self.histdock:
self.histli.addItem(eng)
def addtoli(self, addw, lis, c=1):
if len(lis) > 0:
if type(lis[0]) == int:
if len(lis) >= 2:
for i in range(1, len(lis)):
if lis[i] == addw:
c = 0
pass
if c == 1:
lis.append(addw)
else:
lis.append(addw)
lis[0] = len(lis) - 1
def addtobkmli(self, addw, lis, nc=1):
for i in range(len(lis)):
if lis[i] == addw:
nc = 0
pass
if nc == 1:
lis.append(addw)
def onenter(self, *args):
self.comboBox.selectAll()
self.setevent()
示例5: ModelDialog
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import addItems [as 别名]
class ModelDialog(QDialog):
types = ['null',
'geodynamic',
'cloth',
'bone',
'geobone',
'geostatic',
'geoshadow']
types2 = {'null': 0,
'geodynamic': 1,
'cloth': 2,
'bone': 3,
'geobone': 4,
'geostatic': 5,
'geoshadow': 6}
def __init__(self, mdl, parent=None):
super(ModelDialog, self).__init__(parent)
self.mdl = mdl
self.controls = {}
self.parent = parent
self.initUI()
def initUI(self):
grp = QGroupBox('Model')
grplay = QGridLayout()
name = QLineEdit()
name.setText(self.mdl.name)
name.textChanged.connect(self.name_changed)
self.controls['name'] = name
grplay.addWidget(QLabel('Name'), 0, 0)
grplay.addWidget(name, 0, 1)
parent = QLineEdit()
parent.setText(self.mdl.parent_name)
self.controls['parent'] = parent
grplay.addWidget(QLabel('Parent'), 0, 2)
grplay.addWidget(parent, 0, 3)
type_ = QComboBox()
type_.addItems(self.types)
type_.setCurrentIndex(self.types2[self.mdl.model_type])
self.controls['type'] = type_
grplay.addWidget(QLabel('Type'), 1, 0)
grplay.addWidget(type_, 1, 1)
vis = QCheckBox()
if self.mdl.vis:
vis.toggle()
self.controls['vis'] = vis
grplay.addWidget(QLabel('Hidden'), 1, 2)
grplay.addWidget(vis, 1, 3)
buttonlay = QHBoxLayout()
collprim = QPushButton('Collision Primitive')
buttonlay.addWidget(collprim)
collprim.clicked.connect(self.edit_collprim)
deformers = QPushButton('Deformers')
deformers.clicked.connect(self.edit_deformers)
buttonlay.addWidget(deformers)
bbox_btn = QPushButton('Bounding Box')
bbox_btn.clicked.connect(self.edit_bbox)
trans = QPushButton('Transform')
trans.clicked.connect(self.edit_tran)
buttonlay.addWidget(bbox_btn)
buttonlay.addWidget(trans)
buttonlay2 = QHBoxLayout()
validate = QPushButton('Validate')
validate.clicked.connect(self.validate)
uvs = QPushButton('UVs')
uvs.clicked.connect(self.show_uvs)
buttonlay2.addWidget(validate)
buttonlay2.addWidget(uvs)
buttonlay2.addStretch()
grplay.addLayout(buttonlay, 2, 0, 1, 4)
grplay.addLayout(buttonlay2, 3, 0, 1, 4)
grp.setLayout(grplay)
geogrp = QGroupBox('Geometry')
geolay = QHBoxLayout()
self.geometries = QListWidget()
self.geometries.addItems(['{0} - {1}'.format(ind, geo.classname) for ind, geo in enumerate(self.mdl.segments)])
geolay.addStretch()
#.........这里部分代码省略.........