From 1ffdf9b2cb92ebb34af2d276a14d62bd6ac85b06 Mon Sep 17 00:00:00 2001 From: cncfanatics Date: Wed, 17 Nov 2010 09:47:53 +0100 Subject: [PATCH] Fixup menu code --- eos | 2 +- gui/builtinContextMenus/moduleAmmoPicker.py | 7 +++---- gui/fittingView.py | 12 +++++++----- gui/mainFrame.py | 5 ++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/eos b/eos index f964b3255..dfe939dad 160000 --- a/eos +++ b/eos @@ -1 +1 @@ -Subproject commit f964b32559a058871f241308cef365a9e7828c5e +Subproject commit dfe939dadf97ff98cf58ae6b00fff230563caafd diff --git a/gui/builtinContextMenus/moduleAmmoPicker.py b/gui/builtinContextMenus/moduleAmmoPicker.py index e7bb9091b..6ed07ff37 100644 --- a/gui/builtinContextMenus/moduleAmmoPicker.py +++ b/gui/builtinContextMenus/moduleAmmoPicker.py @@ -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() diff --git a/gui/fittingView.py b/gui/fittingView.py index df6dcb7db..368230b1f 100644 --- a/gui/fittingView.py +++ b/gui/fittingView.py @@ -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) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 4cd381b68..ddc050c97 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -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)