MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / Do

Method Do

gui/fitCommands/calc/module/localClone.py:23–42  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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))

Callers

nothing calls this directly

Calls 7

getFitMethod · 0.80
replaceMethod · 0.80
flushMethod · 0.80
recalcMethod · 0.80
checkStatesMethod · 0.80
getInstanceMethod · 0.45
fitsMethod · 0.45

Tested by

no test coverage detected