Reintroduce the check states functionality to the AddModule and ChangeState commands
This commit is contained in:
@@ -2,6 +2,7 @@ import wx
|
||||
from eos.saveddata.module import Module, State
|
||||
import eos.db
|
||||
from logbook import Logger
|
||||
from service.fit import Fit
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
@@ -23,6 +24,7 @@ class FitAddModuleCommand(wx.Command):
|
||||
self.replace_cmd = None
|
||||
|
||||
def Do(self):
|
||||
sFit = Fit.getInstance()
|
||||
fitID = self.fitID
|
||||
itemID = self.itemID
|
||||
fit = eos.db.getFit(fitID)
|
||||
@@ -57,7 +59,7 @@ class FitAddModuleCommand(wx.Command):
|
||||
# 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)
|
||||
sFit.checkStates(fit, self.module)
|
||||
|
||||
# fit.fill()
|
||||
eos.db.commit()
|
||||
|
||||
@@ -30,7 +30,7 @@ class FitChangeStatesCommand(wx.Command):
|
||||
|
||||
def Do(self):
|
||||
fit = eos.db.getFit(self.fitID)
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
baseMod = fit.modules[self.baseModPos]
|
||||
|
||||
# make sure positions only include non-empty positions
|
||||
@@ -61,6 +61,7 @@ class FitChangeStatesCommand(wx.Command):
|
||||
# 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
|
||||
sFit.checkStates(fit, baseMod)
|
||||
# self.checkStates(fit, base)
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -559,8 +559,8 @@ class Fit(FitDeprecated):
|
||||
changed = True
|
||||
|
||||
# If any state was changed, recalculate attributes again
|
||||
if changed:
|
||||
self.recalc(fit)
|
||||
# if changed:
|
||||
# self.recalc(fit)
|
||||
|
||||
def refreshFit(self, fitID):
|
||||
pyfalog.debug("Refresh fit for fit ID: {0}", fitID)
|
||||
|
||||
Reference in New Issue
Block a user