本文整理汇总了Python中PySide.QtGui.QListWidget.addAction方法的典型用法代码示例。如果您正苦于以下问题:Python QListWidget.addAction方法的具体用法?Python QListWidget.addAction怎么用?Python QListWidget.addAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QListWidget
的用法示例。
在下文中一共展示了QListWidget.addAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Console
# 需要导入模块: from PySide.QtGui import QListWidget [as 别名]
# 或者: from PySide.QtGui.QListWidget import addAction [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)