Minor style fixes

This commit is contained in:
DarkPhoenix
2019-04-13 23:26:53 +03:00
parent 6d9e60648e
commit 1154435a89
22 changed files with 49 additions and 56 deletions

View File

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

View File

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

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeFighterAmount(wx.Command):
class FitChangeFighterAmountCommand(wx.Command):
def __init__(self, fitID, position, amount):
wx.Command.__init__(self, True, 'Change Fighter Amount')
@@ -35,5 +35,5 @@ class FitChangeFighterAmount(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 = FitChangeFighterAmount(self.fitID, self.position, self.savedAmount)
cmd = FitChangeFighterAmountCommand(fitID=self.fitID, position=self.position, amount=self.savedAmount)
return cmd.Do()

View File

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

View File

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

View File

@@ -8,7 +8,7 @@ from service.fit import Fit
pyfalog = Logger(__name__)
class FitChangeProjectedFighterAmount(wx.Command):
class FitChangeProjectedFighterAmountCommand(wx.Command):
def __init__(self, fitID, position, amount):
wx.Command.__init__(self, True, 'Change Projected Fighter Amount')
@@ -35,5 +35,5 @@ class FitChangeProjectedFighterAmount(wx.Command):
def Undo(self):
pyfalog.debug('Undoing change of projected fighter amount to {} at position {} on fit {}'.format(self.amount, self.position, self.fitID))
cmd = FitChangeProjectedFighterAmount(self.fitID, self.position, self.savedAmount)
cmd = FitChangeProjectedFighterAmountCommand(fitID=self.fitID, position=self.position, amount=self.savedAmount)
return cmd.Do()

View File

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

View File

@@ -5,7 +5,6 @@ from logbook import Logger
import eos.db
from eos.exception import HandledListActionError
from gui.fitCommands.helpers import ModuleInfo
from service.fit import Fit
@@ -45,6 +44,5 @@ class FitCloneModuleCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing cloning from position {} to position {} for fit ID {}'.format(self.srcPosition, self.dstPosition, self.fitID))
from .fitRemoveModule import FitRemoveModuleCommand
cmd = FitRemoveModuleCommand(self.fitID, [self.dstPosition])
cmd.Do()
return True
cmd = FitRemoveModuleCommand(fitID=self.fitID, positions=[self.dstPosition])
return cmd.Do()

View File

@@ -36,5 +36,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(self.fitID, self.containerName, self.position, self.savedItemID)
cmd = FitRebaseItemCommand(fitID=self.fitID, containerName=self.containerName, position=self.position, itemID=self.savedItemID)
return cmd.Do()

View File

@@ -29,8 +29,5 @@ class FitRemoveBoosterCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing removal of booster {} on fit {}'.format(self.savedBoosterInfo, self.fitID))
from .fitAddBooster import FitAddBoosterCommand
cmd = FitAddBoosterCommand(
fitID=self.fitID,
boosterInfo=self.savedBoosterInfo,
position=self.position)
cmd = FitAddBoosterCommand(fitID=self.fitID, boosterInfo=self.savedBoosterInfo, position=self.position)
return cmd.Do()

View File

@@ -29,8 +29,5 @@ class FitRemoveImplantCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing removal of implant {} on fit {}'.format(self.savedImplantInfo, self.fitID))
from .fitAddImplant import FitAddImplantCommand
cmd = FitAddImplantCommand(
fitID=self.fitID,
implantInfo=self.savedImplantInfo,
position=self.position)
cmd = FitAddImplantCommand(fitID=self.fitID, implantInfo=self.savedImplantInfo, position=self.position)
return cmd.Do()

View File

@@ -29,8 +29,5 @@ class FitRemoveProjectedModuleCommand(wx.Command):
def Undo(self):
pyfalog.debug('Undoing removal of projected module {} on fit {}'.format(self.savedModInfo, self.fitID))
from gui.fitCommands.calc.fitAddProjectedModule import FitAddProjectedModuleCommand
cmd = FitAddProjectedModuleCommand(
fitID=self.fitID,
modInfo=self.savedModInfo,
position=self.position)
cmd = FitAddProjectedModuleCommand(fitID=self.fitID, modInfo=self.savedModInfo, position=self.position)
return cmd.Do()

View File

@@ -2,25 +2,29 @@ import wx
from logbook import Logger
import eos.db
from service.fit import Fit
pyfalog = Logger(__name__)
class FitRenameCommand(wx.Command):
def __init__(self, fitID, newName):
wx.Command.__init__(self, True, "FitRename")
def __init__(self, fitID, name):
wx.Command.__init__(self, True, 'Rename Fit')
self.fitID = fitID
self.newName = newName
self.oldName = None
self.name = name
self.savedName = None
def Do(self):
pyfalog.debug("Renaming fit ({0}) to: {1}", self.fitID, self.newName)
pyfalog.debug('Doing renaming of fit {} to {}'.format(self.fitID, self.name))
fit = eos.db.getFit(self.fitID)
self.oldName = fit.name
fit.name = self.newName
self.savedName = fit.name
fit.name = self.name
eos.db.commit()
return True
def Undo(self):
cmd = FitRenameCommand(self.fitID, self.oldName)
pyfalog.debug('Undoing renaming of fit {} to {}'.format(self.fitID, self.name))
cmd = FitRenameCommand(fitID=self.fitID, name=self.savedName)
return cmd.Do()

View File

@@ -20,7 +20,7 @@ class FitReplaceModuleCommand(wx.Command):
self.oldModInfo = None
def Do(self):
pyfalog.debug('Doing replacement of module to {} on fit {}'.format(self.newModInfo, self.fitID))
pyfalog.debug('Doing replacement of 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]
@@ -47,11 +47,11 @@ class FitReplaceModuleCommand(wx.Command):
return True
def Undo(self):
pyfalog.debug('Undoing replacement of module from {} to {} on fit {}'.format(self.oldModInfo, self.newModInfo, self.fitID))
pyfalog.debug('Undoing replacement of 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 gui.fitCommands.calc.fitRemoveModule import FitRemoveModuleCommand
cmd = FitRemoveModuleCommand(self.fitID, [self.position])
cmd = FitRemoveModuleCommand(fitID=self.fitID, positions=[self.position])
return cmd.Do()
# Replace if there was
sFit = Fit.getInstance()

View File

@@ -6,7 +6,7 @@ from eos.const import ImplantLocation
from gui import globalEvents as GE
from gui.fitCommands.helpers import ImplantInfo
from .calc.fitAddImplant import FitAddImplantCommand
from .calc.fitChangeImplantLocation import FitChangeImplantLocation
from .calc.fitChangeImplantLocation import FitChangeImplantLocationCommand
class GuiAddImplantCommand(wx.Command):
@@ -21,7 +21,7 @@ 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(FitChangeImplantLocation(self.fitID, ImplantLocation.FIT))
self.internal_history.Submit(FitChangeImplantLocationCommand(self.fitID, ImplantLocation.FIT))
):
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.fitChangeCargoAmount import FitChangeCargoAmount
from .calc.fitChangeCargoAmount import FitChangeCargoAmountCommand
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 = FitChangeCargoAmount(self.fitID, CargoInfo(itemID=self.itemID, amount=self.amount))
cmd = FitChangeCargoAmountCommand(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.fitChangeDroneAmount import FitChangeDroneAmount
from .calc.fitChangeDroneAmount import FitChangeDroneAmountCommand
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 = FitChangeDroneAmount(self.fitID, self.position, self.amount)
cmd = FitChangeDroneAmountCommand(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.fitChangeFighterAmount import FitChangeFighterAmount
from .calc.fitChangeFighterAmount import FitChangeFighterAmountCommand
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 = FitChangeFighterAmount(self.fitID, self.position, self.amount)
cmd = FitChangeFighterAmountCommand(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.fitChangeImplantLocation import FitChangeImplantLocation
from .calc.fitChangeImplantLocation import FitChangeImplantLocationCommand
class GuiChangeImplantLocation(wx.Command):
@@ -16,7 +16,7 @@ class GuiChangeImplantLocation(wx.Command):
self.source = source
def Do(self):
if self.internal_history.Submit(FitChangeImplantLocation(self.fitID, self.source)):
if self.internal_history.Submit(FitChangeImplantLocationCommand(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.fitChangeProjectedDroneAmount import FitChangeProjectedDroneAmount
from .calc.fitChangeProjectedDroneAmount import FitChangeProjectedDroneAmountCommand
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 = FitChangeProjectedDroneAmount(self.fitID, self.itemID, self.amount)
cmd = FitChangeProjectedDroneAmountCommand(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.fitChangeProjectedFighterAmount import FitChangeProjectedFighterAmount
from .calc.fitChangeProjectedFighterAmount import FitChangeProjectedFighterAmountCommand
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 = FitChangeProjectedFighterAmount(self.fitID, self.position, self.amount)
cmd = FitChangeProjectedFighterAmountCommand(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.fitChangeProjectedFitAmount import FitChangeProjectedFitAmount
from .calc.fitChangeProjectedFitAmount import FitChangeProjectedFitAmountCommand
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 = FitChangeProjectedFitAmount(self.fitID, self.pfitID, self.amount)
cmd = FitChangeProjectedFitAmountCommand(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))