(self)
| 236 | evt.Skip() |
| 237 | |
| 238 | def OnWindowClose(self): |
| 239 | # Submit mutation changes |
| 240 | sFit = Fit.getInstance() |
| 241 | fit = sFit.getFit(self.carryingFitID) |
| 242 | isCurrentMod = self.stuff in fit.modules |
| 243 | isCurrentDrone = self.stuff in fit.drones |
| 244 | if isCurrentMod or isCurrentDrone: |
| 245 | if self.isModified: |
| 246 | currentMutation = {} |
| 247 | for slider, m in self.event_mapping.items(): |
| 248 | # Sliders may have more up-to-date info than mutator in case we changed |
| 249 | # value in slider and without confirming it, decided to close window |
| 250 | value = slider.GetValue() |
| 251 | value = self._complicateValue(m, value) |
| 252 | if value != m.value: |
| 253 | value = sFit.changeMutatedValuePrelim(m, value) |
| 254 | currentMutation[m.attrID] = value |
| 255 | else: |
| 256 | currentMutation = self.initialMutations |
| 257 | mainFrame = gui.mainFrame.MainFrame.getInstance() |
| 258 | if isCurrentMod: |
| 259 | mainFrame.getCommandForFit(self.carryingFitID).Submit(cmd.GuiChangeLocalModuleMutationCommand( |
| 260 | fitID=self.carryingFitID, |
| 261 | position=fit.modules.index(self.stuff), |
| 262 | mutation=currentMutation, |
| 263 | oldMutation=self.initialMutations)) |
| 264 | elif isCurrentDrone: |
| 265 | mainFrame.getCommandForFit(self.carryingFitID).Submit(cmd.GuiChangeLocalDroneMutationCommand( |
| 266 | fitID=self.carryingFitID, |
| 267 | position=fit.drones.index(self.stuff), |
| 268 | mutation=currentMutation, |
| 269 | oldMutation=self.initialMutations)) |
| 270 | for slider in self.event_mapping: |
| 271 | slider.OnWindowClose() |
| 272 | |
| 273 | def callLater(self): |
| 274 | self.timer = None |
no test coverage detected