Do proper attribute conversions on window close

This commit is contained in:
DarkPhoenix
2019-08-07 23:18:06 +03:00
parent c559508175
commit 7fdcd4aa15

View File

@@ -213,13 +213,18 @@ class ItemMutatorList(wx.ScrolledWindow):
def OnWindowClose(self):
# Submit mutation changes
fit = Fit.getInstance().getFit(self.carryingFitID)
sFit = Fit.getInstance()
fit = sFit.getFit(self.carryingFitID)
if self.mod in fit.modules:
currentMutation = {}
for slider, m in self.event_mapping.items():
# Sliders may have more up-to-date info than mutator in case we changed
# value in slider and without confirming it, decided to close window
currentMutation[m.attrID] = slider.GetValue()
value = slider.GetValue()
value = m.attribute.unit.ComplicateValue(value)
if value != m.value:
value = sFit.changeMutatedValuePrelim(m, value)
currentMutation[m.attrID] = value
mainFrame = gui.mainFrame.MainFrame.getInstance()
mainFrame.getCommandForFit(self.carryingFitID).Submit(cmd.GuiChangeLocalModuleMutationCommand(
fitID=self.carryingFitID,