From a7ec10525e04c4623773951320fd228bbbabd6af Mon Sep 17 00:00:00 2001 From: blitzmann Date: Wed, 12 Apr 2017 00:34:50 -0400 Subject: [PATCH 1/2] Apparently this happens on command fits as well... temp fix until I can look into why this happens --- eos/saveddata/fit.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 014c69fa6..2449e7e9a 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -689,7 +689,10 @@ class Fit(object): # For fits that are under local's Command, we do the same thing for value in self.boostedOnto.values(): - value.boosted_fit.__resetDependantCalcs() + # apparently this is a thing that happens when removing a command fit from a fit and then switching to + # that command fit. Same as projected clears, figure out why. + if value.boosted_fit: + value.boosted_fit.__resetDependantCalcs() # it should be noted that command bursts don't affect other command bursts From 080590a292e1d3fcb5e43d9d05408973edad819e Mon Sep 17 00:00:00 2001 From: blitzmann Date: Wed, 12 Apr 2017 00:39:05 -0400 Subject: [PATCH 2/2] Add "Currently Open Fits" context menu for projected and command views --- gui/builtinContextMenus/tabbedFits.py | 67 +++++++++++++++++++++++++++ gui/contextMenu.py | 1 + 2 files changed, 68 insertions(+) create mode 100644 gui/builtinContextMenus/tabbedFits.py diff --git a/gui/builtinContextMenus/tabbedFits.py b/gui/builtinContextMenus/tabbedFits.py new file mode 100644 index 000000000..c0db5973f --- /dev/null +++ b/gui/builtinContextMenus/tabbedFits.py @@ -0,0 +1,67 @@ +# coding: utf-8 + +# noinspection PyPackageRequirements +import wx + +from service.fit import Fit +import gui.mainFrame +import gui.globalEvents as GE +from gui.contextMenu import ContextMenu +from gui.builtinViews.emptyView import BlankPage + + +class TabbedFits(ContextMenu): + def __init__(self): + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + + def display(self, srcContext, selection): + + if self.mainFrame.getActiveFit() is None or srcContext not in ("projected", "commandView"): + return False + + return True + + def getText(self, itmContext, selection): + return "Currently Open Fits" + + def getSubMenu(self, context, selection, rootMenu, i, pitem): + self.fitLookup = {} + self.context = context + sFit = Fit.getInstance() + + m = wx.Menu() + + # If on Windows we need to bind out events into the root menu, on other + # platforms they need to go to our sub menu + if "wxMSW" in wx.PlatformInfo: + bindmenu = rootMenu + else: + bindmenu = m + + for page in self.mainFrame.fitMultiSwitch.pages: + if isinstance(page, BlankPage): + continue + fit = sFit.getFit(page.activeFitID, basic=True) + id = ContextMenu.nextID() + mitem = wx.MenuItem(rootMenu, id, '{}: {}'.format(fit.ship.item.name, fit.name)) + bindmenu.Bind(wx.EVT_MENU, self.handleSelection, mitem) + self.fitLookup[id] = fit + m.AppendItem(mitem) + + return m + + def handleSelection(self, event): + sFit = Fit.getInstance() + fitID = self.mainFrame.getActiveFit() + + fit = self.fitLookup[event.Id] + + if self.context == 'commandView': + sFit.addCommandFit(fitID, fit) + elif self.context == 'projected': + sFit.project(fitID, fit) + + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) + + +TabbedFits.register() diff --git a/gui/contextMenu.py b/gui/contextMenu.py index adfeeb324..155a42787 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -206,4 +206,5 @@ from gui.builtinContextMenus import ( # noqa: E402,F401 implantSets, fighterAbilities, commandFits, + tabbedFits )