Re-work menu spawning for Command and Projected views to be a bit more straightforward and allow spawning up context menu when right clicking the DummyEntry (#1316)
This commit is contained in:
@@ -168,6 +168,9 @@ class CommandView(d.Display):
|
||||
self.update(stuff)
|
||||
|
||||
def get(self, row):
|
||||
if row == -1:
|
||||
return None
|
||||
|
||||
numFits = len(self.fits)
|
||||
|
||||
if numFits == 0:
|
||||
@@ -193,23 +196,21 @@ class CommandView(d.Display):
|
||||
wx.CallAfter(self.spawnMenu)
|
||||
|
||||
def spawnMenu(self):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
if fitID is None:
|
||||
return
|
||||
|
||||
sel = self.GetFirstSelected()
|
||||
menu = None
|
||||
if sel != -1:
|
||||
item = self.get(sel)
|
||||
if item is None:
|
||||
return
|
||||
context = ()
|
||||
item = self.get(sel)
|
||||
|
||||
if item is not None:
|
||||
fitSrcContext = "commandFit"
|
||||
fitItemContext = item.name
|
||||
context = ((fitSrcContext, fitItemContext),)
|
||||
context += ("commandView",),
|
||||
menu = ContextMenu.getMenu((item,), *context)
|
||||
elif sel == -1:
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
if fitID is None:
|
||||
return
|
||||
context = (("commandView",),)
|
||||
menu = ContextMenu.getMenu([], *context)
|
||||
|
||||
context += (("commandView",),)
|
||||
menu = ContextMenu.getMenu((item,) if item is not None else [], *context)
|
||||
if menu is not None:
|
||||
self.PopupMenu(menu)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user