From d67573f83ae5ec9cf60eb124e689e7802082b107 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Mon, 27 Feb 2017 12:05:38 -0800 Subject: [PATCH 01/12] Add more functionality to preferences window. --- config.py | 1 + eos/effects/adaptivearmorhardener.py | 8 +++++++ .../pyfaEnginePreferences.py | 11 ++++++++- .../pyfaLoggingPreferences.py | 23 +++++++++++++++++++ pyfa.py | 18 ++++++++------- service/fit.py | 1 + 6 files changed, 53 insertions(+), 9 deletions(-) diff --git a/config.py b/config.py index 447e81763..7c807e3be 100644 --- a/config.py +++ b/config.py @@ -29,6 +29,7 @@ pyfaPath = None savePath = None saveDB = None gameDB = None +logPath = None def isFrozen(): diff --git a/eos/effects/adaptivearmorhardener.py b/eos/effects/adaptivearmorhardener.py index 8d017715d..42c50a610 100644 --- a/eos/effects/adaptivearmorhardener.py +++ b/eos/effects/adaptivearmorhardener.py @@ -3,6 +3,7 @@ # Used by: # Module: Reactive Armor Hardener from logbook import Logger +from service.fit import Fit pyfalog = Logger(__name__) @@ -13,6 +14,13 @@ type = "active" def handler(fit, module, context): damagePattern = fit.damagePattern + sFit = Fit.getInstance() + static_adaptive_behavior = sFit.serviceFittingOptions["useStaticAdaptiveArmorHardener"] + + if (damagePattern.emAmount == damagePattern.thermalAmount == damagePattern.kineticAmount == damagePattern.explosiveAmount) and static_adaptive_behavior: + pyfalog.debug("Setting adaptivearmorhardener resists to uniform profile.") + return + # Skip if there is no damage pattern. Example: projected ships or fleet boosters if damagePattern: diff --git a/gui/builtinPreferenceViews/pyfaEnginePreferences.py b/gui/builtinPreferenceViews/pyfaEnginePreferences.py index a98aec127..3d84a4367 100644 --- a/gui/builtinPreferenceViews/pyfaEnginePreferences.py +++ b/gui/builtinPreferenceViews/pyfaEnginePreferences.py @@ -36,6 +36,10 @@ class PFFittingEnginePref(PreferenceView): wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbGlobalForceReload, 0, wx.ALL | wx.EXPAND, 5) + self.cbUniversalAdaptiveArmorHardener = wx.CheckBox(panel, wx.ID_ANY, u"When damage profile is even, set Reactive Armor Hardener to match (old behavior).", + wx.DefaultPosition, wx.DefaultSize, 0) + mainSizer.Add(self.cbUniversalAdaptiveArmorHardener, 0, wx.ALL | wx.EXPAND, 5) + # Future code once new cap sim is implemented ''' self.cbGlobalForceReactivationTimer = wx.CheckBox( panel, wx.ID_ANY, u"Factor in reactivation timer", wx.DefaultPosition, wx.DefaultSize, 0 ) @@ -63,15 +67,20 @@ class PFFittingEnginePref(PreferenceView): self.sFit = Fit.getInstance() self.cbGlobalForceReload.SetValue(self.sFit.serviceFittingOptions["useGlobalForceReload"]) - self.cbGlobalForceReload.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalForceReloadStateChange) + self.cbUniversalAdaptiveArmorHardener.SetValue(self.sFit.serviceFittingOptions["useStaticAdaptiveArmorHardener"]) + self.cbUniversalAdaptiveArmorHardener.Bind(wx.EVT_CHECKBOX, self.OnCBUniversalAdaptiveArmorHardenerChange) + panel.SetSizer(mainSizer) panel.Layout() def OnCBGlobalForceReloadStateChange(self, event): self.sFit.serviceFittingOptions["useGlobalForceReload"] = self.cbGlobalForceReload.GetValue() + def OnCBUniversalAdaptiveArmorHardenerChange(self, event): + self.sFit.serviceFittingOptions["useStaticAdaptiveArmorHardener"] = self.cbUniversalAdaptiveArmorHardener.GetValue() + def getImage(self): return BitmapLoader.getBitmap("prefs_settings", "gui") diff --git a/gui/builtinPreferenceViews/pyfaLoggingPreferences.py b/gui/builtinPreferenceViews/pyfaLoggingPreferences.py index 6613998f7..601f535b0 100644 --- a/gui/builtinPreferenceViews/pyfaLoggingPreferences.py +++ b/gui/builtinPreferenceViews/pyfaLoggingPreferences.py @@ -3,6 +3,13 @@ import wx from gui.preferenceView import PreferenceView from gui.bitmapLoader import BitmapLoader import config +from logbook import Logger + +pyfalog = Logger(__name__) + + +def OnDumpLogs(event): + pyfalog.critical("Dump log button was pressed. Writing all logs to log file.") class PFGeneralPref(PreferenceView): @@ -27,10 +34,26 @@ class PFGeneralPref(PreferenceView): self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) + # Database path + self.stLogPath = wx.StaticText(panel, wx.ID_ANY, u"Log file location:", wx.DefaultPosition, wx.DefaultSize, 0) + self.stLogPath.Wrap(-1) + mainSizer.Add(self.stLogPath, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) + self.inputLogPath = wx.TextCtrl(panel, wx.ID_ANY, config.logPath, wx.DefaultPosition, wx.DefaultSize, 0) + self.inputLogPath.SetEditable(False) + self.inputLogPath.SetBackgroundColour((200, 200, 200)) + mainSizer.Add(self.inputLogPath, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5) + # Debug Logging self.cbdebugLogging = wx.CheckBox(panel, wx.ID_ANY, u"Debug Logging Enabled", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbdebugLogging, 0, wx.ALL | wx.EXPAND, 5) + self.stDumpLogs = wx.StaticText(panel, wx.ID_ANY, u"Pressing this button will cause all logs in memory to write to the log file:", + wx.DefaultPosition, wx.DefaultSize, 0) + mainSizer.Add(self.stDumpLogs, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) + self.btnDumpLogs = wx.Button(panel, wx.ID_ANY, u"Dump All Logs", wx.DefaultPosition, wx.DefaultSize, 0) + self.btnDumpLogs.Bind(wx.EVT_BUTTON, OnDumpLogs) + mainSizer.Add(self.btnDumpLogs, 0, wx.ALIGN_LEFT, 5) + self.cbdebugLogging.SetValue(config.debug) self.cbdebugLogging.Bind(wx.EVT_CHECKBOX, self.onCBdebugLogging) diff --git a/pyfa.py b/pyfa.py index 488165724..05b265024 100755 --- a/pyfa.py +++ b/pyfa.py @@ -46,7 +46,7 @@ class PassThroughOptionParser(OptionParser): largs.append(e.opt_str) -class LoggerWriter: +class LoggerWriter(object): def __init__(self, level): # self.level is really like using log.debug(message) # at least in my case @@ -159,8 +159,6 @@ if __name__ == "__main__": # Import everything # noinspection PyPackageRequirements import wx - import os - import os.path try: # convert to unicode if it is set @@ -185,8 +183,9 @@ if __name__ == "__main__": else: savePath_filename = "Pyfa.log" - savePath_Destination = os.path.join(config.savePath, savePath_filename) + config.logPath = os.path.join(config.savePath, savePath_filename) + # noinspection PyBroadException try: if options.debug: logging_mode = "Debug" @@ -200,7 +199,7 @@ if __name__ == "__main__": level=options.logginglevel ), TimedRotatingFileHandler( - savePath_Destination, + config.logPath, level=0, backup_count=3, bubble=True, @@ -215,7 +214,7 @@ if __name__ == "__main__": NullHandler(), FingersCrossedHandler( TimedRotatingFileHandler( - savePath_Destination, + config.logPath, level=0, backup_count=3, bubble=False, @@ -266,15 +265,18 @@ if __name__ == "__main__": # Output all stdout (print) messages as warnings try: sys.stdout = LoggerWriter(pyfalog.warning) - except ValueError, Exception: + except (ValueError, Exception) as e: pyfalog.critical("Cannot access log file. Continuing without writing stdout to log.") + pyfalog.critical(e) + # Don't redirect stderr (stacktrace) messages if we're in debug mode. Developers want to see them in the console. if not options.debug: # Output all stderr (stacktrace) messages as critical try: sys.stderr = LoggerWriter(pyfalog.critical) - except ValueError, Exception: + except (ValueError, Exception) as e: pyfalog.critical("Cannot access log file. Continuing without writing stderr to log.") + pyfalog.critical(e) pyfalog.info("Starting Pyfa") pyfalog.info("Running in logging mode: {0}", logging_mode) diff --git a/service/fit.py b/service/fit.py index 9eeb348fe..ea072b829 100644 --- a/service/fit.py +++ b/service/fit.py @@ -72,6 +72,7 @@ class Fit(object): "exportCharges": True, "openFitInNew": False, "priceSystem": "Jita", + "useStaticAdaptiveArmorHardener": False, } self.serviceFittingOptions = SettingsProvider.getInstance().getSettings( From 9a284bc7408b4426a273a851696155240d165b72 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Mon, 27 Feb 2017 14:33:18 -0800 Subject: [PATCH 02/12] Add preference to disable ship browser tooltip popup. --- gui/builtinPreferenceViews/pyfaGeneralPreferences.py | 9 +++++++++ gui/shipBrowser.py | 8 ++++++-- service/fit.py | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py index 8a278a048..0be3baddf 100644 --- a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py +++ b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py @@ -78,6 +78,10 @@ class PFGeneralPref(PreferenceView): wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbOpenFitInNew, 0, wx.ALL | wx.EXPAND, 5) + self.cbShowShipBrowserTooltip = wx.CheckBox(panel, wx.ID_ANY, u"Show ship browser tooltip", + wx.DefaultPosition, wx.DefaultSize, 0) + mainSizer.Add(self.cbShowShipBrowserTooltip, 0, wx.ALL | wx.EXPAND, 5) + priceSizer = wx.BoxSizer(wx.HORIZONTAL) self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, u"Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0) @@ -104,6 +108,7 @@ class PFGeneralPref(PreferenceView): self.cbExportCharges.SetValue(self.sFit.serviceFittingOptions["exportCharges"]) self.cbOpenFitInNew.SetValue(self.sFit.serviceFittingOptions["openFitInNew"]) self.chPriceSystem.SetStringSelection(self.sFit.serviceFittingOptions["priceSystem"]) + self.cbShowShipBrowserTooltip.SetValue(self.sFit.serviceFittingOptions["showShipBrowserTooltip"]) self.cbGlobalChar.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalCharStateChange) self.cbGlobalDmgPattern.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalDmgPatternStateChange) @@ -118,6 +123,7 @@ class PFGeneralPref(PreferenceView): self.cbExportCharges.Bind(wx.EVT_CHECKBOX, self.onCBExportCharges) self.cbOpenFitInNew.Bind(wx.EVT_CHECKBOX, self.onCBOpenFitInNew) self.chPriceSystem.Bind(wx.EVT_CHOICE, self.onPriceSelection) + self.cbShowShipBrowserTooltip.Bind(wx.EVT_CHECKBOX, self.onCBShowShipBrowserTooltip) self.cbRackLabels.Enable(self.sFit.serviceFittingOptions["rackSlots"] or False) @@ -179,6 +185,9 @@ class PFGeneralPref(PreferenceView): def onCBOpenFitInNew(self, event): self.sFit.serviceFittingOptions["openFitInNew"] = self.cbOpenFitInNew.GetValue() + def onCBShowShipBrowserTooltip(self, event): + self.sFit.serviceFittingOptions["showShipBrowserTooltip"] = self.cbShowShipBrowserTooltip.GetValue() + def getImage(self): return BitmapLoader.getBitmap("prefs_settings", "gui") diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index a0b777b79..466c768cb 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -1156,7 +1156,9 @@ class ShipItem(SFItem.SFBrowserItem): self.raceDropShadowBmp = drawUtils.CreateDropShadowBitmap(self.raceBmp, 0.2) - self.SetToolTip(wx.ToolTip(self.shipTrait)) + sFit = Fit.getInstance() + if self.shipTrait and sFit.serviceFittingOptions["showShipBrowserTooltip"]: + self.SetToolTip(wx.ToolTip(self.shipTrait)) self.shipBrowser = self.Parent.Parent @@ -1492,7 +1494,9 @@ class FitItem(SFItem.SFBrowserItem): self.dragTLFBmp = None self.bkBitmap = None - if self.shipTrait != "": # show no tooltip if no trait available + sFit = Fit.getInstance() + # show no tooltip if no trait available or setting is disabled + if self.shipTrait and sFit.serviceFittingOptions["showShipBrowserTooltip"]: self.SetToolTip(wx.ToolTip(u'{}\n{}\n{}'.format(self.shipName, u'─' * 20, self.shipTrait))) self.padding = 4 self.editWidth = 150 diff --git a/service/fit.py b/service/fit.py index ea072b829..727ba913f 100644 --- a/service/fit.py +++ b/service/fit.py @@ -73,6 +73,7 @@ class Fit(object): "openFitInNew": False, "priceSystem": "Jita", "useStaticAdaptiveArmorHardener": False, + "showShipBrowserTooltip": True, } self.serviceFittingOptions = SettingsProvider.getInstance().getSettings( From a588aec978eb995291c99d35d066fe36601fd3e1 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 15 Mar 2017 15:53:40 -0700 Subject: [PATCH 03/12] Simple change to not try and reimport handlers if they have failed previously. --- eos/gamedata.py | 65 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/eos/gamedata.py b/eos/gamedata.py index 6b7aae34f..fe7eb2893 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -32,6 +32,8 @@ except ImportError: from logbook import Logger pyfalog = Logger(__name__) +# Keep a list of handlers that fail to import so we don't keep trying repeatedly. +badHandlers = [] class Effect(EqBase): @@ -159,34 +161,51 @@ class Effect(EqBase): Grab the handler, type and runTime from the effect code if it exists, if it doesn't, set dummy values and add a dummy handler """ - try: - self.__effectModule = effectModule = __import__('eos.effects.' + self.handlerName, fromlist=True) - self.__handler = getattr(effectModule, "handler", effectDummy) - self.__runTime = getattr(effectModule, "runTime", "normal") - self.__activeByDefault = getattr(effectModule, "activeByDefault", True) - t = getattr(effectModule, "type", None) + global badHandlers - t = t if isinstance(t, tuple) or t is None else (t,) - self.__type = t - except (ImportError) as e: - # Effect probably doesn't exist, so create a dummy effect and flag it with a warning. + # Skip if we've tried to import before and failed + if self.handlerName not in badHandlers: + try: + self.__effectModule = effectModule = __import__('eos.effects.' + self.handlerName, fromlist=True) + self.__handler = getattr(effectModule, "handler", effectDummy) + self.__runTime = getattr(effectModule, "runTime", "normal") + self.__activeByDefault = getattr(effectModule, "activeByDefault", True) + t = getattr(effectModule, "type", None) + + t = t if isinstance(t, tuple) or t is None else (t,) + self.__type = t + except (ImportError) as e: + # Effect probably doesn't exist, so create a dummy effect and flag it with a warning. + self.__handler = effectDummy + self.__runTime = "normal" + self.__activeByDefault = True + self.__type = None + pyfalog.debug("ImportError generating handler: {0}", e) + badHandlers.append(self.handlerName) + except (AttributeError) as e: + # Effect probably exists but there is an issue with it. Turn it into a dummy effect so we can continue, but flag it with an error. + self.__handler = effectDummy + self.__runTime = "normal" + self.__activeByDefault = True + self.__type = None + pyfalog.error("AttributeError generating handler: {0}", e) + badHandlers.append(self.handlerName) + except Exception as e: + self.__handler = effectDummy + self.__runTime = "normal" + self.__activeByDefault = True + self.__type = None + pyfalog.critical("Exception generating handler:") + pyfalog.critical(e) + badHandlers.append(self.handlerName) + + self.__generated = True + else: + # We've already failed on this one, just pass a dummy effect back self.__handler = effectDummy self.__runTime = "normal" self.__activeByDefault = True self.__type = None - pyfalog.warning("ImportError generating handler: {0}", e) - except (AttributeError) as e: - # Effect probably exists but there is an issue with it. Turn it into a dummy effect so we can continue, but flag it with an error. - self.__handler = effectDummy - self.__runTime = "normal" - self.__activeByDefault = True - self.__type = None - pyfalog.error("AttributeError generating handler: {0}", e) - except Exception as e: - pyfalog.critical("Exception generating handler:") - pyfalog.critical(e) - - self.__generated = True def getattr(self, key): if not self.__generated: From 6c1d949cef58d0a601a6056257cd3f657f1c397f Mon Sep 17 00:00:00 2001 From: blitzman Date: Wed, 22 Mar 2017 21:50:02 -0400 Subject: [PATCH 04/12] Proof of concept for gathering fits based on modules that are fit --- eos/db/saveddata/queries.py | 16 ++++++---------- gui/commandView.py | 10 ++++++++++ service/fit.py | 11 +++-------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/eos/db/saveddata/queries.py b/eos/db/saveddata/queries.py index 16f6a3bf9..f1f947296 100644 --- a/eos/db/saveddata/queries.py +++ b/eos/db/saveddata/queries.py @@ -30,6 +30,7 @@ from eos.saveddata.targetResists import TargetResists from eos.saveddata.character import Character from eos.saveddata.implantSet import ImplantSet from eos.saveddata.fit import Fit +from eos.saveddata.module import Module from eos.saveddata.miscData import MiscData from eos.saveddata.override import Override @@ -241,22 +242,17 @@ def getFitsWithShip(shipID, ownerID=None, where=None, eager=None): return fits -def getBoosterFits(ownerID=None, where=None, eager=None): +def getFitsWithModules(typeIDs, eager=None): """ - Get all the fits that are flagged as a boosting ship - If no user is passed, do this for all users. + Get all the fits that have typeIDs fitted to them """ - if ownerID is not None and not isinstance(ownerID, int): - raise TypeError("OwnerID must be integer") - filter = Fit.booster == 1 - if ownerID is not None: - filter = and_(filter, Fit.ownerID == ownerID) + if not hasattr(typeIDs, "__iter__"): + typeIDs = (typeIDs,) - filter = processWhere(filter, where) eager = processEager(eager) with sd_lock: - fits = removeInvalid(saveddata_session.query(Fit).options(*eager).filter(filter).all()) + fits = removeInvalid(saveddata_session.query(Fit).join(Module).options(*eager).filter(Module.itemID.in_(typeIDs)).all()) return fits diff --git a/gui/commandView.py b/gui/commandView.py index 38dec46c9..d32629974 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -26,6 +26,7 @@ import gui.droneView from gui.builtinViewColumns.state import State from gui.contextMenu import ContextMenu from service.fit import Fit +from service.market import Market from eos.saveddata.drone import Drone as es_Drone @@ -63,6 +64,15 @@ class CommandView(d.Display): self.lastFitId = None + # Get list of items that define a command fit + sMkt = Market.getInstance() + grp = sMkt.getGroup(1770) # Command burst group + self.commandTypeIDs = [item.ID for item in grp.items] + + sFit = Fit.getInstance() + commandFits = sFit.getFitsWithModules(self.commandTypeIDs) + print (commandFits) + self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged) self.Bind(wx.EVT_LEFT_DOWN, self.click) self.Bind(wx.EVT_RIGHT_DOWN, self.click) diff --git a/service/fit.py b/service/fit.py index 0bb385894..58410f200 100644 --- a/service/fit.py +++ b/service/fit.py @@ -95,15 +95,10 @@ class Fit(object): return names @staticmethod - def getBoosterFits(): + def getFitsWithModules(typeIDs): """ Lists fits flagged as booster """ - pyfalog.debug("Fetching all fits flagged as a booster.") - fits = eos.db.getBoosterFits() - names = [] - for fit in fits: - names.append((fit.ID, fit.name, fit.shipID)) - - return names + fits = eos.db.getFitsWithModules(typeIDs) + return fits @staticmethod def countAllFits(): From 40650228663b803dac958f1453e2f9c6d5df1a0b Mon Sep 17 00:00:00 2001 From: blitzman Date: Wed, 22 Mar 2017 23:00:20 -0400 Subject: [PATCH 05/12] Initial work on caching command fits unless needing to update. FitChanged event can now carry an action and typeID, only used in the CommandFit context menu (for now, can use this elsewhere). If the module being added or removed, we update the cached list. --- gui/builtinContextMenus/commandFits.py | 46 ++++++++++++++++++++++++++ gui/builtinViews/fittingView.py | 12 ++++--- gui/cargoView.py | 2 +- gui/commandView.py | 13 ++------ gui/contextMenu.py | 1 + 5 files changed, 59 insertions(+), 15 deletions(-) create mode 100644 gui/builtinContextMenus/commandFits.py diff --git a/gui/builtinContextMenus/commandFits.py b/gui/builtinContextMenus/commandFits.py new file mode 100644 index 000000000..bb26766e8 --- /dev/null +++ b/gui/builtinContextMenus/commandFits.py @@ -0,0 +1,46 @@ +# noinspection PyPackageRequirements +import wx + +from service.fit import Fit +from service.market import Market +import gui.mainFrame +from gui.contextMenu import ContextMenu +from service.settings import ContextMenuSettings + +class CommandFits(ContextMenu): + # Get list of items that define a command fit + sMkt = Market.getInstance() + grp = sMkt.getGroup(1770) # Command burst group + commandTypeIDs = [item.ID for item in grp.items] + commandFits = [] + menu = None + + @classmethod + def populateFits(cls, evt): + if evt is None or (getattr(evt, 'action', None) in ("modadd", "moddel") and getattr(evt, 'typeID', None) in cls.commandTypeIDs): + # we are adding or removing an item that defines a command fit. Need to refresh fit list + sFit = Fit.getInstance() + cls.commandFits = sFit.getFitsWithModules(cls.commandTypeIDs) + print (cls.commandFits) + #todo: create menu here. + pass + + def __init__(self): + print (self.__class__.commandTypeIDs) + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + self.settings = ContextMenuSettings.getInstance() + + def display(self, srcContext, selection): + # todo: the whole thing + return False + + def getText(self, itmContext, selection): + return "Command Fits" + + def getSubMenu(self, context, selection, rootMenu, i, pitem): + if self.__class__.menu is None: + self.__class__.populateFits() + return self.__class__.menu + + +CommandFits.register() diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 496cf4fb8..01eb3ff66 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -334,7 +334,7 @@ class FittingView(d.Display): populate = sFit.appendModule(fitID, itemID) if populate is not None: self.slotsChanged() - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID, action="modadd", typeID=itemID)) event.Skip() @@ -355,7 +355,7 @@ class FittingView(d.Display): if populate is not None: self.slotsChanged() - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.activeFitID)) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.activeFitID, action="moddel", typeID=module.item.ID)) def addModule(self, x, y, srcIdx): """Add a module from the market browser""" @@ -368,7 +368,8 @@ class FittingView(d.Display): if moduleChanged is None: # the new module doesn't fit in specified slot, try to simply append it wx.PostEvent(self.mainFrame, gui.marketBrowser.ItemSelected(itemID=srcIdx)) - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) + + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit(), action="modadd", typeID=srcIdx)) def swapCargo(self, x, y, srcIdx): """Swap a module from cargo to fitting window""" @@ -379,10 +380,13 @@ class FittingView(d.Display): module = self.mods[dstRow] sFit = Fit.getInstance() + fit = sFit.getFit(self.activeFitID) + typeID = fit.cargo[srcIdx].item.ID + sFit.moveCargoToModule(self.mainFrame.getActiveFit(), module.modPosition, srcIdx, mstate.CmdDown() and module.isEmpty) - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit(), action="modadd", typeID=typeID)) def swapItems(self, x, y, srcIdx): """Swap two modules in fitting window""" diff --git a/gui/cargoView.py b/gui/cargoView.py index d997afa79..cd560c1c2 100644 --- a/gui/cargoView.py +++ b/gui/cargoView.py @@ -125,7 +125,7 @@ class CargoView(d.Display): if not mstate.CmdDown(): # if not copying, remove module sFit.removeModule(self.mainFrame.getActiveFit(), module.position) - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit(), action="moddel", typeID=module.item.ID)) def fitChanged(self, event): sFit = Fit.getInstance() diff --git a/gui/commandView.py b/gui/commandView.py index d32629974..7b79f6b85 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -23,10 +23,11 @@ import gui.display as d import gui.globalEvents as GE import gui.droneView +import gui.marketBrowser as marketBrowser from gui.builtinViewColumns.state import State from gui.contextMenu import ContextMenu +from gui.builtinContextMenus.commandFits import CommandFits from service.fit import Fit -from service.market import Market from eos.saveddata.drone import Drone as es_Drone @@ -64,15 +65,7 @@ class CommandView(d.Display): self.lastFitId = None - # Get list of items that define a command fit - sMkt = Market.getInstance() - grp = sMkt.getGroup(1770) # Command burst group - self.commandTypeIDs = [item.ID for item in grp.items] - - sFit = Fit.getInstance() - commandFits = sFit.getFitsWithModules(self.commandTypeIDs) - print (commandFits) - + self.mainFrame.Bind(GE.FIT_CHANGED, CommandFits.populateFits) self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged) self.Bind(wx.EVT_LEFT_DOWN, self.click) self.Bind(wx.EVT_RIGHT_DOWN, self.click) diff --git a/gui/contextMenu.py b/gui/contextMenu.py index a35c73282..adfeeb324 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -205,4 +205,5 @@ from gui.builtinContextMenus import ( # noqa: E402,F401 metaSwap, implantSets, fighterAbilities, + commandFits, ) From 732386b83abe00d3dc4ce6c0b8936c6de3d11c39 Mon Sep 17 00:00:00 2001 From: blitzman Date: Thu, 23 Mar 2017 00:29:31 -0400 Subject: [PATCH 06/12] Get command fit menu up and running. Had to revert to a non-cached version of the menu, as the instance has root menu, which we need in order to properly bind. Don't think caching the menu would have really given a large performance gain anyway. --- gui/builtinContextMenus/commandFits.py | 67 ++++++++++++++++++++++---- gui/commandView.py | 4 +- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/gui/builtinContextMenus/commandFits.py b/gui/builtinContextMenus/commandFits.py index bb26766e8..17f60f512 100644 --- a/gui/builtinContextMenus/commandFits.py +++ b/gui/builtinContextMenus/commandFits.py @@ -21,26 +21,75 @@ class CommandFits(ContextMenu): # we are adding or removing an item that defines a command fit. Need to refresh fit list sFit = Fit.getInstance() cls.commandFits = sFit.getFitsWithModules(cls.commandTypeIDs) - print (cls.commandFits) - #todo: create menu here. - pass def __init__(self): - print (self.__class__.commandTypeIDs) self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.settings = ContextMenuSettings.getInstance() def display(self, srcContext, selection): - # todo: the whole thing - return False + if self.mainFrame.getActiveFit() is None or len(self.__class__.commandFits) == 0 or srcContext != "commandView": + return False + + return True def getText(self, itmContext, selection): return "Command Fits" + def addFit(self, menu, fit, includeShip=False): + label = fit.name if not includeShip else "({}) {}".format(fit.ship.item.name, fit.name) + id = ContextMenu.nextID() + self.fitMenuItemIds[id] = fit + menuItem = wx.MenuItem(menu, id, label) + menu.Bind(wx.EVT_MENU, self.handleSelection, menuItem) + return menuItem + def getSubMenu(self, context, selection, rootMenu, i, pitem): - if self.__class__.menu is None: - self.__class__.populateFits() - return self.__class__.menu + msw = True if "wxMSW" in wx.PlatformInfo else False + self.context = context + self.fitMenuItemIds = {} + sub = wx.Menu() + if len(self.__class__.commandFits) < 15: + for fit in sorted(self.__class__.commandFits, key=lambda x: x.name): + print fit + menuItem = self.addFit(rootMenu if msw else sub, fit, True) + sub.AppendItem(menuItem) + else: + typeDict = {} + + for fit in self.__class__.commandFits: + shipName = fit.ship.item.name + if shipName not in typeDict: + typeDict[shipName] = [] + typeDict[shipName].append(fit) + + for ship in sorted(typeDict.keys()): + shipItem = wx.MenuItem(sub, ContextMenu.nextID(), ship) + grandSub = wx.Menu() + shipItem.SetSubMenu(grandSub) + + for fit in sorted(typeDict[ship], key=lambda x: x.name): + fitItem = self.addFit(rootMenu if msw else grandSub, fit, False) + grandSub.AppendItem(fitItem) + + sub.AppendItem(shipItem) + + return sub + + def handleSelection(self, event): + fit = self.fitMenuItemIds[event.Id] + if fit is False or fit not in self.__class__.commandFits: + event.Skip() + return + + sFit = Fit.getInstance() + fitID = self.mainFrame.getActiveFit() + + print fit, 'selected' + # add command fit + # sFit.toggleFighterAbility(fitID, fit) + # wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) + +CommandFits.populateFits(None) CommandFits.register() diff --git a/gui/commandView.py b/gui/commandView.py index 7b79f6b85..7b74a39e9 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -197,13 +197,13 @@ class CommandView(d.Display): fitSrcContext = "commandFit" fitItemContext = item.name context = ((fitSrcContext, fitItemContext),) - context += ("command",), + context += ("commandView",), menu = ContextMenu.getMenu((item,), *context) elif sel == -1: fitID = self.mainFrame.getActiveFit() if fitID is None: return - context = (("command",),) + context = (("commandView",),) menu = ContextMenu.getMenu([], *context) if menu is not None: self.PopupMenu(menu) From cbcc81d42e2e143247f2185e2f60653ab5334c2d Mon Sep 17 00:00:00 2001 From: blitzman Date: Thu, 23 Mar 2017 00:33:06 -0400 Subject: [PATCH 07/12] Actually apply the command fit, and remove print statement --- gui/builtinContextMenus/commandFits.py | 7 +++---- gui/builtinStatsViews/targetingMiscViewMinimal.py | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/gui/builtinContextMenus/commandFits.py b/gui/builtinContextMenus/commandFits.py index 17f60f512..0490aa44b 100644 --- a/gui/builtinContextMenus/commandFits.py +++ b/gui/builtinContextMenus/commandFits.py @@ -4,6 +4,7 @@ import wx from service.fit import Fit from service.market import Market import gui.mainFrame +import gui.globalEvents as GE from gui.contextMenu import ContextMenu from service.settings import ContextMenuSettings @@ -86,10 +87,8 @@ class CommandFits(ContextMenu): sFit = Fit.getInstance() fitID = self.mainFrame.getActiveFit() - print fit, 'selected' - # add command fit - # sFit.toggleFighterAbility(fitID, fit) - # wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) + sFit.addCommandFit(fitID, fit) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) CommandFits.populateFits(None) CommandFits.register() diff --git a/gui/builtinStatsViews/targetingMiscViewMinimal.py b/gui/builtinStatsViews/targetingMiscViewMinimal.py index 4dffc9e40..df0d9f70a 100644 --- a/gui/builtinStatsViews/targetingMiscViewMinimal.py +++ b/gui/builtinStatsViews/targetingMiscViewMinimal.py @@ -242,7 +242,6 @@ class TargetingMiscViewMinimal(StatsView): # forces update of probe size, since this stat is used by both sig radius and sensor str if labelName == "labelFullSigRadius": - print "labelName" if fit: label.SetToolTip(wx.ToolTip("Probe Size: %.3f" % (fit.probeSize or 0))) else: From 79040adf1a846d159d52b518356d3f75562ae731 Mon Sep 17 00:00:00 2001 From: blitzman Date: Thu, 23 Mar 2017 01:13:41 -0400 Subject: [PATCH 08/12] tox fixes --- gui/builtinContextMenus/cargoAmmo.py | 1 - gui/builtinContextMenus/commandFits.py | 4 +++- gui/builtinContextMenus/droneStack.py | 1 - gui/commandView.py | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gui/builtinContextMenus/cargoAmmo.py b/gui/builtinContextMenus/cargoAmmo.py index 57ae42517..12ebe552f 100644 --- a/gui/builtinContextMenus/cargoAmmo.py +++ b/gui/builtinContextMenus/cargoAmmo.py @@ -1,6 +1,5 @@ from gui.contextMenu import ContextMenu import gui.mainFrame -import service import gui.globalEvents as GE import wx from service.settings import ContextMenuSettings diff --git a/gui/builtinContextMenus/commandFits.py b/gui/builtinContextMenus/commandFits.py index 0490aa44b..9640a83ef 100644 --- a/gui/builtinContextMenus/commandFits.py +++ b/gui/builtinContextMenus/commandFits.py @@ -8,6 +8,7 @@ import gui.globalEvents as GE from gui.contextMenu import ContextMenu from service.settings import ContextMenuSettings + class CommandFits(ContextMenu): # Get list of items that define a command fit sMkt = Market.getInstance() @@ -80,7 +81,7 @@ class CommandFits(ContextMenu): def handleSelection(self, event): fit = self.fitMenuItemIds[event.Id] - if fit is False or fit not in self.__class__.commandFits: + if fit is False or fit not in self.__class__.commandFits: event.Skip() return @@ -90,5 +91,6 @@ class CommandFits(ContextMenu): sFit.addCommandFit(fitID, fit) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) + CommandFits.populateFits(None) CommandFits.register() diff --git a/gui/builtinContextMenus/droneStack.py b/gui/builtinContextMenus/droneStack.py index 150b76676..99a253796 100644 --- a/gui/builtinContextMenus/droneStack.py +++ b/gui/builtinContextMenus/droneStack.py @@ -1,6 +1,5 @@ from gui.contextMenu import ContextMenu import gui.mainFrame -import service import gui.globalEvents as GE import wx from service.settings import ContextMenuSettings diff --git a/gui/commandView.py b/gui/commandView.py index 7b74a39e9..d295c7939 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -23,7 +23,6 @@ import gui.display as d import gui.globalEvents as GE import gui.droneView -import gui.marketBrowser as marketBrowser from gui.builtinViewColumns.state import State from gui.contextMenu import ContextMenu from gui.builtinContextMenus.commandFits import CommandFits From 024edc500fc4bbd48b7b355ed283075521ad818e Mon Sep 17 00:00:00 2001 From: blitzman Date: Sun, 26 Mar 2017 13:35:46 -0400 Subject: [PATCH 09/12] Fix settings provider --- service/settings.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/service/settings.py b/service/settings.py index 69dc8130d..3da94b084 100644 --- a/service/settings.py +++ b/service/settings.py @@ -74,8 +74,6 @@ class SettingsProvider(object): info[item] = defaults[item] self.settings[area] = s = Settings(p, info) - else: - s = None return s From d928df9c69b7ef57071546cda6118c04a904aa37 Mon Sep 17 00:00:00 2001 From: blitzman Date: Sun, 26 Mar 2017 14:28:13 -0400 Subject: [PATCH 10/12] Move `useStaticAdaptiveArmorHardener` to the EOSSettings. Not moving force reload for now --- eos/config.py | 2 +- eos/effects/adaptivearmorhardener.py | 5 ++--- eos/effects/tractorbeamcan.py | 1 - gui/builtinPreferenceViews/pyfaDatabasePreferences.py | 1 - gui/builtinPreferenceViews/pyfaEnginePreferences.py | 10 ++++++---- gui/builtinPreferenceViews/pyfaLoggingPreferences.py | 1 - service/fit.py | 1 - 7 files changed, 9 insertions(+), 12 deletions(-) diff --git a/eos/config.py b/eos/config.py index 9dc0eabbc..b8454b1f2 100644 --- a/eos/config.py +++ b/eos/config.py @@ -22,7 +22,7 @@ else: pyfalog.debug("Saveddata connection string: {0}", saveddata_connectionstring) settings = { - "setting1": True + "useStaticAdaptiveArmorHardener": False } # Autodetect path, only change if the autodetection bugs out. diff --git a/eos/effects/adaptivearmorhardener.py b/eos/effects/adaptivearmorhardener.py index 42c50a610..246c67fcf 100644 --- a/eos/effects/adaptivearmorhardener.py +++ b/eos/effects/adaptivearmorhardener.py @@ -3,7 +3,7 @@ # Used by: # Module: Reactive Armor Hardener from logbook import Logger -from service.fit import Fit +import eos.config pyfalog = Logger(__name__) @@ -14,8 +14,7 @@ type = "active" def handler(fit, module, context): damagePattern = fit.damagePattern - sFit = Fit.getInstance() - static_adaptive_behavior = sFit.serviceFittingOptions["useStaticAdaptiveArmorHardener"] + static_adaptive_behavior = eos.config.settings['useStaticAdaptiveArmorHardener'] if (damagePattern.emAmount == damagePattern.thermalAmount == damagePattern.kineticAmount == damagePattern.explosiveAmount) and static_adaptive_behavior: pyfalog.debug("Setting adaptivearmorhardener resists to uniform profile.") diff --git a/eos/effects/tractorbeamcan.py b/eos/effects/tractorbeamcan.py index 2c7f8eae3..3f0d21230 100644 --- a/eos/effects/tractorbeamcan.py +++ b/eos/effects/tractorbeamcan.py @@ -7,5 +7,4 @@ type = "active" def handler(fit, module, context): - print settings['setting1'] pass diff --git a/gui/builtinPreferenceViews/pyfaDatabasePreferences.py b/gui/builtinPreferenceViews/pyfaDatabasePreferences.py index b8647ef2f..608dc0197 100644 --- a/gui/builtinPreferenceViews/pyfaDatabasePreferences.py +++ b/gui/builtinPreferenceViews/pyfaDatabasePreferences.py @@ -14,7 +14,6 @@ class PFGeneralPref(PreferenceView): def populatePanel(self, panel): self.dirtySettings = False - # self.openFitsSettings = service.SettingsProvider.getInstance().getSettings("pyfaPrevOpenFits", {"enabled": False, "pyfaOpenFits": []}) mainSizer = wx.BoxSizer(wx.VERTICAL) diff --git a/gui/builtinPreferenceViews/pyfaEnginePreferences.py b/gui/builtinPreferenceViews/pyfaEnginePreferences.py index 415264436..e2c7ac3d5 100644 --- a/gui/builtinPreferenceViews/pyfaEnginePreferences.py +++ b/gui/builtinPreferenceViews/pyfaEnginePreferences.py @@ -5,6 +5,7 @@ import wx from service.fit import Fit from gui.bitmapLoader import BitmapLoader from gui.preferenceView import PreferenceView +from service.settings import EOSSettings logger = logging.getLogger(__name__) @@ -20,10 +21,11 @@ class PFFittingEnginePref(PreferenceView): # noinspection PyAttributeOutsideInit def populatePanel(self, panel): - # self.openFitsSettings = service.SettingsProvider.getInstance().getSettings("pyfaPrevOpenFits", {"enabled": False, "pyfaOpenFits": []}) mainSizer = wx.BoxSizer(wx.VERTICAL) + self.engine_settings = EOSSettings.getInstance() + self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0) self.stTitle.Wrap(-1) self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) @@ -36,7 +38,7 @@ class PFFittingEnginePref(PreferenceView): wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbGlobalForceReload, 0, wx.ALL | wx.EXPAND, 5) - self.cbUniversalAdaptiveArmorHardener = wx.CheckBox(panel, wx.ID_ANY, u"When damage profile is even, set Reactive Armor Hardener to match (old behavior).", + self.cbUniversalAdaptiveArmorHardener = wx.CheckBox(panel, wx.ID_ANY, u"When damage profile is Uniform, set Reactive Armor Hardener to match (old behavior).", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbUniversalAdaptiveArmorHardener, 0, wx.ALL | wx.EXPAND, 5) @@ -69,7 +71,7 @@ class PFFittingEnginePref(PreferenceView): self.cbGlobalForceReload.SetValue(self.sFit.serviceFittingOptions["useGlobalForceReload"]) self.cbGlobalForceReload.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalForceReloadStateChange) - self.cbUniversalAdaptiveArmorHardener.SetValue(self.sFit.serviceFittingOptions["useStaticAdaptiveArmorHardener"]) + self.cbUniversalAdaptiveArmorHardener.SetValue(self.engine_settings.get("useStaticAdaptiveArmorHardener")) self.cbUniversalAdaptiveArmorHardener.Bind(wx.EVT_CHECKBOX, self.OnCBUniversalAdaptiveArmorHardenerChange) panel.SetSizer(mainSizer) @@ -79,7 +81,7 @@ class PFFittingEnginePref(PreferenceView): self.sFit.serviceFittingOptions["useGlobalForceReload"] = self.cbGlobalForceReload.GetValue() def OnCBUniversalAdaptiveArmorHardenerChange(self, event): - self.sFit.serviceFittingOptions["useStaticAdaptiveArmorHardener"] = self.cbUniversalAdaptiveArmorHardener.GetValue() + self.engine_settings.set("useStaticAdaptiveArmorHardener", self.cbUniversalAdaptiveArmorHardener.GetValue()) def getImage(self): return BitmapLoader.getBitmap("settings_fitting", "gui") diff --git a/gui/builtinPreferenceViews/pyfaLoggingPreferences.py b/gui/builtinPreferenceViews/pyfaLoggingPreferences.py index 8aa140f97..5a7ffccc1 100644 --- a/gui/builtinPreferenceViews/pyfaLoggingPreferences.py +++ b/gui/builtinPreferenceViews/pyfaLoggingPreferences.py @@ -17,7 +17,6 @@ class PFGeneralPref(PreferenceView): def populatePanel(self, panel): self.dirtySettings = False - # self.openFitsSettings = service.SettingsProvider.getInstance().getSettings("pyfaPrevOpenFits", {"enabled": False, "pyfaOpenFits": []}) mainSizer = wx.BoxSizer(wx.VERTICAL) diff --git a/service/fit.py b/service/fit.py index c1ce66f45..cbcbd7e4c 100644 --- a/service/fit.py +++ b/service/fit.py @@ -73,7 +73,6 @@ class Fit(object): "exportCharges": True, "openFitInNew": False, "priceSystem": "Jita", - "useStaticAdaptiveArmorHardener": False, "showShipBrowserTooltip": True, } From e7de57fc7a066a0c9ae1021ad60437d1a68a1b23 Mon Sep 17 00:00:00 2001 From: blitzman Date: Sun, 26 Mar 2017 14:39:45 -0400 Subject: [PATCH 11/12] tox fixes --- eos/effects/tractorbeamcan.py | 1 - gui/builtinPreferenceViews/pyfaEnginePreferences.py | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eos/effects/tractorbeamcan.py b/eos/effects/tractorbeamcan.py index 3f0d21230..293a839ea 100644 --- a/eos/effects/tractorbeamcan.py +++ b/eos/effects/tractorbeamcan.py @@ -2,7 +2,6 @@ # # Used by: # Modules from group: Tractor Beam (4 of 4) -from eos.config import settings type = "active" diff --git a/gui/builtinPreferenceViews/pyfaEnginePreferences.py b/gui/builtinPreferenceViews/pyfaEnginePreferences.py index e2c7ac3d5..4a0f421bc 100644 --- a/gui/builtinPreferenceViews/pyfaEnginePreferences.py +++ b/gui/builtinPreferenceViews/pyfaEnginePreferences.py @@ -38,8 +38,10 @@ class PFFittingEnginePref(PreferenceView): wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbGlobalForceReload, 0, wx.ALL | wx.EXPAND, 5) - self.cbUniversalAdaptiveArmorHardener = wx.CheckBox(panel, wx.ID_ANY, u"When damage profile is Uniform, set Reactive Armor Hardener to match (old behavior).", - wx.DefaultPosition, wx.DefaultSize, 0) + self.cbUniversalAdaptiveArmorHardener = wx.CheckBox(panel, wx.ID_ANY, + u"When damage profile is Uniform, set Reactive Armor " + + u"Hardener to match (old behavior).", + wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbUniversalAdaptiveArmorHardener, 0, wx.ALL | wx.EXPAND, 5) # Future code once new cap sim is implemented From cb77987129c485ae459dea0a2060ae3f6e00177d Mon Sep 17 00:00:00 2001 From: blitzman Date: Sun, 26 Mar 2017 23:51:05 -0400 Subject: [PATCH 12/12] Fix an exception caused by too few variables for string formatting --- service/fit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/fit.py b/service/fit.py index 36170f1f8..e117bb043 100644 --- a/service/fit.py +++ b/service/fit.py @@ -421,7 +421,7 @@ class Fit(object): self.recalc(fit) def changeActiveFighters(self, fitID, fighter, amount): - pyfalog.debug("Changing active fighters ({0}) for fit ({1}) to amount: {2}", fighter.itemID, amount) + pyfalog.debug("Changing active fighters ({0}) for fit ({1}) to amount: {2}", fighter.itemID, fitID, amount) fit = eos.db.getFit(fitID) fighter.amountActive = amount