(self)
| 21 | self.savedStateCheckChanges = None |
| 22 | |
| 23 | def Do(self): |
| 24 | pyfalog.debug('Doing cloning of local module from position {} to position {} for fit ID {}'.format(self.srcPosition, self.dstPosition, self.fitID)) |
| 25 | sFit = Fit.getInstance() |
| 26 | fit = sFit.getFit(self.fitID) |
| 27 | srcMod = fit.modules[self.srcPosition] |
| 28 | copyMod = copy.deepcopy(srcMod) |
| 29 | if not copyMod.fits(fit): |
| 30 | return False |
| 31 | if not fit.modules[self.dstPosition].isEmpty: |
| 32 | return False |
| 33 | fit.modules.replace(self.dstPosition, copyMod) |
| 34 | if copyMod not in fit.modules: |
| 35 | pyfalog.warning('Failed to replace module') |
| 36 | return False |
| 37 | # Need to flush because checkStates sometimes relies on module->fit |
| 38 | # relationship via .owner attribute, which is handled by SQLAlchemy |
| 39 | eos.db.flush() |
| 40 | sFit.recalc(fit) |
| 41 | self.savedStateCheckChanges = sFit.checkStates(fit, copyMod) |
| 42 | return True |
| 43 | |
| 44 | def Undo(self): |
| 45 | pyfalog.debug('Undoing cloning of local module from position {} to position {} for fit ID {}'.format(self.srcPosition, self.dstPosition, self.fitID)) |
nothing calls this directly
no test coverage detected