ParameterItem: self.param.opts -> opts
Using `opts` as alias for `self.param.opts`, following the style of `updateFlags`.
This commit is contained in:
parent
d86bb65520
commit
78929adbea
@ -104,20 +104,22 @@ class ParameterItem(QtGui.QTreeWidgetItem):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def contextMenuEvent(self, ev):
|
def contextMenuEvent(self, ev):
|
||||||
if not self.param.opts.get('removable', False) and not self.param.opts.get('renamable', False)\
|
opts = self.param.opts
|
||||||
and "context" not in self.param.opts:
|
|
||||||
|
if not opts.get('removable', False) and not opts.get('renamable', False)\
|
||||||
|
and "context" not in opts:
|
||||||
return
|
return
|
||||||
|
|
||||||
## Generate context menu for renaming/removing parameter
|
## Generate context menu for renaming/removing parameter
|
||||||
self.contextMenu = QtGui.QMenu() # Put in global name space to prevent garbage collection
|
self.contextMenu = QtGui.QMenu() # Put in global name space to prevent garbage collection
|
||||||
self.contextMenu.addSeparator()
|
self.contextMenu.addSeparator()
|
||||||
if self.param.opts.get('renamable', False):
|
if opts.get('renamable', False):
|
||||||
self.contextMenu.addAction('Rename').triggered.connect(self.editName)
|
self.contextMenu.addAction('Rename').triggered.connect(self.editName)
|
||||||
if self.param.opts.get('removable', False):
|
if opts.get('removable', False):
|
||||||
self.contextMenu.addAction("Remove").triggered.connect(self.requestRemove)
|
self.contextMenu.addAction("Remove").triggered.connect(self.requestRemove)
|
||||||
|
|
||||||
# context menu
|
# context menu
|
||||||
context = self.param.opts.get('context', None)
|
context = opts.get('context', None)
|
||||||
if isinstance(context, list):
|
if isinstance(context, list):
|
||||||
for name in context:
|
for name in context:
|
||||||
self.contextMenu.addAction(name).triggered.connect(
|
self.contextMenu.addAction(name).triggered.connect(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user