本文整理汇总了Python中PySide.QtGui.QListWidget.currentItem方法的典型用法代码示例。如果您正苦于以下问题:Python QListWidget.currentItem方法的具体用法?Python QListWidget.currentItem怎么用?Python QListWidget.currentItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QListWidget
的用法示例。
在下文中一共展示了QListWidget.currentItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GUIdot_cleanMac
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import currentItem [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: Console
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import currentItem [as 别名]
class Console():
def __init__(self, targetLayoutContainer):
self.textarea = QTextEdit()
self.commits = QListWidget()
self.commits.addAction(QAction('Rollback to this revision', self.commits, triggered=self.rollback))
self.commits.setContextMenuPolicy(Qt.ActionsContextMenu)
self.widget = QTabWidget()
self.widget.addTab(self.textarea, 'Log')
self.widget.addTab(self.commits, 'Commits')
targetLayoutContainer.addWidget(self.widget)
def color(self, module, function, color, *args):
print module, function, args
prettyString = '<font color="' + color + '"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
self.textarea.append(''.join(prettyString))
def info(self, module, function, *args):
print module, function, args
prettyString = '<font color="black"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
self.textarea.append(''.join(prettyString))
def error(self, module, function, *args):
print module, function, args
prettyString = '<font color="red"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
self.textarea.append(''.join(prettyString))
def warn(self, module, function, *args):
print module, function, args
prettyString = '<font color="#BE9900"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
self.textarea.append(''.join(prettyString))
def set_commits(self, commits):
self.commits.clear()
for commit in commits:
self.commits.addItem(commit)
def clear(self):
self.textarea.clear()
def rollback(self):
targetCommit = self.commits.currentItem().text().split(' ')[0]
if QMessageBox.warning(None, 'Rollback to commit?', 'All commits after ' + targetCommit + ' will be lost, proceed?', QMessageBox.Yes, QMessageBox.No) == QMessageBox.Yes:
rollback(targetCommit)