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

Class CalcChangeShipModeCommand

gui/fitCommands/calc/shipModeChange.py:12–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11
12class CalcChangeShipModeCommand(wx.Command):
13
14 def __init__(self, fitID, itemID):
15 wx.Command.__init__(self, True, 'Change Ship Mode')
16 self.fitID = fitID
17 self.itemID = itemID
18 self.savedItemID = None
19
20 def Do(self):
21 pyfalog.debug('Doing changing ship mode to {} for fit {}'.format(self.itemID, self.fitID))
22 fit = Fit.getInstance().getFit(self.fitID)
23 self.savedItemID = fit.mode.item.ID
24 item = Market.getInstance().getItem(self.itemID)
25 mode = Mode(item)
26 fit.mode = mode
27 return True
28
29 def Undo(self):
30 pyfalog.debug('Undoing changing ship mode to {} for fit {}'.format(self.itemID, self.fitID))
31 cmd = CalcChangeShipModeCommand(self.fitID, self.savedItemID)
32 return cmd.Do()

Callers 2

DoMethod · 0.90
UndoMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected