Fixup menu code
This commit is contained in:
2
eos
2
eos
Submodule eos updated: f964b32559...dfe939dadf
@@ -14,10 +14,9 @@ class ModuleAmmoPicker(ContextMenu):
|
||||
if self.mainFrame.getActiveFit() is None or context not in ("module", "projectedModule"):
|
||||
return False
|
||||
|
||||
if context == "module":
|
||||
modules = self.mainFrame.getFittingView().getSelectedMods()
|
||||
else:
|
||||
modules = (selection[0],)
|
||||
modules = selection if context == "module" else (selection[0],)
|
||||
|
||||
|
||||
validCharges = None
|
||||
for mod in modules:
|
||||
currCharges = mod.getValidCharges()
|
||||
|
||||
@@ -251,17 +251,19 @@ class FittingView(d.Display):
|
||||
cFit = service.Fit.getInstance()
|
||||
selection = []
|
||||
sel = self.GetFirstSelected()
|
||||
contexts = []
|
||||
if sel != -1:
|
||||
contexts = set()
|
||||
while sel != -1:
|
||||
mod = self.mods[self.GetItemData(sel)]
|
||||
if not mod.isEmpty:
|
||||
contexts.append("module")
|
||||
contexts.add("module")
|
||||
if mod.charge is not None and "ammo" not in contexts:
|
||||
contexts.append("ammo")
|
||||
contexts.add("ammo")
|
||||
|
||||
selection.append(mod)
|
||||
|
||||
contexts.append("ship")
|
||||
sel = self.GetNextSelected(sel)
|
||||
|
||||
contexts.add("ship")
|
||||
|
||||
menu = ContextMenu.getMenu(selection, *contexts)
|
||||
self.PopupMenu(menu)
|
||||
|
||||
@@ -132,9 +132,8 @@ class MainFrame(wx.Frame):
|
||||
m = getattr(p, "getActiveFit", None)
|
||||
return m() if m is not None else None
|
||||
|
||||
def getFittingView(self):
|
||||
sel = self.fitMultiSwitch.GetSelection()
|
||||
return self.fitMultiSwitch.GetPage(sel).view
|
||||
def getActiveView(self):
|
||||
sel = self.fitMultiSwitch.GetSelectedPage()
|
||||
|
||||
def mouseHit(self, event):
|
||||
tab, _ = self.notebookBrowsers.HitTest(event.Position)
|
||||
|
||||
Reference in New Issue
Block a user