MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / CalcRemoveLocalFighterCommand

Class CalcRemoveLocalFighterCommand

gui/fitCommands/calc/fighter/localRemove.py:11–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10
11class CalcRemoveLocalFighterCommand(wx.Command):
12
13 def __init__(self, fitID, position):
14 wx.Command.__init__(self, True, 'Remove Fighter')
15 self.fitID = fitID
16 self.position = position
17 self.savedFighterInfo = None
18
19 def Do(self):
20 pyfalog.debug('Doing removal of fighter at position {} from fit {}'.format(self.position, self.fitID))
21 fit = Fit.getInstance().getFit(self.fitID)
22 fighter = fit.fighters[self.position]
23 self.savedFighterInfo = FighterInfo.fromFighter(fighter)
24 fit.fighters.remove(fighter)
25 return True
26
27 def Undo(self):
28 pyfalog.debug('Undoing removal of fighter at position {} from fit {}'.format(self.position, self.fitID))
29 from .localAdd import CalcAddLocalFighterCommand
30 cmd = CalcAddLocalFighterCommand(
31 fitID=self.fitID,
32 fighterInfo=self.savedFighterInfo,
33 position=self.position,
34 ignoreRestrictions=True)
35 return cmd.Do()

Callers 4

DoMethod · 0.90
DoMethod · 0.90
DoMethod · 0.90
UndoMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected