def __init__(self, sandbox, idx, *args, **kwargs):
QtGui.QMenu.__init__(self, *args, **kwargs)
self.sandbox = sandbox
self.idx = idx
def removeSource():
self.sandbox.sources.removeSource(self.idx)
def editSource():
editing_dialog = self.sandbox.sources.data(
self.idx, SourceEditorDialog)
editing_dialog.show()
editAction = self.addAction(
'Edit', editSource)
self.addMenu(
SourcesAddButton.SourcesAddMenu(self.sandbox, self))
self.addSeparator()
removeAction = self.addAction(
self.style().standardPixmap(
QtGui.QStyle.SP_DialogCloseButton),
'Remove', removeSource)
if self.sandbox.sources.rowCount(QtCore.QModelIndex()) == 0:
editAction.setEnabled(False)
removeAction.setEnabled(False)
评论列表
文章目录