def OnWindowClose(self): # Submit mutation changes sFit = Fit.getInstance() fit = sFit.getFit(self.carryingFitID) if self.mod in fit.modules: if self.isModified: 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 value = slider.GetValue() value = m.attribute.unit.ComplicateValue(value) if value != m.value: value = sFit.changeMutatedValuePrelim(m, value) currentMutation[m.attrID] = value else: currentMutation = self.initialMutations mainFrame = gui.mainFrame.MainFrame.getInstance() mainFrame.getCommandForFit(self.carryingFitID).Submit( cmd.GuiChangeLocalModuleMutationCommand( fitID=self.carryingFitID, position=fit.modules.index(self.mod), mutation=currentMutation, oldMutation=self.initialMutations)) for slider in self.event_mapping: slider.OnWindowClose()
def submitMutationChanges(self): fit = Fit.getInstance().getFit(self.carryingFitID) if self.mod in fit.modules: currentMutation = {} for m in self.event_mapping.values(): currentMutation[m.attrID] = m.value mainFrame = gui.mainFrame.MainFrame.getInstance() mainFrame.getCommandForFit(self.carryingFitID).Submit(cmd.GuiChangeLocalModuleMutationCommand( fitID=self.carryingFitID, position=fit.modules.index(self.mod), mutation=currentMutation, oldMutation=self.initialMutations))