Merge several local/projected commands into universal commands

This commit is contained in:
DarkPhoenix
2019-04-14 13:30:14 +03:00
parent 5ac9604fab
commit a8684ef1b9
95 changed files with 306 additions and 373 deletions

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitAddBoosterCommand(wx.Command):
class CalcAddBoosterCommand(wx.Command):
def __init__(self, fitID, boosterInfo, position=None):
wx.Command.__init__(self, True, 'Add Booster')
@@ -38,7 +38,7 @@ class FitAddBoosterCommand(wx.Command):
fit.boosters.insert(self.newPosition, newBooster)
except HandledListActionError:
pyfalog.warning('Failed to insert to list')
cmd = FitAddBoosterCommand(fitID=self.fitID, boosterInfo=self.oldBoosterInfo, position=self.oldPosition)
cmd = CalcAddBoosterCommand(fitID=self.fitID, boosterInfo=self.oldBoosterInfo, position=self.oldPosition)
cmd.Do()
return False
else:
@@ -46,7 +46,7 @@ class FitAddBoosterCommand(wx.Command):
fit.boosters.append(newBooster)
except HandledListActionError:
pyfalog.warning('Failed to append to list')
cmd = FitAddBoosterCommand(fitID=self.fitID, boosterInfo=self.oldBoosterInfo, position=self.oldPosition)
cmd = CalcAddBoosterCommand(fitID=self.fitID, boosterInfo=self.oldBoosterInfo, position=self.oldPosition)
cmd.Do()
return False
self.newPosition = fit.boosters.index(newBooster)
@@ -57,8 +57,8 @@ class FitAddBoosterCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undo addition of booster {} to fit {}'.format(self.newBoosterInfo, self.fitID))
if self.oldBoosterInfo and self.oldPosition:
cmd = FitAddBoosterCommand(fitID=self.fitID, boosterInfo=self.oldBoosterInfo, position=self.oldPosition)
cmd = CalcAddBoosterCommand(fitID=self.fitID, boosterInfo=self.oldBoosterInfo, position=self.oldPosition)
return cmd.Do()
from .remove import FitRemoveBoosterCommand
cmd = FitRemoveBoosterCommand(fitID=self.fitID, position=self.newPosition)
from .remove import CalcRemoveBoosterCommand
cmd = CalcRemoveBoosterCommand(fitID=self.fitID, position=self.newPosition)
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitRemoveBoosterCommand(wx.Command):
class CalcRemoveBoosterCommand(wx.Command):
def __init__(self, fitID, position):
wx.Command.__init__(self, True, 'Remove Booster')
@@ -28,6 +28,6 @@ class FitRemoveBoosterCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing removal of booster {} on fit {}'.format(self.savedBoosterInfo, self.fitID))
from .add import FitAddBoosterCommand
cmd = FitAddBoosterCommand(fitID=self.fitID, boosterInfo=self.savedBoosterInfo, position=self.position)
from .add import CalcAddBoosterCommand
cmd = CalcAddBoosterCommand(fitID=self.fitID, boosterInfo=self.savedBoosterInfo, position=self.position)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitToggleBoosterSideEffectStateCommand(wx.Command):
class CalcToggleBoosterSideEffectStateCommand(wx.Command):
def __init__(self, fitID, position, effectID, forceState=None):
wx.Command.__init__(self, True, 'Toggle Booster Side Effect State')
@@ -33,5 +33,5 @@ class FitToggleBoosterSideEffectStateCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing toggling of booster side effect {} state at position {} for fit {}'.format(self.effectID, self.position, self.fitID))
cmd = FitToggleBoosterSideEffectStateCommand(fitID=self.fitID, position=self.position, effectID=self.effectID, forceState=self.savedState)
cmd = CalcToggleBoosterSideEffectStateCommand(fitID=self.fitID, position=self.position, effectID=self.effectID, forceState=self.savedState)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitToggleBoosterStateCommand(wx.Command):
class CalcToggleBoosterStateCommand(wx.Command):
def __init__(self, fitID, position, forceState=None):
wx.Command.__init__(self, True, 'Toggle Booster State')
@@ -28,5 +28,5 @@ class FitToggleBoosterStateCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing toggling of booster state at position {} for fit {}'.format(self.position, self.fitID))
cmd = FitToggleBoosterStateCommand(fitID=self.fitID, position=self.position, forceState=self.savedState)
cmd = CalcToggleBoosterStateCommand(fitID=self.fitID, position=self.position, forceState=self.savedState)
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitAddCargoCommand(wx.Command):
class CalcAddCargoCommand(wx.Command):
def __init__(self, fitID, cargoInfo):
wx.Command.__init__(self, True, 'Add Cargo')
@@ -35,6 +35,6 @@ class FitAddCargoCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing addition of cargo {} to fit {}'.format(self.cargoInfo, self.fitID))
from .remove import FitRemoveCargoCommand
cmd = FitRemoveCargoCommand(fitID=self.fitID, cargoInfo=self.cargoInfo)
from .remove import CalcRemoveCargoCommand
cmd = CalcRemoveCargoCommand(fitID=self.fitID, cargoInfo=self.cargoInfo)
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeCargoAmountCommand(wx.Command):
class CalcChangeCargoAmountCommand(wx.Command):
def __init__(self, fitID, cargoInfo):
wx.Command.__init__(self, True, 'Change Cargo Amount')
@@ -33,5 +33,5 @@ class FitChangeCargoAmountCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing change of cargo {} for fit {}'.format(self.cargoInfo, self.fitID))
cmd = FitChangeCargoAmountCommand(fitID=self.fitID, cargoInfo=self.savedCargoInfo)
cmd = CalcChangeCargoAmountCommand(fitID=self.fitID, cargoInfo=self.savedCargoInfo)
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitRemoveCargoCommand(wx.Command):
class CalcRemoveCargoCommand(wx.Command):
def __init__(self, fitID, cargoInfo):
wx.Command.__init__(self, True, 'Remove Cargo')
@@ -32,6 +32,6 @@ class FitRemoveCargoCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing removal of cargo {} to fit {}'.format(self.cargoInfo, self.fitID))
from .add import FitAddCargoCommand
cmd = FitAddCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=self.cargoInfo.itemID, amount=self.savedRemovedAmount))
from .add import CalcAddCargoCommand
cmd = CalcAddCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=self.cargoInfo.itemID, amount=self.savedRemovedAmount))
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitAddCommandCommand(wx.Command):
class CalcAddCommandCommand(wx.Command):
def __init__(self, fitID, commandFitID, state=None):
wx.Command.__init__(self, True, 'Add Command Fit')
@@ -54,6 +54,6 @@ class FitAddCommandCommand(wx.Command):
commandFit = Fit.getInstance().getFit(self.commandFitID)
if commandFit is None:
return True
from .remove import FitRemoveCommandCommand
cmd = FitRemoveCommandCommand(fitID=self.fitID, commandFitID=self.commandFitID)
from .remove import CalcRemoveCommandCommand
cmd = CalcRemoveCommandCommand(fitID=self.fitID, commandFitID=self.commandFitID)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitRemoveCommandCommand(wx.Command):
class CalcRemoveCommandCommand(wx.Command):
def __init__(self, fitID, commandFitID):
wx.Command.__init__(self, True, 'Remove Command Fit')
@@ -38,6 +38,6 @@ class FitRemoveCommandCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing removal of command fit {} for fit {}'.format(self.commandFitID, self.fitID))
from .add import FitAddCommandCommand
cmd = FitAddCommandCommand(fitID=self.fitID, commandFitID=self.commandFitID, state=self.savedState)
from .add import CalcAddCommandCommand
cmd = CalcAddCommandCommand(fitID=self.fitID, commandFitID=self.commandFitID, state=self.savedState)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitToggleCommandFitStateCommand(wx.Command):
class CalcToggleCommandFitStateCommand(wx.Command):
def __init__(self, fitID, commandFitID, forceState=None):
wx.Command.__init__(self, True, 'Toggle Command Fit State')
@@ -35,5 +35,5 @@ class FitToggleCommandFitStateCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing toggling of command fit {} state for fit {}'.format(self.commandFitID, self.fitID))
cmd = FitToggleCommandFitStateCommand(fitID=self.fitID, commandFitID=self.commandFitID, forceState=self.savedState)
cmd = CalcToggleCommandFitStateCommand(fitID=self.fitID, commandFitID=self.commandFitID, forceState=self.savedState)
return cmd.Do()

View File

@@ -11,7 +11,7 @@ from service.market import Market
pyfalog = Logger(__name__)
class FitAddDroneCommand(wx.Command):
class CalcAddLocalDroneCommand(wx.Command):
def __init__(self, fitID, droneInfo):
wx.Command.__init__(self, True, 'Add Drone')
@@ -21,7 +21,7 @@ class FitAddDroneCommand(wx.Command):
self.savedPosition = None
def Do(self):
pyfalog.debug('Doing addition of drone {} to fit {}'.format(self.droneInfo, self.fitID))
pyfalog.debug('Doing addition of local drone {} to fit {}'.format(self.droneInfo, self.fitID))
fit = Fit.getInstance().getFit(self.fitID)
item = Market.getInstance().getItem(self.droneInfo.itemID, eager=("attributes", "group.category"))
# If we're not adding any active drones, check if there's an inactive stack
@@ -55,13 +55,13 @@ class FitAddDroneCommand(wx.Command):
return True
def Undo(self):
pyfalog.debug('Undoing addition of drone {} to fit {}'.format(self.droneInfo, self.fitID))
pyfalog.debug('Undoing addition of local drone {} to fit {}'.format(self.droneInfo, self.fitID))
if self.savedDroneInfo is not None:
fit = Fit.getInstance().getFit(self.fitID)
drone = fit.drones[self.savedPosition]
drone.amount = self.savedDroneInfo.amount
drone.amountActive = self.savedDroneInfo.amountActive
return True
from .localRemove import FitRemoveDroneCommand
cmd = FitRemoveDroneCommand(fitID=self.fitID, position=self.savedPosition, amount=self.droneInfo.amount)
from .localRemove import CalcRemoveLocalDroneCommand
cmd = CalcRemoveLocalDroneCommand(fitID=self.fitID, position=self.savedPosition, amount=self.droneInfo.amount)
return cmd.Do()

View File

@@ -11,7 +11,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeDroneAmountCommand(wx.Command):
class CalcChangeLocalDroneAmountCommand(wx.Command):
def __init__(self, fitID, position, amount):
wx.Command.__init__(self, True, 'Change Drone Amount')
@@ -21,7 +21,7 @@ class FitChangeDroneAmountCommand(wx.Command):
self.savedDroneInfo = None
def Do(self):
pyfalog.debug('Doing change of drone amount to {} at position {} on fit {}'.format(self.amount, self.position, self.fitID))
pyfalog.debug('Doing change of local drone amount to {} at position {} on fit {}'.format(self.amount, self.position, self.fitID))
fit = Fit.getInstance().getFit(self.fitID)
drone = fit.drones[self.position]
self.savedDroneInfo = DroneInfo.fromDrone(drone)
@@ -36,7 +36,7 @@ class FitChangeDroneAmountCommand(wx.Command):
return True
def Undo(self):
pyfalog.debug('Undoing change of drone quantity to {} at position {} on fit {}'.format(self.amount, self.position, self.fitID))
pyfalog.debug('Undoing change of local drone quantity to {} at position {} on fit {}'.format(self.amount, self.position, self.fitID))
if self.savedDroneInfo is not None:
fit = Fit.getInstance().getFit(self.fitID)
drone = fit.drones[self.position]

View File

@@ -10,7 +10,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitRemoveDroneCommand(wx.Command):
class CalcRemoveLocalDroneCommand(wx.Command):
def __init__(self, fitID, position, amount):
wx.Command.__init__(self, True, 'Remove Drone')
@@ -21,7 +21,7 @@ class FitRemoveDroneCommand(wx.Command):
self.removedStack = None
def Do(self):
pyfalog.debug('Doing removal of {} drones at position {} from fit {}'.format(self.amountToRemove, self.position, self.fitID))
pyfalog.debug('Doing removal of {} local drones at position {} from fit {}'.format(self.amountToRemove, self.position, self.fitID))
fit = Fit.getInstance().getFit(self.fitID)
drone = fit.drones[self.position]
self.savedDroneInfo = DroneInfo.fromDrone(drone)
@@ -40,7 +40,7 @@ class FitRemoveDroneCommand(wx.Command):
return True
def Undo(self):
pyfalog.debug('Undoing removal of {} drones at position {} from fit {}'.format(self.amountToRemove, self.position, self.fitID))
pyfalog.debug('Undoing removal of {} local drones at position {} from fit {}'.format(self.amountToRemove, self.position, self.fitID))
fit = Fit.getInstance().getFit(self.fitID)
if self.removedStack:
drone = self.savedDroneInfo.toDrone()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitToggleDroneStateCommand(wx.Command):
class CalcToggleLocalDroneStateCommand(wx.Command):
def __init__(self, fitID, position, forceAmountActive=None):
wx.Command.__init__(self, True, 'Toggle Drone State')
@@ -18,7 +18,7 @@ class FitToggleDroneStateCommand(wx.Command):
self.savedAmountActive = None
def Do(self):
pyfalog.debug('Doing toggling of drone state at position {} for fit {}'.format(self.position, self.fitID))
pyfalog.debug('Doing toggling of local drone state at position {} for fit {}'.format(self.position, self.fitID))
fit = Fit.getInstance().getFit(self.fitID)
drone = fit.drones[self.position]
self.savedAmountActive = drone.amountActive
@@ -32,6 +32,6 @@ class FitToggleDroneStateCommand(wx.Command):
return True
def Undo(self):
pyfalog.debug('Undoing toggling of drone state at position {} for fit {}'.format(self.position, self.fitID))
cmd = FitToggleDroneStateCommand(fitID=self.fitID, position=self.position, forceAmountActive=self.savedAmountActive)
pyfalog.debug('Undoing toggling of local drone state at position {} for fit {}'.format(self.position, self.fitID))
cmd = CalcToggleLocalDroneStateCommand(fitID=self.fitID, position=self.position, forceAmountActive=self.savedAmountActive)
return cmd.Do()

View File

@@ -10,7 +10,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitAddProjectedDroneCommand(wx.Command):
class CalcAddProjectedDroneCommand(wx.Command):
def __init__(self, fitID, droneInfo):
wx.Command.__init__(self, True, 'Add Projected Drone')
@@ -61,6 +61,6 @@ class FitAddProjectedDroneCommand(wx.Command):
drone.amountActive = self.savedDroneInfo.amountActive
return True
# Removing new stack
from .projectedRemove import FitRemoveProjectedDroneCommand
cmd = FitRemoveProjectedDroneCommand(fitID=self.fitID, droneInfo=self.droneInfo)
from .projectedRemove import CalcRemoveProjectedDroneCommand
cmd = CalcRemoveProjectedDroneCommand(fitID=self.fitID, droneInfo=self.droneInfo)
return cmd.Do()

View File

@@ -11,7 +11,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeProjectedDroneAmountCommand(wx.Command):
class CalcChangeProjectedDroneAmountCommand(wx.Command):
def __init__(self, fitID, itemID, amount):
wx.Command.__init__(self, True, 'Change Projected Drone Amount')

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitRemoveProjectedDroneCommand(wx.Command):
class CalcRemoveProjectedDroneCommand(wx.Command):
def __init__(self, fitID, droneInfo):
wx.Command.__init__(self, True, 'Remove Projected Drone')
@@ -45,6 +45,6 @@ class FitRemoveProjectedDroneCommand(wx.Command):
drone.amountActive = self.savedDroneInfo.amountActive
return True
# Make new stack
from .projectedAdd import FitAddProjectedDroneCommand
cmd = FitAddProjectedDroneCommand(fitID=self.fitID, droneInfo=self.savedDroneInfo)
from .projectedAdd import CalcAddProjectedDroneCommand
cmd = CalcAddProjectedDroneCommand(fitID=self.fitID, droneInfo=self.savedDroneInfo)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitToggleProjectedDroneStateCommand(wx.Command):
class CalcToggleProjectedDroneStateCommand(wx.Command):
def __init__(self, fitID, itemID, forceAmountActive=None):
wx.Command.__init__(self, True, 'Toggle Projected Drone State')
@@ -42,5 +42,5 @@ class FitToggleProjectedDroneStateCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing toggling of projected drone {} state for fit {}'.format(self.itemID, self.fitID))
cmd = FitToggleProjectedDroneStateCommand(fitID=self.fitID, itemID=self.itemID, forceAmountActive=self.savedAmountActive)
cmd = CalcToggleProjectedDroneStateCommand(fitID=self.fitID, itemID=self.itemID, forceAmountActive=self.savedAmountActive)
return cmd.Do()

View File

@@ -8,14 +8,14 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitToggleFighterAbilityStateCommand(wx.Command):
class CalcToggleFighterAbilityStateCommand(wx.Command):
def __init__(self, fitID, position, effectID, projected, forceState=None):
def __init__(self, fitID, projected, position, effectID, forceState=None):
wx.Command.__init__(self, True, 'Toggle Fighter Ability State')
self.fitID = fitID
self.projected = projected
self.position = position
self.effectID = effectID
self.projected = projected
self.forceState = forceState
self.savedState = None
@@ -35,10 +35,10 @@ class FitToggleFighterAbilityStateCommand(wx.Command):
def Undo(self):
pyfalog.debug('Unoing toggling of fighter ability {} state at position {} for fit {}'.format(self.effectID, self.position, self.fitID))
cmd = FitToggleFighterAbilityStateCommand(
cmd = CalcToggleFighterAbilityStateCommand(
fitID=self.fitID,
projected=self.projected,
position=self.position,
effectID=self.effectID,
projected=self.projected,
forceState=self.savedState)
return cmd.Do()

View File

@@ -8,11 +8,12 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeFighterAmountCommand(wx.Command):
class CalcChangeFighterAmountCommand(wx.Command):
def __init__(self, fitID, position, amount):
def __init__(self, fitID, projected, position, amount):
wx.Command.__init__(self, True, 'Change Fighter Amount')
self.fitID = fitID
self.projected = projected
self.position = position
self.amount = amount
self.savedAmount = None
@@ -20,7 +21,8 @@ class FitChangeFighterAmountCommand(wx.Command):
def Do(self):
pyfalog.debug('Doing change of fighter amount to {} at position {} on fit {}'.format(self.amount, self.position, self.fitID))
fit = Fit.getInstance().getFit(self.fitID)
fighter = fit.fighters[self.position]
container = fit.projectedFighters if self.projected else fit.fighters
fighter = container[self.position]
if self.amount == fighter.amount or self.amount == fighter.amountActive:
return False
self.savedAmount = fighter.amount
@@ -35,5 +37,5 @@ class FitChangeFighterAmountCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing change of fighter amount to {} at position {} on fit {}'.format(self.amount, self.position, self.fitID))
cmd = FitChangeFighterAmountCommand(fitID=self.fitID, position=self.position, amount=self.savedAmount)
cmd = CalcChangeFighterAmountCommand(fitID=self.fitID, projected=self.projected, position=self.position, amount=self.savedAmount)
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitAddFighterCommand(wx.Command):
class CalcAddLocalFighterCommand(wx.Command):
def __init__(self, fitID, fighterInfo, position=None):
wx.Command.__init__(self, True, 'Add Fighter')
@@ -58,7 +58,7 @@ class FitAddFighterCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing addition of fighter {} to fit {}'.format(self.fighterInfo, self.fitID))
from .localRemove import FitRemoveFighterCommand
cmd = FitRemoveFighterCommand(fitID=self.fitID, position=self.position)
from .localRemove import CalcRemoveLocalFighterCommand
cmd = CalcRemoveLocalFighterCommand(fitID=self.fitID, position=self.position)
cmd.Do()
return True

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitRemoveFighterCommand(wx.Command):
class CalcRemoveLocalFighterCommand(wx.Command):
def __init__(self, fitID, position):
wx.Command.__init__(self, True, 'Remove Fighter')
@@ -28,6 +28,6 @@ class FitRemoveFighterCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing removal of fighter at position {} from fit {}'.format(self.position, self.fitID))
from .localAdd import FitAddFighterCommand
cmd = FitAddFighterCommand(fitID=self.fitID, fighterInfo=self.savedFighterInfo, position=self.position)
from .localAdd import CalcAddLocalFighterCommand
cmd = CalcAddLocalFighterCommand(fitID=self.fitID, fighterInfo=self.savedFighterInfo, position=self.position)
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitAddProjectedFighterCommand(wx.Command):
class CalcAddProjectedFighterCommand(wx.Command):
def __init__(self, fitID, fighterInfo, position=None):
wx.Command.__init__(self, True, 'Add Projected Fighter')
@@ -41,6 +41,6 @@ class FitAddProjectedFighterCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing addition of projected fighter {} onto: {}'.format(self.fighterInfo, self.fitID))
from .projectedRemove import FitRemoveProjectedFighterCommand
cmd = FitRemoveProjectedFighterCommand(fitID=self.fitID, position=self.position)
from .projectedRemove import CalcRemoveProjectedFighterCommand
cmd = CalcRemoveProjectedFighterCommand(fitID=self.fitID, position=self.position)
return cmd.Do()

View File

@@ -1,39 +0,0 @@
import wx
from logbook import Logger
import eos.db
from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeProjectedFighterAmountCommand(wx.Command):
def __init__(self, fitID, position, amount):
wx.Command.__init__(self, True, 'Change Projected Fighter Amount')
self.fitID = fitID
self.position = position
self.amount = amount
self.savedAmount = None
def Do(self):
pyfalog.debug('Doing change of projected fighter amount to {} at position {} on fit {}'.format(self.amount, self.position, self.fitID))
fit = Fit.getInstance().getFit(self.fitID)
fighter = fit.projectedFighters[self.position]
if self.amount == fighter.amount or self.amount == fighter.amountActive:
return False
self.savedAmount = fighter.amount
if self.amount == -1:
fighter.amount = self.amount
eos.db.commit()
return True
else:
fighter.amount = max(min(self.amount, fighter.fighterSquadronMaxSize), 0)
eos.db.commit()
return True
def Undo(self):
pyfalog.debug('Undoing change of projected fighter amount to {} at position {} on fit {}'.format(self.amount, self.position, self.fitID))
cmd = FitChangeProjectedFighterAmountCommand(fitID=self.fitID, position=self.position, amount=self.savedAmount)
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitRemoveProjectedFighterCommand(wx.Command):
class CalcRemoveProjectedFighterCommand(wx.Command):
def __init__(self, fitID, position):
wx.Command.__init__(self, True, 'Add Projected Fighter')
@@ -28,6 +28,6 @@ class FitRemoveProjectedFighterCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing removal of projected fighter at position {} from fit {}'.format(self.position, self.fitID))
from .projectedAdd import FitAddProjectedFighterCommand
cmd = FitAddProjectedFighterCommand(fitID=self.fitID, fighterInfo=self.savedFighterInfo)
from .projectedAdd import CalcAddProjectedFighterCommand
cmd = CalcAddProjectedFighterCommand(fitID=self.fitID, fighterInfo=self.savedFighterInfo)
return cmd.Do()

View File

@@ -1,32 +0,0 @@
import wx
from logbook import Logger
import eos.db
from service.fit import Fit
pyfalog = Logger(__name__)
class FitToggleProjectedFighterStateCommand(wx.Command):
def __init__(self, fitID, position, forceState=None):
wx.Command.__init__(self, True, 'Toggle Projected Fighter State')
self.fitID = fitID
self.position = position
self.forceState = forceState
self.savedState = None
def Do(self):
pyfalog.debug('Doing toggling of projected fighter state at position {} for fit {}'.format(self.position, self.fitID))
fit = Fit.getInstance().getFit(self.fitID)
fighter = fit.projectedFighters[self.position]
self.savedState = fighter.active
fighter.active = not fighter.active if self.forceState is None else self.forceState
eos.db.commit()
return True
def Undo(self):
pyfalog.debug('Undoing toggling of projected fighter state at position {} for fit {}'.format(self.position, self.fitID))
cmd = FitToggleProjectedFighterStateCommand(fitID=self.fitID, position=self.position, forceState=self.savedState)
return cmd.Do()

View File

@@ -8,11 +8,12 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitToggleFighterStateCommand(wx.Command):
class CalcToggleFighterStateCommand(wx.Command):
def __init__(self, fitID, position, forceState=None):
def __init__(self, fitID, projected, position, forceState=None):
wx.Command.__init__(self, True, 'Toggle Fighter State')
self.fitID = fitID
self.projected = projected
self.position = position
self.forceState = forceState
self.savedState = None
@@ -20,7 +21,8 @@ class FitToggleFighterStateCommand(wx.Command):
def Do(self):
pyfalog.debug('Doing toggling of fighter state at position {} for fit {}'.format(self.position, self.fitID))
fit = Fit.getInstance().getFit(self.fitID)
fighter = fit.fighters[self.position]
container = fit.projectedFighters if self.projected else fit.fighters
fighter = container[self.position]
self.savedState = fighter.active
fighter.active = not fighter.active if self.forceState is None else self.forceState
eos.db.commit()
@@ -28,5 +30,5 @@ class FitToggleFighterStateCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing toggling of fighter state at position {} for fit {}'.format(self.position, self.fitID))
cmd = FitToggleFighterStateCommand(fitID=self.fitID, position=self.position, forceState=self.savedState)
cmd = CalcToggleFighterStateCommand(fitID=self.fitID, projected=self.projected, position=self.position, forceState=self.savedState)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitFitRenameCommand(wx.Command):
class CalcFitRenameCommand(wx.Command):
def __init__(self, fitID, name):
wx.Command.__init__(self, True, 'Rename Fit')
@@ -28,5 +28,5 @@ class FitFitRenameCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing renaming of fit {} to {}'.format(self.fitID, self.name))
cmd = FitFitRenameCommand(fitID=self.fitID, name=self.savedName)
cmd = CalcFitRenameCommand(fitID=self.fitID, name=self.savedName)
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitAddImplantCommand(wx.Command):
class CalcAddImplantCommand(wx.Command):
def __init__(self, fitID, implantInfo, position=None):
wx.Command.__init__(self, True, 'Add Implant')
@@ -38,7 +38,7 @@ class FitAddImplantCommand(wx.Command):
fit.implants.insert(self.newPosition, newImplant)
except HandledListActionError:
pyfalog.warning('Failed to insert to list')
cmd = FitAddImplantCommand(fitID=self.fitID, implantInfo=self.oldImplantInfo, position=self.oldPosition)
cmd = CalcAddImplantCommand(fitID=self.fitID, implantInfo=self.oldImplantInfo, position=self.oldPosition)
cmd.Do()
return False
else:
@@ -46,7 +46,7 @@ class FitAddImplantCommand(wx.Command):
fit.implants.append(newImplant)
except HandledListActionError:
pyfalog.warning('Failed to append to list')
cmd = FitAddImplantCommand(fitID=self.fitID, implantInfo=self.oldImplantInfo, position=self.oldPosition)
cmd = CalcAddImplantCommand(fitID=self.fitID, implantInfo=self.oldImplantInfo, position=self.oldPosition)
cmd.Do()
return False
self.newPosition = fit.implants.index(newImplant)
@@ -56,8 +56,8 @@ class FitAddImplantCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undo addition of implant {} to fit {}'.format(self.newImplantInfo, self.fitID))
if self.oldImplantInfo and self.oldPosition:
cmd = FitAddImplantCommand(fitID=self.fitID, implantInfo=self.oldImplantInfo, position=self.oldPosition)
cmd = CalcAddImplantCommand(fitID=self.fitID, implantInfo=self.oldImplantInfo, position=self.oldPosition)
return cmd.Do()
from .remove import FitRemoveImplantCommand
cmd = FitRemoveImplantCommand(fitID=self.fitID, position=self.newPosition)
from .remove import CalcRemoveImplantCommand
cmd = CalcRemoveImplantCommand(fitID=self.fitID, position=self.newPosition)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeImplantLocationCommand(wx.Command):
class CalcChangeImplantLocationCommand(wx.Command):
def __init__(self, fitID, source):
wx.Command.__init__(self, True, 'Change Implant Location')
@@ -25,5 +25,5 @@ class FitChangeImplantLocationCommand(wx.Command):
return True
def Undo(self):
cmd = FitChangeImplantLocationCommand(fitID=self.fitID, source=self.savedSource)
cmd = CalcChangeImplantLocationCommand(fitID=self.fitID, source=self.savedSource)
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitRemoveImplantCommand(wx.Command):
class CalcRemoveImplantCommand(wx.Command):
def __init__(self, fitID, position):
wx.Command.__init__(self, True, 'Remove Implant')
@@ -28,6 +28,6 @@ class FitRemoveImplantCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing removal of implant {} on fit {}'.format(self.savedImplantInfo, self.fitID))
from .add import FitAddImplantCommand
cmd = FitAddImplantCommand(fitID=self.fitID, implantInfo=self.savedImplantInfo, position=self.position)
from .add import CalcAddImplantCommand
cmd = CalcAddImplantCommand(fitID=self.fitID, implantInfo=self.savedImplantInfo, position=self.position)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitToggleImplantStateCommand(wx.Command):
class CalcToggleImplantStateCommand(wx.Command):
def __init__(self, fitID, position, forceState=None):
wx.Command.__init__(self, True, 'Toggle Implant State')
@@ -28,5 +28,5 @@ class FitToggleImplantStateCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing toggling of implant state at position {} for fit {}'.format(self.position, self.fitID))
cmd = FitToggleImplantStateCommand(fitID=self.fitID, position=self.position, forceState=self.savedState)
cmd = CalcToggleImplantStateCommand(fitID=self.fitID, position=self.position, forceState=self.savedState)
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.market import Market
pyfalog = Logger(__name__)
class FitRebaseItemCommand(wx.Command):
class CalcRebaseItemCommand(wx.Command):
def __init__(self, fitID, containerName, position, itemID, commit=True):
wx.Command.__init__(self, True, 'Rebase Item')
@@ -39,5 +39,5 @@ class FitRebaseItemCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing rebase of item in {} at position {} to {}'.format(self.containerName, self.position, self.itemID))
cmd = FitRebaseItemCommand(fitID=self.fitID, containerName=self.containerName, position=self.position, itemID=self.savedItemID)
cmd = CalcRebaseItemCommand(fitID=self.fitID, containerName=self.containerName, position=self.position, itemID=self.savedItemID)
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.market import Market
pyfalog = Logger(__name__)
class FitChangeModuleChargesCommand(wx.Command):
class CalcChangeModuleChargesCommand(wx.Command):
def __init__(self, fitID, chargeMap, projected=False):
wx.Command.__init__(self, True, 'Change Module Charges')
@@ -50,5 +50,5 @@ class FitChangeModuleChargesCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing change of module charges according to map {} on fit {}'.format(self.chargeMap, self.fitID))
cmd = FitChangeModuleChargesCommand(fitID=self.fitID, chargeMap=self.savedChargeMap, projected=self.projected)
cmd = CalcChangeModuleChargesCommand(fitID=self.fitID, chargeMap=self.savedChargeMap, projected=self.projected)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeModuleSpoolCommand(wx.Command):
class CalcChangeModuleSpoolCommand(wx.Command):
def __init__(self, fitID, position, spoolType, spoolAmount, projected=False):
wx.Command.__init__(self, True, 'Change Module Spool')
@@ -39,7 +39,7 @@ class FitChangeModuleSpoolCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing change of module spoolup at position {} to {} type {} amount on fit {}'.format(self.position, self.spoolType, self.spoolAmount, self.fitID))
cmd = FitChangeModuleSpoolCommand(
cmd = CalcChangeModuleSpoolCommand(
fitID=self.fitID,
position=self.position,
spoolType=self.savedSpoolType,

View File

@@ -10,7 +10,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitAddModuleCommand(wx.Command):
class CalcAddLocalModuleCommand(wx.Command):
def __init__(self, fitID, newModInfo):
wx.Command.__init__(self, True, 'Add Module')
@@ -20,7 +20,7 @@ class FitAddModuleCommand(wx.Command):
self.subsystemCmd = None
def Do(self):
pyfalog.debug('Doing addition of module {} to fit {}'.format(self.newModInfo, self.fitID))
pyfalog.debug('Doing addition of local module {} to fit {}'.format(self.newModInfo, self.fitID))
sFit = Fit.getInstance()
fit = sFit.getFit(self.fitID)
@@ -32,8 +32,8 @@ class FitAddModuleCommand(wx.Command):
if newMod.item.category.name == 'Subsystem':
for oldMod in fit.modules:
if oldMod.getModifiedItemAttr('subSystemSlot') == newMod.getModifiedItemAttr('subSystemSlot') and newMod.slot == oldMod.slot:
from .localReplace import FitReplaceModuleCommand
self.subsystemCmd = FitReplaceModuleCommand(fitID=self.fitID, position=oldMod.modPosition, newModInfo=self.newModInfo)
from .localReplace import CalcReplaceLocalModuleCommand
self.subsystemCmd = CalcReplaceLocalModuleCommand(fitID=self.fitID, position=oldMod.modPosition, newModInfo=self.newModInfo)
return self.subsystemCmd.Do()
if not newMod.fits(fit):
@@ -53,12 +53,12 @@ class FitAddModuleCommand(wx.Command):
return True
def Undo(self):
pyfalog.debug('Undoing addition of module {} to fit {}'.format(self.newModInfo, self.fitID))
pyfalog.debug('Undoing addition of local module {} to fit {}'.format(self.newModInfo, self.fitID))
# We added a subsystem module, which actually ran the replace command. Run the undo for that guy instead
if self.subsystemCmd is not None:
return self.subsystemCmd.Undo()
from .localRemove import FitRemoveModuleCommand
from .localRemove import CalcRemoveLocalModuleCommand
if self.savedPosition is None:
return False
cmd = FitRemoveModuleCommand(fitID=self.fitID, positions=[self.savedPosition])
cmd = CalcRemoveLocalModuleCommand(fitID=self.fitID, positions=[self.savedPosition])
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeModuleStatesCommand(wx.Command):
class CalcChangeLocalModuleStatesCommand(wx.Command):
def __init__(self, fitID, mainPosition, positions, click):
wx.Command.__init__(self, True, 'Change Module States')
@@ -20,7 +20,7 @@ class FitChangeModuleStatesCommand(wx.Command):
self.savedStates = {}
def Do(self):
pyfalog.debug('Doing change of module states at position {}/{} to click {} on fit {}'.format(self.mainPosition, self.positions, self.click, self.fitID))
pyfalog.debug('Doing change of local module states at position {}/{} to click {} on fit {}'.format(self.mainPosition, self.positions, self.click, self.fitID))
sFit = Fit.getInstance()
fit = sFit.getFit(self.fitID)
mainMod = fit.modules[self.mainPosition]
@@ -49,7 +49,7 @@ class FitChangeModuleStatesCommand(wx.Command):
return True
def Undo(self):
pyfalog.debug('Undoing change of module states at position {}/{} to click {} on fit {}'.format(self.mainPosition, self.positions, self.click, self.fitID))
pyfalog.debug('Undoing change of local module states at position {}/{} to click {} on fit {}'.format(self.mainPosition, self.positions, self.click, self.fitID))
fit = Fit.getInstance().getFit(self.fitID)
for position, state in self.savedStates.items():
mod = fit.modules[position]

View File

@@ -11,7 +11,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitCloneModuleCommand(wx.Command):
class CalcCloneLocalModuleCommand(wx.Command):
def __init__(self, fitID, srcPosition, dstPosition):
wx.Command.__init__(self, True, 'Clone Module')
@@ -21,7 +21,7 @@ class FitCloneModuleCommand(wx.Command):
self.dstModInfo = None
def Do(self):
pyfalog.debug('Doing cloning from position {} to position {} for fit ID {}'.format(self.srcPosition, self.dstPosition, self.fitID))
pyfalog.debug('Doing cloning of local module from position {} to position {} for fit ID {}'.format(self.srcPosition, self.dstPosition, self.fitID))
sFit = Fit.getInstance()
fit = sFit.getFit(self.fitID)
srcMod = fit.modules[self.srcPosition]
@@ -42,7 +42,7 @@ class FitCloneModuleCommand(wx.Command):
return True
def Undo(self):
pyfalog.debug('Undoing cloning from position {} to position {} for fit ID {}'.format(self.srcPosition, self.dstPosition, self.fitID))
from .localRemove import FitRemoveModuleCommand
cmd = FitRemoveModuleCommand(fitID=self.fitID, positions=[self.dstPosition])
pyfalog.debug('Undoing cloning of local module from position {} to position {} for fit ID {}'.format(self.srcPosition, self.dstPosition, self.fitID))
from .localRemove import CalcRemoveLocalModuleCommand
cmd = CalcRemoveLocalModuleCommand(fitID=self.fitID, positions=[self.dstPosition])
return cmd.Do()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitRemoveModuleCommand(wx.Command):
class CalcRemoveLocalModuleCommand(wx.Command):
def __init__(self, fitID, positions):
wx.Command.__init__(self, True, 'Remove Module')
@@ -18,7 +18,7 @@ class FitRemoveModuleCommand(wx.Command):
self.savedModInfos = {}
def Do(self):
pyfalog.debug('Doing removal of modules from positions {} on fit {}'.format(self.positions, self.fitID))
pyfalog.debug('Doing removal of local modules from positions {} on fit {}'.format(self.positions, self.fitID))
fit = Fit.getInstance().getFit(self.fitID)
for position in self.positions:
@@ -35,10 +35,10 @@ class FitRemoveModuleCommand(wx.Command):
return True
def Undo(self):
pyfalog.debug('Undoing removal of modules {} on fit {}'.format(self.savedModInfos, self.fitID))
pyfalog.debug('Undoing removal of local modules {} on fit {}'.format(self.savedModInfos, self.fitID))
results = []
from .localReplace import FitReplaceModuleCommand
from .localReplace import CalcReplaceLocalModuleCommand
for position, modInfo in self.savedModInfos.items():
cmd = FitReplaceModuleCommand(fitID=self.fitID, position=position, newModInfo=modInfo)
cmd = CalcReplaceLocalModuleCommand(fitID=self.fitID, position=position, newModInfo=modInfo)
results.append(cmd.Do())
return any(results)

View File

@@ -10,7 +10,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitReplaceModuleCommand(wx.Command):
class CalcReplaceLocalModuleCommand(wx.Command):
def __init__(self, fitID, position, newModInfo):
wx.Command.__init__(self, True, 'Replace Module')
@@ -20,7 +20,7 @@ class FitReplaceModuleCommand(wx.Command):
self.oldModInfo = None
def Do(self):
pyfalog.debug('Doing replacement of module at position {} to {} on fit {}'.format(self.newModInfo, self.position, self.fitID))
pyfalog.debug('Doing replacement of local module at position {} to {} on fit {}'.format(self.newModInfo, self.position, self.fitID))
sFit = Fit.getInstance()
fit = sFit.getFit(self.fitID)
oldMod = fit.modules[self.position]
@@ -49,11 +49,11 @@ class FitReplaceModuleCommand(wx.Command):
return True
def Undo(self):
pyfalog.debug('Undoing replacement of module at position {} to {} on fit {}'.format(self.newModInfo, self.position, self.fitID))
pyfalog.debug('Undoing replacement of local module at position {} to {} on fit {}'.format(self.newModInfo, self.position, self.fitID))
# Remove if there was no module
if self.oldModInfo is None:
from .localRemove import FitRemoveModuleCommand
cmd = FitRemoveModuleCommand(fitID=self.fitID, positions=[self.position])
from .localRemove import CalcRemoveLocalModuleCommand
cmd = CalcRemoveLocalModuleCommand(fitID=self.fitID, positions=[self.position])
return cmd.Do()
# Replace if there was
sFit = Fit.getInstance()

View File

@@ -9,7 +9,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitSwapModuleCommand(wx.Command):
class CalcSwapLocalModuleCommand(wx.Command):
def __init__(self, fitID, position1, position2):
wx.Command.__init__(self, True, 'Swap Modules')

View File

@@ -10,7 +10,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitAddProjectedModuleCommand(wx.Command):
class CalcAddProjectedModuleCommand(wx.Command):
def __init__(self, fitID, modInfo, position=None):
wx.Command.__init__(self, True)
@@ -52,8 +52,8 @@ class FitAddProjectedModuleCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing addition of projected module {} onto: {}'.format(self.newModInfo, self.fitID))
if self.oldPosition is not None and self.oldModInfo is not None:
cmd = FitAddProjectedModuleCommand(fitID=self.fitID, modInfo=self.oldModInfo, position=self.oldPosition)
cmd = CalcAddProjectedModuleCommand(fitID=self.fitID, modInfo=self.oldModInfo, position=self.oldPosition)
return cmd.Do()
from .projectedRemove import FitRemoveProjectedModuleCommand
cmd = FitRemoveProjectedModuleCommand(self.fitID, self.newPosition)
from .projectedRemove import CalcRemoveProjectedModuleCommand
cmd = CalcRemoveProjectedModuleCommand(self.fitID, self.newPosition)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeProjectedModuleStateCommand(wx.Command):
class CalcChangeProjectedModuleStateCommand(wx.Command):
def __init__(self, fitID, position, click):
wx.Command.__init__(self, True, 'Change Projected Module State')

View File

@@ -9,7 +9,7 @@ from gui.fitCommands.helpers import ModuleInfo
pyfalog = Logger(__name__)
class FitRemoveProjectedModuleCommand(wx.Command):
class CalcRemoveProjectedModuleCommand(wx.Command):
def __init__(self, fitID, position):
wx.Command.__init__(self, True)
@@ -28,6 +28,6 @@ class FitRemoveProjectedModuleCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing removal of projected module {} on fit {}'.format(self.savedModInfo, self.fitID))
from .projectedAdd import FitAddProjectedModuleCommand
cmd = FitAddProjectedModuleCommand(fitID=self.fitID, modInfo=self.savedModInfo, position=self.position)
from .projectedAdd import CalcAddProjectedModuleCommand
cmd = CalcAddProjectedModuleCommand(fitID=self.fitID, modInfo=self.savedModInfo, position=self.position)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitAddProjectedFitCommand(wx.Command):
class CalcAddProjectedFitCommand(wx.Command):
def __init__(self, fitID, projectedFitID, state):
wx.Command.__init__(self, True, 'Add Projected Fit')
@@ -54,6 +54,6 @@ class FitAddProjectedFitCommand(wx.Command):
projectedFit = Fit.getInstance().getFit(self.projectedFitID)
if projectedFit is None:
return True
from .remove import FitRemoveProjectedFitCommand
cmd = FitRemoveProjectedFitCommand(fitID=self.fitID, projectedFitID=self.projectedFitID)
from .remove import CalcRemoveProjectedFitCommand
cmd = CalcRemoveProjectedFitCommand(fitID=self.fitID, projectedFitID=self.projectedFitID)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeProjectedFitAmountCommand(wx.Command):
class CalcChangeProjectedFitAmountCommand(wx.Command):
def __init__(self, fitID, projectedFitID, amount):
wx.Command.__init__(self, True, 'Change Projected Fit Amount')
@@ -39,5 +39,5 @@ class FitChangeProjectedFitAmountCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing change of projected fit {} amount to {} for fit {}'.format(self.projectedFitID, self.amount, self.fitID))
cmd = FitChangeProjectedFitAmountCommand(fitID=self.fitID, projectedFitID=self.projectedFitID, amount=self.savedAmount)
cmd = CalcChangeProjectedFitAmountCommand(fitID=self.fitID, projectedFitID=self.projectedFitID, amount=self.savedAmount)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitRemoveProjectedFitCommand(wx.Command):
class CalcRemoveProjectedFitCommand(wx.Command):
def __init__(self, fitID, projectedFitID):
wx.Command.__init__(self, True, 'Add Projected Fit')
@@ -38,6 +38,6 @@ class FitRemoveProjectedFitCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing removal of projected fit {} for fit {}'.format(self.projectedFitID, self.fitID))
from .add import FitAddProjectedFitCommand
cmd = FitAddProjectedFitCommand(fitID=self.fitID, projectedFitID=self.projectedFitID, state=self.savedState)
from .add import CalcAddProjectedFitCommand
cmd = CalcAddProjectedFitCommand(fitID=self.fitID, projectedFitID=self.projectedFitID, state=self.savedState)
return cmd.Do()

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitToggleProjectedFitCommand(wx.Command):
class CalcToggleProjectedFitCommand(wx.Command):
def __init__(self, fitID, projectedFitID, forceState=None):
wx.Command.__init__(self, True, 'Toggle Projected Fit State')
@@ -35,5 +35,5 @@ class FitToggleProjectedFitCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing toggling of projected fit {} state for fit {}'.format(self.projectedFitID, self.fitID))
cmd = FitToggleProjectedFitCommand(fitID=self.fitID, projectedFitID=self.projectedFitID, forceState=self.savedState)
cmd = CalcToggleProjectedFitCommand(fitID=self.fitID, projectedFitID=self.projectedFitID, forceState=self.savedState)
return cmd.Do()

View File

@@ -10,7 +10,7 @@ from service.market import Market
pyfalog = Logger(__name__)
class FitChangeShipModeCommand(wx.Command):
class CalcChangeShipModeCommand(wx.Command):
def __init__(self, fitID, itemID):
wx.Command.__init__(self, True, 'Set Mode')
@@ -30,5 +30,5 @@ class FitChangeShipModeCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing changing mode to {} for fit {}'.format(self.itemID, self.fitID))
cmd = FitChangeShipModeCommand(self.fitID, self.savedItemID)
cmd = CalcChangeShipModeCommand(self.fitID, self.savedItemID)
return cmd.Do()

View File

@@ -4,7 +4,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import BoosterInfo
from .calc.booster.add import FitAddBoosterCommand
from .calc.booster.add import CalcAddBoosterCommand
class GuiAddBoosterCommand(wx.Command):
@@ -18,7 +18,7 @@ class GuiAddBoosterCommand(wx.Command):
self.itemID = itemID
def Do(self):
if self.internal_history.Submit(FitAddBoosterCommand(fitID=self.fitID, boosterInfo=BoosterInfo(itemID=self.itemID))):
if self.internal_history.Submit(CalcAddBoosterCommand(fitID=self.fitID, boosterInfo=BoosterInfo(itemID=self.itemID))):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -4,7 +4,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import CargoInfo
from .calc.cargo.add import FitAddCargoCommand
from .calc.cargo.add import CalcAddCargoCommand
class GuiAddCargoCommand(wx.Command):
@@ -19,7 +19,7 @@ class GuiAddCargoCommand(wx.Command):
self.amount = amount
def Do(self):
if self.internal_history.Submit(FitAddCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=self.itemID, amount=self.amount))):
if self.internal_history.Submit(CalcAddCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=self.itemID, amount=self.amount))):
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True
return False

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.module.changeCharges import FitChangeModuleChargesCommand
from .calc.module.changeCharges import CalcChangeModuleChargesCommand
class GuiModuleAddChargeCommand(wx.Command):
@@ -18,7 +18,7 @@ class GuiModuleAddChargeCommand(wx.Command):
self.projected = modules[0].isProjected
def Do(self):
if self.internal_history.Submit(FitChangeModuleChargesCommand(self.fitID, {p: self.itemID for p in self.positions}, self.projected)):
if self.internal_history.Submit(CalcChangeModuleChargesCommand(self.fitID, {p: self.itemID for p in self.positions}, self.projected)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.commandFit.add import FitAddCommandCommand
from .calc.commandFit.add import CalcAddCommandCommand
class GuiAddCommandCommand(wx.Command):
@@ -16,7 +16,7 @@ class GuiAddCommandCommand(wx.Command):
self.commandFitID = commandFitID
def Do(self):
if self.internal_history.Submit(FitAddCommandCommand(self.fitID, self.commandFitID, None)):
if self.internal_history.Submit(CalcAddCommandCommand(self.fitID, self.commandFitID, None)):
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
self.sFit.recalc(self.fitID)
return True

View File

@@ -4,7 +4,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import DroneInfo
from .calc.drone.localAdd import FitAddDroneCommand
from .calc.drone.localAdd import CalcAddLocalDroneCommand
class GuiAddDroneCommand(wx.Command):
@@ -17,7 +17,7 @@ class GuiAddDroneCommand(wx.Command):
self.itemID = itemID
def Do(self):
cmd = FitAddDroneCommand(fitID=self.fitID, droneInfo=DroneInfo(itemID=self.itemID, amount=1, amountActive=0))
cmd = CalcAddLocalDroneCommand(fitID=self.fitID, droneInfo=DroneInfo(itemID=self.itemID, amount=1, amountActive=0))
if self.internal_history.Submit(cmd):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))

View File

@@ -4,7 +4,7 @@ import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import FighterInfo
from service.fit import Fit
from .calc.fighter.localAdd import FitAddFighterCommand
from .calc.fighter.localAdd import CalcAddLocalFighterCommand
class GuiAddFighterCommand(wx.Command):
@@ -15,7 +15,7 @@ class GuiAddFighterCommand(wx.Command):
self.itemID = itemID
def Do(self):
if self.internal_history.Submit(FitAddFighterCommand(fitID=self.fitID, fighterInfo=FighterInfo(itemID=self.itemID))):
if self.internal_history.Submit(CalcAddLocalFighterCommand(fitID=self.fitID, fighterInfo=FighterInfo(itemID=self.itemID))):
Fit.getInstance().recalc(self.fitID)
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -5,8 +5,8 @@ import gui.mainFrame
from eos.const import ImplantLocation
from gui import globalEvents as GE
from gui.fitCommands.helpers import ImplantInfo
from .calc.implant.add import FitAddImplantCommand
from .calc.implant.changeLocation import FitChangeImplantLocationCommand
from .calc.implant.add import CalcAddImplantCommand
from .calc.implant.changeLocation import CalcChangeImplantLocationCommand
class GuiAddImplantCommand(wx.Command):
@@ -20,8 +20,8 @@ class GuiAddImplantCommand(wx.Command):
def Do(self):
if (
self.internal_history.Submit(FitAddImplantCommand(fitID=self.fitID, implantInfo=ImplantInfo(itemID=self.itemID))) and
self.internal_history.Submit(FitChangeImplantLocationCommand(self.fitID, ImplantLocation.FIT))
self.internal_history.Submit(CalcAddImplantCommand(fitID=self.fitID, implantInfo=ImplantInfo(itemID=self.itemID))) and
self.internal_history.Submit(CalcChangeImplantLocationCommand(self.fitID, ImplantLocation.FIT))
):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))

View File

@@ -6,9 +6,9 @@ from service.market import Market
from service.fit import Fit
from gui import globalEvents as GE
from gui.fitCommands.helpers import ModuleInfo
from .calc.module.localAdd import FitAddModuleCommand
from .calc.module.localReplace import FitReplaceModuleCommand
from .calc.module.changeCharges import FitChangeModuleChargesCommand
from .calc.module.localAdd import CalcAddLocalModuleCommand
from .calc.module.localReplace import CalcReplaceLocalModuleCommand
from .calc.module.changeCharges import CalcChangeModuleChargesCommand
pyfalog = Logger(__name__)
@@ -38,14 +38,14 @@ class GuiModuleAddCommand(wx.Command):
# Charge
if item.isCharge and self.position is not None:
pyfalog.debug("Trying to add a charge")
success = self.internalHistory.Submit(FitChangeModuleChargesCommand(self.fitID, {self.position: self.itemID}))
success = self.internalHistory.Submit(CalcChangeModuleChargesCommand(self.fitID, {self.position: self.itemID}))
if not success:
pyfalog.debug(" Failed")
return False # if it's a charge item and this failed, nothing more we can try.
# Module to position
elif self.position is not None:
pyfalog.debug("Trying to add a module to a specific position")
success = self.internalHistory.Submit(FitReplaceModuleCommand(
success = self.internalHistory.Submit(CalcReplaceLocalModuleCommand(
fitID=self.fitID,
position=self.position,
newModInfo=ModuleInfo(itemID=self.itemID)))
@@ -56,7 +56,7 @@ class GuiModuleAddCommand(wx.Command):
# Module without position
if self.position is None:
pyfalog.debug("Trying to append a module")
success = self.internalHistory.Submit(FitAddModuleCommand(
success = self.internalHistory.Submit(CalcAddLocalModuleCommand(
fitID=self.fitID,
newModInfo=ModuleInfo(itemID=self.itemID)))

View File

@@ -4,10 +4,10 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import ModuleInfo, DroneInfo, FighterInfo
from .calc.module.projectedAdd import FitAddProjectedModuleCommand
from .calc.projectedFit.add import FitAddProjectedFitCommand
from .calc.fighter.projectedAdd import FitAddProjectedFighterCommand
from .calc.drone.projectedAdd import FitAddProjectedDroneCommand
from .calc.module.projectedAdd import CalcAddProjectedModuleCommand
from .calc.projectedFit.add import CalcAddProjectedFitCommand
from .calc.fighter.projectedAdd import CalcAddProjectedFighterCommand
from .calc.drone.projectedAdd import CalcAddProjectedDroneCommand
from logbook import Logger
import eos.db
pyfalog = Logger(__name__)
@@ -31,17 +31,17 @@ class GuiAddProjectedCommand(wx.Command):
item = eos.db.getItem(self.id, eager=("attributes", "group.category"))
if item.category.name == "Drone":
result = self.internal_history.Submit(FitAddProjectedDroneCommand(
result = self.internal_history.Submit(CalcAddProjectedDroneCommand(
fitID=self.fitID,
droneInfo=DroneInfo(itemID=self.id, amount=1, amountActive=1)))
elif item.category.name == "Fighter":
result = self.internal_history.Submit(FitAddProjectedFighterCommand(self.fitID, fighterInfo=FighterInfo(itemID=self.id)))
result = self.internal_history.Submit(CalcAddProjectedFighterCommand(self.fitID, fighterInfo=FighterInfo(itemID=self.id)))
else:
result = self.internal_history.Submit(FitAddProjectedModuleCommand(
result = self.internal_history.Submit(CalcAddProjectedModuleCommand(
fitID=self.fitID,
modInfo=ModuleInfo(itemID=self.id)))
elif self.type == 'fit':
result = self.internal_history.Submit(FitAddProjectedFitCommand(self.fitID, self.id, None))
result = self.internal_history.Submit(CalcAddProjectedFitCommand(self.fitID, self.id, None))
if result:
self.sFit.recalc(self.fitID)

View File

@@ -3,11 +3,11 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.calc.module.changeCharges import FitChangeModuleChargesCommand
from gui.fitCommands.calc.module.localReplace import FitReplaceModuleCommand
from gui.fitCommands.calc.cargo.remove import FitRemoveCargoCommand
from gui.fitCommands.calc.module.changeCharges import CalcChangeModuleChargesCommand
from gui.fitCommands.calc.module.localReplace import CalcReplaceLocalModuleCommand
from gui.fitCommands.calc.cargo.remove import CalcRemoveCargoCommand
from gui.fitCommands.helpers import ModuleInfo
from .calc.cargo.add import FitAddCargoCommand
from .calc.cargo.add import CalcAddCargoCommand
from logbook import Logger
pyfalog = Logger(__name__)
@@ -40,12 +40,12 @@ class GuiCargoToModuleCommand(wx.Command):
# We're trying to move a charge from cargo to a slot. Use SetCharge command (don't respect move vs copy)
if sFit.isAmmo(cargo.itemID):
result = self.internal_history.Submit(FitChangeModuleChargesCommand(self.fitID, {module.modPosition: cargo.itemID}))
result = self.internal_history.Submit(CalcChangeModuleChargesCommand(self.fitID, {module.modPosition: cargo.itemID}))
else:
pyfalog.debug("Moving cargo item to module for fit ID: {0}", self.fitID)
self.addCmd = FitReplaceModuleCommand(
self.addCmd = CalcReplaceLocalModuleCommand(
fitID=self.fitID,
position=module.modPosition,
newModInfo=ModuleInfo(itemID=cargo.itemID))
@@ -58,14 +58,14 @@ class GuiCargoToModuleCommand(wx.Command):
if self.addCmd.old_module is not None:
# we're swapping with an existing module, so remove cargo and add module
self.removeCmd = FitRemoveCargoCommand(self.fitID, cargo.itemID)
self.removeCmd = CalcRemoveCargoCommand(self.fitID, cargo.itemID)
result = self.internal_history.Submit(self.removeCmd)
self.addCargoCmd = FitAddCargoCommand(self.fitID, self.addCmd.old_module.itemID)
self.addCargoCmd = CalcAddCargoCommand(self.fitID, self.addCmd.old_module.itemID)
result = self.internal_history.Submit(self.addCargoCmd)
elif not self.copy:
# move, not copying, so remove cargo
self.removeCmd = FitRemoveCargoCommand(self.fitID, cargo.itemID)
self.removeCmd = CalcRemoveCargoCommand(self.fitID, cargo.itemID)
result = self.internal_history.Submit(self.removeCmd)
if result:

View File

@@ -1,7 +1,7 @@
import wx
import gui.mainFrame
from gui import globalEvents as GE
from .calc.cargo.changeAmount import FitChangeCargoAmountCommand
from .calc.cargo.changeAmount import CalcChangeCargoAmountCommand
from service.fit import Fit
from gui.fitCommands.helpers import CargoInfo
from logbook import Logger
@@ -20,7 +20,7 @@ class GuiChangeCargoQty(wx.Command):
self.internal_history = wx.CommandProcessor()
def Do(self):
cmd = FitChangeCargoAmountCommand(self.fitID, CargoInfo(itemID=self.itemID, amount=self.amount))
cmd = CalcChangeCargoAmountCommand(self.fitID, CargoInfo(itemID=self.itemID, amount=self.amount))
if self.internal_history.Submit(cmd):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))

View File

@@ -1,7 +1,7 @@
import wx
import gui.mainFrame
from gui import globalEvents as GE
from .calc.drone.localChangeAmount import FitChangeDroneAmountCommand
from .calc.drone.localChangeAmount import CalcChangeLocalDroneAmountCommand
from service.fit import Fit
from logbook import Logger
pyfalog = Logger(__name__)
@@ -18,7 +18,7 @@ class GuiChangeDroneQty(wx.Command):
self.internal_history = wx.CommandProcessor()
def Do(self):
cmd = FitChangeDroneAmountCommand(self.fitID, self.position, self.amount)
cmd = CalcChangeLocalDroneAmountCommand(self.fitID, self.position, self.amount)
if self.internal_history.Submit(cmd):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))

View File

@@ -1,7 +1,7 @@
import wx
import gui.mainFrame
from gui import globalEvents as GE
from .calc.fighter.localChangeAmount import FitChangeFighterAmountCommand
from .calc.fighter.changeAmount import CalcChangeFighterAmountCommand
from service.fit import Fit
from logbook import Logger
pyfalog = Logger(__name__)
@@ -18,7 +18,7 @@ class GuiChangeFighterQty(wx.Command):
self.internal_history = wx.CommandProcessor()
def Do(self):
cmd = FitChangeFighterAmountCommand(self.fitID, self.position, self.amount)
cmd = CalcChangeFighterAmountCommand(self.fitID, False, self.position, self.amount)
if self.internal_history.Submit(cmd):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.implant.changeLocation import FitChangeImplantLocationCommand
from .calc.implant.changeLocation import CalcChangeImplantLocationCommand
class GuiChangeImplantLocation(wx.Command):
@@ -16,7 +16,7 @@ class GuiChangeImplantLocation(wx.Command):
self.source = source
def Do(self):
if self.internal_history.Submit(FitChangeImplantLocationCommand(self.fitID, self.source)):
if self.internal_history.Submit(CalcChangeImplantLocationCommand(self.fitID, self.source)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -1,7 +1,7 @@
import wx
import gui.mainFrame
from gui import globalEvents as GE
from .calc.drone.projectedChangeAmount import FitChangeProjectedDroneAmountCommand
from .calc.drone.projectedChangeAmount import CalcChangeProjectedDroneAmountCommand
from service.fit import Fit
from logbook import Logger
pyfalog = Logger(__name__)
@@ -18,7 +18,7 @@ class GuiChangeProjectedDroneQty(wx.Command):
self.internal_history = wx.CommandProcessor()
def Do(self):
cmd = FitChangeProjectedDroneAmountCommand(self.fitID, self.itemID, self.amount)
cmd = CalcChangeProjectedDroneAmountCommand(self.fitID, self.itemID, self.amount)
if self.internal_history.Submit(cmd):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))

View File

@@ -1,7 +1,7 @@
import wx
import gui.mainFrame
from gui import globalEvents as GE
from .calc.fighter.projectedChangeAmount import FitChangeProjectedFighterAmountCommand
from .calc.fighter.changeAmount import CalcChangeFighterAmountCommand
from service.fit import Fit
from logbook import Logger
pyfalog = Logger(__name__)
@@ -19,7 +19,7 @@ class GuiChangeProjectedFighterAmount(wx.Command):
self.internal_history = wx.CommandProcessor()
def Do(self):
cmd = FitChangeProjectedFighterAmountCommand(self.fitID, self.position, self.amount)
cmd = CalcChangeFighterAmountCommand(self.fitID, True, self.position, self.amount)
if self.internal_history.Submit(cmd):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))

View File

@@ -1,7 +1,7 @@
import wx
import gui.mainFrame
from gui import globalEvents as GE
from .calc.projectedFit.changeAmount import FitChangeProjectedFitAmountCommand
from .calc.projectedFit.changeAmount import CalcChangeProjectedFitAmountCommand
from service.fit import Fit
from logbook import Logger
pyfalog = Logger(__name__)
@@ -18,7 +18,7 @@ class GuiChangeProjectedFitQty(wx.Command):
self.internal_history = wx.CommandProcessor()
def Do(self):
cmd = FitChangeProjectedFitAmountCommand(self.fitID, self.pfitID, self.amount)
cmd = CalcChangeProjectedFitAmountCommand(self.fitID, self.pfitID, self.amount)
if self.internal_history.Submit(cmd):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))

View File

@@ -5,7 +5,7 @@ import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import ModuleInfo
from service.fit import Fit
from .calc.module.localAdd import FitAddModuleCommand
from .calc.module.localAdd import CalcAddLocalModuleCommand
pyfalog = Logger(__name__)
@@ -34,7 +34,7 @@ class GuiFillWithModuleCommand(wx.Command):
pyfalog.debug("{} Do()".format(self))
pyfalog.debug("Trying to append a module")
added_modules = 0
while self.internal_history.Submit(FitAddModuleCommand(fitID=self.fitID, newModInfo=ModuleInfo(itemID=self.itemID))):
while self.internal_history.Submit(CalcAddLocalModuleCommand(fitID=self.fitID, newModInfo=ModuleInfo(itemID=self.itemID))):
added_modules += 1
if added_modules > 0:

View File

@@ -1,6 +1,6 @@
import wx
import gui.mainFrame
from .calc.fitRename import FitFitRenameCommand
from .calc.fitRename import CalcFitRenameCommand
from service.fit import Fit
from logbook import Logger
from gui.builtinShipBrowser.events import FitRenamed
@@ -17,7 +17,7 @@ class GuiFitRenameCommand(wx.Command):
self.internal_history = wx.CommandProcessor()
def Do(self):
if self.internal_history.Submit(FitFitRenameCommand(self.fitID, self.newName)):
if self.internal_history.Submit(CalcFitRenameCommand(self.fitID, self.newName)):
wx.PostEvent(self.mainFrame, FitRenamed(fitID=self.fitID))
return True
return False

View File

@@ -5,7 +5,7 @@ import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import ModuleInfo
from service.fit import Fit
from .calc.module.localAdd import FitAddModuleCommand
from .calc.module.localAdd import CalcAddLocalModuleCommand
pyfalog = Logger(__name__)
@@ -26,7 +26,7 @@ class GuiImportMutatedModuleCommand(wx.Command):
def Do(self):
pyfalog.debug("{} Do()".format(self))
if self.internalHistory.Submit(FitAddModuleCommand(fitID=self.fitID, newModInfo=self.newModInfo)):
if self.internalHistory.Submit(CalcAddLocalModuleCommand(fitID=self.fitID, newModInfo=self.newModInfo)):
Fit.getInstance().recalc(self.fitID)
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID, action="modadd"))
return True

View File

@@ -4,15 +4,15 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import ModuleInfo, FighterInfo, BoosterInfo
from .calc.implant.remove import FitRemoveImplantCommand
from .calc.implant.add import FitAddImplantCommand
from .calc.booster.add import FitAddBoosterCommand
from .calc.cargo.remove import FitRemoveCargoCommand
from .calc.cargo.add import FitAddCargoCommand
from .calc.module.localReplace import FitReplaceModuleCommand
from .calc.fighter.localAdd import FitAddFighterCommand
from .calc.fighter.localRemove import FitRemoveFighterCommand
from .calc.itemRebase import FitRebaseItemCommand
from .calc.implant.remove import CalcRemoveImplantCommand
from .calc.implant.add import CalcAddImplantCommand
from .calc.booster.add import CalcAddBoosterCommand
from .calc.cargo.remove import CalcRemoveCargoCommand
from .calc.cargo.add import CalcAddCargoCommand
from .calc.module.localReplace import CalcReplaceLocalModuleCommand
from .calc.fighter.localAdd import CalcAddLocalFighterCommand
from .calc.fighter.localRemove import CalcRemoveLocalFighterCommand
from .calc.itemRebase import CalcRebaseItemCommand
class GuiMetaSwapCommand(wx.Command):
@@ -30,28 +30,28 @@ class GuiMetaSwapCommand(wx.Command):
if context == 'fittingModule':
for x in selection:
position = fit.modules.index(x)
self.data.append(((FitReplaceModuleCommand, fitID, position, ModuleInfo(
self.data.append(((CalcReplaceLocalModuleCommand, fitID, position, ModuleInfo(
itemID=itemID, chargeID=x.chargeID, state=x.state, spoolType=x.spoolType, spoolAmount=x.spoolAmount)),))
elif context == 'implantItem':
for x in selection:
idx = fit.implants.index(x)
state = x.active
self.data.append(((FitRemoveImplantCommand, fitID, idx), (FitAddImplantCommand, fitID, itemID, state)))
self.data.append(((CalcRemoveImplantCommand, fitID, idx), (CalcAddImplantCommand, fitID, itemID, state)))
elif context == 'boosterItem':
for x in selection:
self.data.append(((FitAddBoosterCommand, fitID, BoosterInfo(
self.data.append(((CalcAddBoosterCommand, fitID, BoosterInfo(
itemID=itemID, state=x.active, sideEffects={se.effectID: se.active for se in x.sideEffects})),))
elif context == 'cargoItem':
for x in selection:
self.data.append(((FitRemoveCargoCommand, fitID, x.itemID, 1, True), (FitAddCargoCommand, fitID, itemID, x.amount)))
self.data.append(((CalcRemoveCargoCommand, fitID, x.itemID, 1, True), (CalcAddCargoCommand, fitID, itemID, x.amount)))
elif context == 'fighterItem':
for x in selection:
fighterInfo = FighterInfo.fromFighter(x)
fighterInfo.itemID = itemID
self.data.append(((FitRemoveFighterCommand, fitID, fit.fighters.index(x)), (FitAddFighterCommand, fitID, fighterInfo)))
self.data.append(((CalcRemoveLocalFighterCommand, fitID, fit.fighters.index(x)), (CalcAddLocalFighterCommand, fitID, fighterInfo)))
elif context == 'droneItem':
for x in selection:
self.data.append(((FitRebaseItemCommand, fitID, 'drones', fit.drones.index(x), itemID),),)
self.data.append(((CalcRebaseItemCommand, fitID, 'drones', fit.drones.index(x), itemID),), )
def Do(self):
for cmds in self.data:

View File

@@ -3,12 +3,12 @@ from logbook import Logger
import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.calc.cargo.remove import FitRemoveCargoCommand
from gui.fitCommands.calc.module.localRemove import FitRemoveModuleCommand
from gui.fitCommands.calc.module.localReplace import FitReplaceModuleCommand
from gui.fitCommands.calc.cargo.remove import CalcRemoveCargoCommand
from gui.fitCommands.calc.module.localRemove import CalcRemoveLocalModuleCommand
from gui.fitCommands.calc.module.localReplace import CalcReplaceLocalModuleCommand
from gui.fitCommands.helpers import ModuleInfo
from service.fit import Fit
from .calc.cargo.add import FitAddCargoCommand
from .calc.cargo.add import CalcAddCargoCommand
pyfalog = Logger(__name__)
@@ -33,12 +33,12 @@ class GuiModuleToCargoCommand(wx.Command):
if self.cargoIdx: # we're swapping with cargo
if self.copy: # if copying, simply add item to cargo
result = self.internal_history.Submit(FitAddCargoCommand(
result = self.internal_history.Submit(CalcAddCargoCommand(
self.mainFrame.getActiveFit(), module.item.ID if not module.item.isAbyssal else module.baseItemID))
else: # otherwise, try to swap by replacing module with cargo item. If successful, remove old cargo and add new cargo
cargo = fit.cargo[self.cargoIdx]
self.modReplaceCmd = FitReplaceModuleCommand(
self.modReplaceCmd = CalcReplaceLocalModuleCommand(
fitID=self.fitID,
position=module.modPosition,
newModInfo=ModuleInfo(itemID=cargo.itemID))
@@ -51,18 +51,18 @@ class GuiModuleToCargoCommand(wx.Command):
if self.modReplaceCmd.old_module is not None:
# we're swapping with an existing module, so remove cargo and add module
self.removeCmd = FitRemoveCargoCommand(self.fitID, cargo.itemID)
self.removeCmd = CalcRemoveCargoCommand(self.fitID, cargo.itemID)
result = self.internal_history.Submit(self.removeCmd)
self.addCargoCmd = FitAddCargoCommand(self.fitID, self.modReplaceCmd.old_module.itemID)
self.addCargoCmd = CalcAddCargoCommand(self.fitID, self.modReplaceCmd.old_module.itemID)
result = self.internal_history.Submit(self.addCargoCmd)
else: # dragging to blank spot, append
result = self.internal_history.Submit(FitAddCargoCommand(self.mainFrame.getActiveFit(),
module.item.ID if not module.item.isAbyssal else module.baseItemID))
result = self.internal_history.Submit(CalcAddCargoCommand(self.mainFrame.getActiveFit(),
module.item.ID if not module.item.isAbyssal else module.baseItemID))
if not self.copy: # if not copying, remove module
self.internal_history.Submit(FitRemoveModuleCommand(self.mainFrame.getActiveFit(), [self.moduleIdx]))
self.internal_history.Submit(CalcRemoveLocalModuleCommand(self.mainFrame.getActiveFit(), [self.moduleIdx]))
if result:
sFit.recalc(self.fitID)

View File

@@ -4,7 +4,7 @@ import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import ModuleInfo
from service.fit import Fit
from .calc.module.localReplace import FitReplaceModuleCommand
from .calc.module.localReplace import CalcReplaceLocalModuleCommand
class GuiMutaConvertCommand(wx.Command):
@@ -26,7 +26,7 @@ class GuiMutaConvertCommand(wx.Command):
if oldMod.isMutated:
return False
success = self.internal_history.Submit(FitReplaceModuleCommand(
success = self.internal_history.Submit(CalcReplaceLocalModuleCommand(
fitID=self.fitID,
position=self.position,
newModInfo=ModuleInfo(

View File

@@ -4,7 +4,7 @@ import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import ModuleInfo
from service.fit import Fit
from .calc.module.localReplace import FitReplaceModuleCommand
from .calc.module.localReplace import CalcReplaceLocalModuleCommand
class GuiMutaRevertCommand(wx.Command):
@@ -25,7 +25,7 @@ class GuiMutaRevertCommand(wx.Command):
if not oldMod.isMutated:
return False
success = self.internal_history.Submit(FitReplaceModuleCommand(
success = self.internal_history.Submit(CalcReplaceLocalModuleCommand(
fitID=self.fitID,
position=self.position,
newModInfo=ModuleInfo(

View File

@@ -5,10 +5,10 @@ import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import CargoInfo
from service.fit import Fit
from .calc.itemRebase import FitRebaseItemCommand
from .calc.module.changeCharges import FitChangeModuleChargesCommand
from .calc.cargo.add import FitAddCargoCommand
from .calc.cargo.remove import FitRemoveCargoCommand
from .calc.itemRebase import CalcRebaseItemCommand
from .calc.module.changeCharges import CalcChangeModuleChargesCommand
from .calc.cargo.add import CalcAddCargoCommand
from .calc.cargo.remove import CalcRemoveCargoCommand
@@ -25,21 +25,21 @@ class GuiRebaseItemsCommand(wx.Command):
fit = eos.db.getFit(self.fitID)
for mod in fit.modules:
if mod.itemID in self.rebaseMap:
self.internal_history.Submit(FitRebaseItemCommand(fitID=self.fitID, containerName="modules", position=mod.modPosition, itemID=self.rebaseMap[mod.itemID], commit=False))
self.internal_history.Submit(CalcRebaseItemCommand(fitID=self.fitID, containerName="modules", position=mod.modPosition, itemID=self.rebaseMap[mod.itemID], commit=False))
if mod.chargeID in self.rebaseMap:
self.internal_history.Submit(FitChangeModuleChargesCommand(fitID=self.fitID, chargeMap={mod.modPosition: self.rebaseMap[mod.chargeID]}))
self.internal_history.Submit(CalcChangeModuleChargesCommand(fitID=self.fitID, chargeMap={mod.modPosition: self.rebaseMap[mod.chargeID]}))
for containerName in ("drones", "fighters", "implants", "boosters"):
container = getattr(fit, containerName)
for obj in container:
if obj.itemID in self.rebaseMap:
self.internal_history.Submit(FitRebaseItemCommand(fitID=self.fitID, containerName=containerName, position=container.index(obj), itemID=self.rebaseMap[obj.itemID], commit=False))
self.internal_history.Submit(CalcRebaseItemCommand(fitID=self.fitID, containerName=containerName, position=container.index(obj), itemID=self.rebaseMap[obj.itemID], commit=False))
# Need to process cargo separately as we want to merge items when needed,
# e.g. FN iron and CN iron into single stack of CN iron
for cargo in fit.cargo:
if cargo.itemID in self.rebaseMap:
amount = cargo.amount
self.internal_history.Submit(FitRemoveCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=cargo.itemID, amount=amount)))
self.internal_history.Submit(FitAddCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=self.rebaseMap[cargo.itemID], amount=amount)))
self.internal_history.Submit(CalcRemoveCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=cargo.itemID, amount=amount)))
self.internal_history.Submit(CalcAddCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=self.rebaseMap[cargo.itemID], amount=amount)))
if self.internal_history.Commands:
eos.db.commit()
Fit.getInstance().recalc(self.fitID)

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.booster.remove import FitRemoveBoosterCommand
from .calc.booster.remove import CalcRemoveBoosterCommand
class GuiRemoveBoosterCommand(wx.Command):
@@ -16,7 +16,7 @@ class GuiRemoveBoosterCommand(wx.Command):
self.position = position
def Do(self):
if self.internal_history.Submit(FitRemoveBoosterCommand(self.fitID, self.position)):
if self.internal_history.Submit(CalcRemoveBoosterCommand(self.fitID, self.position)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -6,7 +6,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.helpers import CargoInfo
from .calc.cargo.remove import FitRemoveCargoCommand
from .calc.cargo.remove import CalcRemoveCargoCommand
class GuiRemoveCargoCommand(wx.Command):
@@ -19,7 +19,7 @@ class GuiRemoveCargoCommand(wx.Command):
self.itemID = itemID
def Do(self):
if self.internal_history.Submit(FitRemoveCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=self.itemID, amount=math.inf))):
if self.internal_history.Submit(CalcRemoveCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=self.itemID, amount=math.inf))):
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True
return False

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.commandFit.remove import FitRemoveCommandCommand
from .calc.commandFit.remove import CalcRemoveCommandCommand
class GuiRemoveCommandCommand(wx.Command):
@@ -16,7 +16,7 @@ class GuiRemoveCommandCommand(wx.Command):
self.commandFitID = commandFitID
def Do(self):
if self.internal_history.Submit(FitRemoveCommandCommand(self.fitID, self.commandFitID)):
if self.internal_history.Submit(CalcRemoveCommandCommand(self.fitID, self.commandFitID)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.drone.localRemove import FitRemoveDroneCommand
from .calc.drone.localRemove import CalcRemoveLocalDroneCommand
class GuiRemoveDroneCommand(wx.Command):
@@ -17,7 +17,7 @@ class GuiRemoveDroneCommand(wx.Command):
self.amount = amount
def Do(self):
cmd = FitRemoveDroneCommand(self.fitID, self.position, self.amount)
cmd = CalcRemoveLocalDroneCommand(self.fitID, self.position, self.amount)
if self.internal_history.Submit(cmd):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.fighter.localRemove import FitRemoveFighterCommand
from .calc.fighter.localRemove import CalcRemoveLocalFighterCommand
class GuiRemoveFighterCommand(wx.Command):
@@ -16,7 +16,7 @@ class GuiRemoveFighterCommand(wx.Command):
self.internal_history = wx.CommandProcessor()
def Do(self):
success = self.internal_history.Submit(FitRemoveFighterCommand(self.fitID, self.position))
success = self.internal_history.Submit(CalcRemoveLocalFighterCommand(self.fitID, self.position))
if success:
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.implant.remove import FitRemoveImplantCommand
from .calc.implant.remove import CalcRemoveImplantCommand
class GuiRemoveImplantCommand(wx.Command):
@@ -16,7 +16,7 @@ class GuiRemoveImplantCommand(wx.Command):
self.position = position
def Do(self):
if self.internal_history.Submit(FitRemoveImplantCommand(self.fitID, self.position)):
if self.internal_history.Submit(CalcRemoveImplantCommand(self.fitID, self.position)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -4,7 +4,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .helpers import ModuleInfo
from .calc.module.localRemove import FitRemoveModuleCommand
from .calc.module.localRemove import CalcRemoveLocalModuleCommand
class GuiModuleRemoveCommand(wx.Command):
@@ -23,7 +23,7 @@ class GuiModuleRemoveCommand(wx.Command):
self.internal_history = wx.CommandProcessor()
def Do(self):
success = self.internal_history.Submit(FitRemoveModuleCommand(self.fitID, [pos for pos in self.modCache]))
success = self.internal_history.Submit(CalcRemoveLocalModuleCommand(self.fitID, [pos for pos in self.modCache]))
if success:
self.sFit.recalc(self.fitID)

View File

@@ -3,11 +3,11 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.module.projectedRemove import FitRemoveProjectedModuleCommand
from .calc.projectedFit.remove import FitRemoveProjectedFitCommand
from .calc.fighter.projectedRemove import FitRemoveProjectedFighterCommand
from .calc.module.projectedRemove import CalcRemoveProjectedModuleCommand
from .calc.projectedFit.remove import CalcRemoveProjectedFitCommand
from .calc.fighter.projectedRemove import CalcRemoveProjectedFighterCommand
from logbook import Logger
from .calc.drone.projectedRemove import FitRemoveProjectedDroneCommand
from .calc.drone.projectedRemove import CalcRemoveProjectedDroneCommand
from gui.fitCommands.helpers import DroneInfo
from eos.saveddata.drone import Drone
@@ -19,10 +19,10 @@ pyfalog = Logger(__name__)
class GuiRemoveProjectedCommand(wx.Command):
mapping = {
'fit': FitRemoveProjectedFitCommand,
'module': FitRemoveProjectedModuleCommand,
'fighter': FitRemoveProjectedFighterCommand,
'drone': FitRemoveProjectedDroneCommand
'fit': CalcRemoveProjectedFitCommand,
'module': CalcRemoveProjectedModuleCommand,
'fighter': CalcRemoveProjectedFighterCommand,
'drone': CalcRemoveProjectedDroneCommand
}
def __init__(self, fitID, thing):

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.shipModeChange import FitChangeShipModeCommand
from .calc.shipModeChange import CalcChangeShipModeCommand
class GuiSetModeCommand(wx.Command):
@@ -16,7 +16,7 @@ class GuiSetModeCommand(wx.Command):
self.itemID = itemID
def Do(self):
if self.internal_history.Submit(FitChangeShipModeCommand(self.fitID, self.itemID)):
if self.internal_history.Submit(CalcChangeShipModeCommand(self.fitID, self.itemID)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.module.changeSpool import FitChangeModuleSpoolCommand
from .calc.module.changeSpool import CalcChangeModuleSpoolCommand
class GuiSetSpoolup(wx.Command):
@@ -20,7 +20,7 @@ class GuiSetSpoolup(wx.Command):
self.context = context
def Do(self):
if self.internal_history.Submit(FitChangeModuleSpoolCommand(
if self.internal_history.Submit(CalcChangeModuleSpoolCommand(
fitID=self.fitID,
position=self.position,
spoolType=self.spoolType,

View File

@@ -3,8 +3,8 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.calc.module.localSwap import FitSwapModuleCommand
from .calc.module.localClone import FitCloneModuleCommand
from gui.fitCommands.calc.module.localSwap import CalcSwapLocalModuleCommand
from .calc.module.localClone import CalcCloneLocalModuleCommand
from logbook import Logger
pyfalog = Logger(__name__)
@@ -26,13 +26,13 @@ class GuiModuleSwapOrCloneCommand(wx.Command):
if self.clone:
pyfalog.debug("Trying to clone module")
if self.internal_history.Submit(FitCloneModuleCommand(self.fitID, self.srcPosition, self.dstPosition)):
if self.internal_history.Submit(CalcCloneLocalModuleCommand(self.fitID, self.srcPosition, self.dstPosition)):
self.sFit.recalc(self.fitID) # clone needs a recalc
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True
else:
pyfalog.debug("Trying to Swap module")
if self.internal_history.Submit(FitSwapModuleCommand(self.fitID, self.srcPosition, self.dstPosition)):
if self.internal_history.Submit(CalcSwapLocalModuleCommand(self.fitID, self.srcPosition, self.dstPosition)):
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.booster.toggleState import FitToggleBoosterStateCommand
from .calc.booster.toggleState import CalcToggleBoosterStateCommand
class GuiToggleBoosterCommand(wx.Command):
@@ -16,7 +16,7 @@ class GuiToggleBoosterCommand(wx.Command):
self.position = position
def Do(self):
if self.internal_history.Submit(FitToggleBoosterStateCommand(self.fitID, self.position)):
if self.internal_history.Submit(CalcToggleBoosterStateCommand(self.fitID, self.position)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.booster.sideEffectToggleState import FitToggleBoosterSideEffectStateCommand
from .calc.booster.sideEffectToggleState import CalcToggleBoosterSideEffectStateCommand
class GuiToggleBoosterSideEffectCommand(wx.Command):
@@ -17,7 +17,7 @@ class GuiToggleBoosterSideEffectCommand(wx.Command):
self.effectID = effectID
def Do(self):
if self.internal_history.Submit(FitToggleBoosterSideEffectStateCommand(self.fitID, self.position, self.effectID)):
if self.internal_history.Submit(CalcToggleBoosterSideEffectStateCommand(self.fitID, self.position, self.effectID)):
Fit.getInstance().recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.commandFit.toggleState import FitToggleCommandFitStateCommand
from .calc.commandFit.toggleState import CalcToggleCommandFitStateCommand
class GuiToggleCommandCommand(wx.Command):
@@ -16,7 +16,7 @@ class GuiToggleCommandCommand(wx.Command):
self.commandFitID = commandFitID
def Do(self):
if self.internal_history.Submit(FitToggleCommandFitStateCommand(self.fitID, self.commandFitID)):
if self.internal_history.Submit(CalcToggleCommandFitStateCommand(self.fitID, self.commandFitID)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.drone.localToggleState import FitToggleDroneStateCommand
from .calc.drone.localToggleState import CalcToggleLocalDroneStateCommand
class GuiToggleDroneCommand(wx.Command):
@@ -16,7 +16,7 @@ class GuiToggleDroneCommand(wx.Command):
self.position = position
def Do(self):
if self.internal_history.Submit(FitToggleDroneStateCommand(self.fitID, self.position)):
if self.internal_history.Submit(CalcToggleLocalDroneStateCommand(self.fitID, self.position)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.fighter.localToggleState import FitToggleFighterStateCommand
from .calc.fighter.toggleState import CalcToggleFighterStateCommand
class GuiToggleFighterCommand(wx.Command):
@@ -16,7 +16,7 @@ class GuiToggleFighterCommand(wx.Command):
self.position = position
def Do(self):
if self.internal_history.Submit(FitToggleFighterStateCommand(self.fitID, self.position)):
if self.internal_history.Submit(CalcToggleFighterStateCommand(self.fitID, False, self.position)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.fighter.abilityToggle import FitToggleFighterAbilityStateCommand
from .calc.fighter.abilityToggleState import CalcToggleFighterAbilityStateCommand
class GuiToggleFighterAbilityCommand(wx.Command):
@@ -18,7 +18,7 @@ class GuiToggleFighterAbilityCommand(wx.Command):
self.isProjected = isProjected
def Do(self):
if self.internal_history.Submit(FitToggleFighterAbilityStateCommand(self.fitID, self.position, self.effectID, self.isProjected)):
if self.internal_history.Submit(CalcToggleFighterAbilityStateCommand(self.fitID, self.isProjected, self.position, self.effectID)):
Fit.getInstance().recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.implant.toggleState import FitToggleImplantStateCommand
from .calc.implant.toggleState import CalcToggleImplantStateCommand
class GuiToggleImplantCommand(wx.Command):
@@ -16,7 +16,7 @@ class GuiToggleImplantCommand(wx.Command):
self.position = position
def Do(self):
if self.internal_history.Submit(FitToggleImplantStateCommand(self.fitID, self.position)):
if self.internal_history.Submit(CalcToggleImplantStateCommand(self.fitID, self.position)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -3,7 +3,7 @@ from service.fit import Fit
import gui.mainFrame
from gui import globalEvents as GE
from .calc.module.localChangeStates import FitChangeModuleStatesCommand
from .calc.module.localChangeStates import CalcChangeLocalModuleStatesCommand
class GuiModuleStateChangeCommand(wx.Command):
@@ -19,7 +19,7 @@ class GuiModuleStateChangeCommand(wx.Command):
self.internal_history = wx.CommandProcessor()
def Do(self):
if self.internal_history.Submit(FitChangeModuleStatesCommand(self.fitID, self.baseMod, self.modules, self.click)):
if self.internal_history.Submit(CalcChangeLocalModuleStatesCommand(self.fitID, self.baseMod, self.modules, self.click)):
self.sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return True

View File

@@ -7,10 +7,10 @@ from eos.saveddata.fit import Fit as FitType
from eos.saveddata.module import Module as ModuleType
from gui import globalEvents as GE
from service.fit import Fit
from .calc.drone.projectedToggleState import FitToggleProjectedDroneStateCommand
from .calc.fighter.projectedToggleState import FitToggleProjectedFighterStateCommand
from .calc.projectedFit.toggleState import FitToggleProjectedFitCommand
from .calc.module.projectedChangeState import FitChangeProjectedModuleStateCommand
from .calc.drone.projectedToggleState import CalcToggleProjectedDroneStateCommand
from .calc.fighter.toggleState import CalcToggleFighterStateCommand
from .calc.projectedFit.toggleState import CalcToggleProjectedFitCommand
from .calc.module.projectedChangeState import CalcChangeProjectedModuleStateCommand
class GuiToggleProjectedCommand(wx.Command):
@@ -22,19 +22,19 @@ class GuiToggleProjectedCommand(wx.Command):
self.fitID = fitID
fit = Fit.getInstance().getFit(self.fitID)
if isinstance(thing, FitType):
self.commandType = FitToggleProjectedFitCommand
self.commandType = CalcToggleProjectedFitCommand
self.args = (self.fitID, thing.ID)
elif isinstance(thing, ModuleType):
position = fit.projectedModules.index(thing)
self.commandType = FitChangeProjectedModuleStateCommand
self.commandType = CalcChangeProjectedModuleStateCommand
self.args = (self.fitID, position, click)
elif isinstance(thing, DroneType):
self.commandType = FitToggleProjectedDroneStateCommand
self.commandType = CalcToggleProjectedDroneStateCommand
self.args = (self.fitID, thing.itemID)
elif isinstance(thing, FighterType):
position = fit.projectedFighters.index(thing)
self.commandType = FitToggleProjectedFighterStateCommand
self.args = (self.fitID, position)
self.commandType = CalcToggleFighterStateCommand
self.args = (self.fitID, True, position)
else:
self.commandType = None
self.args = ()

View File

@@ -16,8 +16,8 @@ from eos.effectHandlerHelpers import HandledList
from eos.db import gamedata_session, getCategory, getAttributeInfo, getGroup
from eos.gamedata import Attribute, Effect, Group, Item, ItemEffect
from eos.utils.spoolSupport import SpoolType, SpoolOptions
from gui.fitCommands.calc.module.localAdd import FitAddModuleCommand
from gui.fitCommands.calc.module.localRemove import FitRemoveModuleCommand
from gui.fitCommands.calc.module.localAdd import CalcAddLocalModuleCommand
from gui.fitCommands.calc.module.localRemove import CalcRemoveLocalModuleCommand
from gui.fitCommands.helpers import ModuleInfo
@@ -66,12 +66,12 @@ class EfsPort:
if propID is None:
return None
FitAddModuleCommand(fitID, ModuleInfo(itemID=propID)).Do()
CalcAddLocalModuleCommand(fitID, ModuleInfo(itemID=propID)).Do()
sFit.recalc(fit)
fit = eos.db.getFit(fitID)
mwdPropSpeed = fit.maxSpeed
mwdPosition = list(filter(lambda mod: mod.item and mod.item.ID == propID, fit.modules))[0].position
FitRemoveModuleCommand(fitID, [mwdPosition]).Do()
CalcRemoveLocalModuleCommand(fitID, [mwdPosition]).Do()
sFit.recalc(fit)
fit = eos.db.getFit(fitID)
return mwdPropSpeed