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

Method __swap

gui/fitCommands/calc/module/localSwap.py:28–45  ·  view source on GitHub ↗
(self, fitID, position1, position2)

Source from the content-addressed store, hash-verified

26 return True
27
28 def __swap(self, fitID, position1, position2):
29 fit = Fit.getInstance().getFit(fitID)
30 mod1 = fit.modules[position1]
31 mod2 = fit.modules[position2]
32 fit.modules.free(position1)
33 fit.modules.free(position2)
34 fit.modules.replace(position2, mod1)
35 if len(fit.modules) <= position2 or fit.modules[position2] is not mod1:
36 fit.modules.replace(position1, mod1)
37 fit.modules.replace(position2, mod2)
38 return False
39 fit.modules.replace(position1, mod2)
40 if len(fit.modules) <= position1 or fit.modules[position1] is not mod2:
41 fit.modules.free(position2)
42 fit.modules.replace(position1, mod1)
43 fit.modules.replace(position2, mod2)
44 return False
45 return True

Callers 2

DoMethod · 0.95
UndoMethod · 0.95

Calls 4

getFitMethod · 0.80
freeMethod · 0.80
replaceMethod · 0.80
getInstanceMethod · 0.45

Tested by

no test coverage detected