From e6def6f5f93a94a81a875a6cbf8cedf8f364e466 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Wed, 24 Jun 2015 00:40:13 -0400 Subject: [PATCH 1/4] Fix #299 - fit not recalculated after module states change upon module append --- service/fit.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/service/fit.py b/service/fit.py index dfda754e0..5360a376a 100644 --- a/service/fit.py +++ b/service/fit.py @@ -398,8 +398,11 @@ class Fit(object): if m.isValidState(State.ACTIVE): m.state = State.ACTIVE + # As some items may affect state-limiting attributes of the ship, calculate new attributes first self.recalc(fit) + # Then, check states of all modules and change where needed. This will recalc if needed self.checkStates(fit, m) + fit.fill() eos.db.commit() @@ -857,7 +860,10 @@ class Fit(object): if drone.amountActive > 0 and not drone.canBeApplied(fit): drone.amountActive = 0 changed = True - return changed + + # If any state was changed, recalculate attributes again + if changed: + self.recalc(fit) def toggleModulesState(self, fitID, base, modules, click): proposedState = self.__getProposedState(base, click) @@ -873,11 +879,8 @@ class Fit(object): # As some items may affect state-limiting attributes of the ship, calculate new attributes first self.recalc(fit) - # Then, check states of all modules and change where needed - changed = self.checkStates(fit, base) - # If any state was changed, recalulate attributes again - if changed is True: - self.recalc(fit) + # Then, check states of all modules and change where needed. This will recalc if needed + self.checkStates(fit, base) # Old state : New State localMap = {State.OVERHEATED: State.ACTIVE, @@ -922,5 +925,5 @@ class Fit(object): def recalc(self, fit, withBoosters=False): if fit.factorReload is not self.serviceFittingOptions["useGlobalForceReload"]: fit.factorReload = self.serviceFittingOptions["useGlobalForceReload"] - fit.clear() + fit.clear() fit.calculateModifiedAttributes(withBoosters=withBoosters, dirtyStorage=self.dirtyFitIDs) From 95bf1039c0b5a33303be903c862b5c1422341ef5 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Wed, 24 Jun 2015 14:36:31 -0400 Subject: [PATCH 2/4] Fix #291 - Triage not properly implemented on projected fit --- eos/effects/triagemodeeffect3.py | 1 + eos/effects/triagemodeeffect7.py | 1 + 2 files changed, 2 insertions(+) diff --git a/eos/effects/triagemodeeffect3.py b/eos/effects/triagemodeeffect3.py index dbb95a00a..bc33ee55c 100644 --- a/eos/effects/triagemodeeffect3.py +++ b/eos/effects/triagemodeeffect3.py @@ -3,6 +3,7 @@ # Used by: # Module: Triage Module I type = "active" +runTime = "early" def handler(fit, module, context): # Remote armor reps fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Capital Remote Armor Repair Systems"), diff --git a/eos/effects/triagemodeeffect7.py b/eos/effects/triagemodeeffect7.py index 196af8891..c84c95a5c 100644 --- a/eos/effects/triagemodeeffect7.py +++ b/eos/effects/triagemodeeffect7.py @@ -3,6 +3,7 @@ # Used by: # Module: Triage Module II type = "active" +runTime = "early" def handler(fit, module, context): # Remote armor reps fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Capital Remote Armor Repair Systems"), From 7ec78b941edb741d5ec3c8aeb32183a64e1661fa Mon Sep 17 00:00:00 2001 From: blitzmann Date: Wed, 24 Jun 2015 15:10:37 -0400 Subject: [PATCH 3/4] Add help text for why api is disabled, per #269. I may or may not make it look nicer later --- gui/characterEditor.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gui/characterEditor.py b/gui/characterEditor.py index be77c8d21..57242a92d 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -147,6 +147,7 @@ class CharacterEditor(wx.Frame): def restrict(self): self.btnRename.Enable(False) self.btnDelete.Enable(False) + self.aview.stDisabledTip.Show(True) self.aview.inputID.Enable(False) self.aview.inputKey.Enable(False) self.aview.charChoice.Enable(False) @@ -158,6 +159,7 @@ class CharacterEditor(wx.Frame): def unrestrict(self): self.btnRename.Enable(True) self.btnDelete.Enable(True) + self.aview.stDisabledTip.Show(False) self.aview.inputID.Enable(True) self.aview.inputKey.Enable(True) self.aview.btnFetchCharList.Enable(True) @@ -537,6 +539,11 @@ class APIView (wx.Panel): pmainSizer = wx.BoxSizer(wx.VERTICAL) + self.stDisabledTip = wx.StaticText( self, wx.ID_ANY, u"You cannot add API Details for All 0 and All 5 characters. Please select another character or make a new one.", style=wx.ALIGN_CENTER ) + self.stDisabledTip.Wrap( -1 ) + + pmainSizer.Add( self.stDisabledTip, 0, wx.ALL, 2 ) + fgSizerInput = wx.FlexGridSizer(3, 2, 0, 0) fgSizerInput.AddGrowableCol(1) fgSizerInput.SetFlexibleDirection(wx.BOTH) From 21937c02ffc8db4fd624f331e913e1af698410b2 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Wed, 24 Jun 2015 19:53:55 -0400 Subject: [PATCH 4/4] Made it look nicer --- gui/characterEditor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gui/characterEditor.py b/gui/characterEditor.py index 57242a92d..8d617fa33 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -539,10 +539,14 @@ class APIView (wx.Panel): pmainSizer = wx.BoxSizer(wx.VERTICAL) + hintSizer = wx.BoxSizer( wx.HORIZONTAL ) + hintSizer.AddStretchSpacer() self.stDisabledTip = wx.StaticText( self, wx.ID_ANY, u"You cannot add API Details for All 0 and All 5 characters. Please select another character or make a new one.", style=wx.ALIGN_CENTER ) self.stDisabledTip.Wrap( -1 ) + hintSizer.Add( self.stDisabledTip, 0, wx.TOP | wx.BOTTOM, 15 ) + hintSizer.AddStretchSpacer() + pmainSizer.Add(hintSizer, 0, wx.EXPAND, 5) - pmainSizer.Add( self.stDisabledTip, 0, wx.ALL, 2 ) fgSizerInput = wx.FlexGridSizer(3, 2, 0, 0) fgSizerInput.AddGrowableCol(1)