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

Method Do

gui/fitCommands/calc/commandFit/remove.py:18–37  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

16 self.savedState = None
17
18 def Do(self):
19 pyfalog.debug('Doing removal of command fit {} for fit {}'.format(self.commandFitID, self.fitID))
20 sFit = Fit.getInstance()
21 fit = sFit.getFit(self.fitID)
22 commandFit = sFit.getFit(self.commandFitID)
23
24 # Can be removed by the time we're redoing it
25 if commandFit is None:
26 pyfalog.debug('Command fit is not available')
27 return False
28 commandInfo = commandFit.getCommandInfo(self.fitID)
29 if commandInfo is None:
30 pyfalog.warning('Fit command info is not available')
31 return False
32 self.savedState = commandInfo.active
33 if commandFit.ID not in fit.commandFitDict:
34 pyfalog.warning('Unable to find commanding fit in command dict')
35 return False
36 del fit.commandFitDict[commandFit.ID]
37 return True
38
39 def Undo(self):
40 pyfalog.debug('Undoing removal of command fit {} for fit {}'.format(self.commandFitID, self.fitID))

Callers 1

UndoMethod · 0.95

Calls 3

getFitMethod · 0.80
getCommandInfoMethod · 0.80
getInstanceMethod · 0.45

Tested by

no test coverage detected