diff --git a/gui/builtinContextMenus/factorReload.py b/gui/builtinContextMenus/factorReload.py index 5923469f8..ca499e163 100644 --- a/gui/builtinContextMenus/factorReload.py +++ b/gui/builtinContextMenus/factorReload.py @@ -17,8 +17,9 @@ class FactorReload(ContextMenu): def activate(self, fullContext, selection, i): sFit = service.Fit.getInstance() + sFit.serviceFittingOptions["useGlobalForceReload"] = not sFit.serviceFittingOptions["useGlobalForceReload"] fitID = self.mainFrame.getActiveFit() - sFit.toggleFactorReload(fitID) + sFit.refreshFit(fitID) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) def getBitmap(self, context, selection): diff --git a/gui/builtinPreferenceViews/pyfaGlobalPreferences.py b/gui/builtinPreferenceViews/pyfaGlobalPreferences.py index 160dc4434..c80d0165f 100644 --- a/gui/builtinPreferenceViews/pyfaGlobalPreferences.py +++ b/gui/builtinPreferenceViews/pyfaGlobalPreferences.py @@ -32,7 +32,7 @@ class PFGlobalPref ( PreferenceView): self.cbGlobalDmgPattern = wx.CheckBox( panel, wx.ID_ANY, u"Use global damage pattern", wx.DefaultPosition, wx.DefaultSize, 0 ) mainSizer.Add( self.cbGlobalDmgPattern, 0, wx.ALL|wx.EXPAND, 5 ) - self.cbGlobalForceReload = wx.CheckBox( panel, wx.ID_ANY, u"Use force reload", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.cbGlobalForceReload = wx.CheckBox( panel, wx.ID_ANY, u"Factor in reload time", wx.DefaultPosition, wx.DefaultSize, 0 ) mainSizer.Add( self.cbGlobalForceReload, 0, wx.ALL|wx.EXPAND, 5 ) defCharSizer = wx.BoxSizer( wx.HORIZONTAL ) @@ -77,6 +77,7 @@ class PFGlobalPref ( PreferenceView): def OnCBGlobalForceReloadStateChange(self, event): self.sFit.serviceFittingOptions["useGlobalForceReload"] = self.cbGlobalForceReload.GetValue() fitID = self.mainFrame.getActiveFit() + self.sFit.refreshFit(fitID) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) event.Skip() diff --git a/service/fit.py b/service/fit.py index 43c0c56b9..4f8494494 100644 --- a/service/fit.py +++ b/service/fit.py @@ -665,7 +665,17 @@ class Fit(object): else: return currState + def refreshFit(self, fitID): + if fitID is None: + return None + + fit = eos.db.getFit(fitID) + eos.db.commit() + self.recalc(fit) + def recalc(self, fit, withBoosters=False): + if fit.factorReload is not self.serviceFittingOptions["useGlobalForceReload"]: + fit.factorReload = self.serviceFittingOptions["useGlobalForceReload"] + eos.db.commit() fit.clear() - fit.forceReload = self.serviceFittingOptions["useGlobalForceReload"] fit.calculateModifiedAttributes(withBoosters=withBoosters, dirtyStorage=self.dirtyFitIDs)