From 7865219164f35cbc9a4e0fceb26667bcc232967a Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 00:56:33 -0800 Subject: [PATCH] Add a ton of default values --- eos/db/saveddata/databaseRepair.py | 3 ++- eos/db/saveddata/fit.py | 6 +++++ eos/effectHandlerHelpers.py | 4 +++ eos/eqBase.py | 2 ++ eos/gamedata.py | 37 +++++++++++++++++++++++--- eos/saveddata/character.py | 4 +++ eos/saveddata/crestchar.py | 3 +++ eos/saveddata/damagePattern.py | 3 +++ eos/saveddata/fighter.py | 1 + eos/saveddata/fighterAbility.py | 1 + eos/saveddata/fit.py | 12 +++++++++ eos/saveddata/implant.py | 2 ++ eos/saveddata/module.py | 2 ++ eos/saveddata/override.py | 2 ++ eos/saveddata/targetResists.py | 2 ++ eos/saveddata/user.py | 3 +++ gui/builtinStatsViews/priceViewFull.py | 3 +++ gui/builtinViews/fittingView.py | 6 +++-- gui/display.py | 2 ++ gui/mainFrame.py | 1 + gui/patternEditor.py | 2 ++ gui/statsView.py | 1 + gui/viewColumn.py | 1 + pyfa.py | 4 +++ service/eveapi.py | 2 ++ service/fit.py | 1 + service/market.py | 1 + 27 files changed, 104 insertions(+), 7 deletions(-) diff --git a/eos/db/saveddata/databaseRepair.py b/eos/db/saveddata/databaseRepair.py index 67339b3a7..cbdc0b245 100644 --- a/eos/db/saveddata/databaseRepair.py +++ b/eos/db/saveddata/databaseRepair.py @@ -18,6 +18,7 @@ # =============================================================================== import sqlalchemy +from sqlalchemy.exc import DatabaseError import logging logger = logging.getLogger(__name__) @@ -32,7 +33,7 @@ class DatabaseCleanup(object): try: results = saveddata_engine.execute(query) return results - except sqlalchemy.exc.DatabaseError: + except DatabaseError: logger.error("Failed to connect to database or error executing query:\n%s", query) return None diff --git a/eos/db/saveddata/fit.py b/eos/db/saveddata/fit.py index 8cbdb4d6f..2f681a372 100644 --- a/eos/db/saveddata/fit.py +++ b/eos/db/saveddata/fit.py @@ -74,6 +74,9 @@ commandFits_table = Table("commandFits", saveddata_meta, class ProjectedFit(object): + victim_fit = None + victimID = None + def __init__(self, sourceID, source_fit, amount=1, active=True): self.sourceID = sourceID self.source_fit = source_fit @@ -105,6 +108,9 @@ class ProjectedFit(object): class CommandFit(object): + boosted_fit = None + boostedID = None + def __init__(self, boosterID, booster_fit, active=True): self.boosterID = boosterID self.booster_fit = booster_fit diff --git a/eos/effectHandlerHelpers.py b/eos/effectHandlerHelpers.py index daa68c5c4..7c3837e7a 100644 --- a/eos/effectHandlerHelpers.py +++ b/eos/effectHandlerHelpers.py @@ -242,6 +242,8 @@ class HandledProjectedDroneList(HandledDroneCargoList): class HandledItem(object): + itemModifiedAttributes = None + def preAssignItemAttr(self, *args, **kwargs): self.itemModifiedAttributes.preAssign(*args, **kwargs) @@ -259,6 +261,8 @@ class HandledItem(object): class HandledCharge(object): + chargeModifiedAttributes = None + def preAssignChargeAttr(self, *args, **kwargs): self.chargeModifiedAttributes.preAssign(*args, **kwargs) diff --git a/eos/eqBase.py b/eos/eqBase.py index 2b8d35b33..85a9d1b31 100644 --- a/eos/eqBase.py +++ b/eos/eqBase.py @@ -19,6 +19,8 @@ class EqBase(object): + ID = None + def __eq__(self, other): return type(self) == type(other) and self.ID == other.ID diff --git a/eos/gamedata.py b/eos/gamedata.py index ce32d3ab7..8e0c1806c 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -45,6 +45,9 @@ class Effect(EqBase): # Filter to change names of effects to valid python method names nameFilter = re.compile("[^A-Za-z0-9]") + def __init__(self): + self.name = None + @reconstructor def init(self): """ @@ -201,12 +204,25 @@ def effectDummy(*args, **kwargs): class Item(EqBase): + typeID = None + name = None + group = None + effects = None + raceID = None + factionID = None + category = None + ID = None + __attributes = None + MOVE_ATTRS = (4, # Mass 38, # Capacity 161) # Volume MOVE_ATTR_INFO = None + def __init__(self): + pass + @classmethod def getMoveAttrInfo(cls): info = getattr(cls, "MOVE_ATTR_INFO", None) @@ -435,18 +451,22 @@ class EffectInfo(EqBase): class AttributeInfo(EqBase): - pass + name = None class Attribute(EqBase): - pass + value = None + attributeID = None class Category(EqBase): - pass + name = None class AlphaClone(EqBase): + def __init__(self): + self.skills = None + @reconstructor def init(self): self.skillCache = {} @@ -466,7 +486,8 @@ class AlphaCloneSkill(EqBase): class Group(EqBase): - pass + category = None + name = None class Icon(EqBase): @@ -474,6 +495,11 @@ class Icon(EqBase): class MarketGroup(EqBase): + def __init__(self): + self.parent = None + self.name = None + self.ID = None + def __repr__(self): return u"MarketGroup(ID={}, name={}, parent={}) at {}".format( self.ID, self.name, getattr(self.parent, "name", None), self.name, hex(id(self)) @@ -485,6 +511,9 @@ class MetaGroup(EqBase): class MetaType(EqBase): + def __init__(self): + self.parent = None + pass diff --git a/eos/saveddata/character.py b/eos/saveddata/character.py index 142166041..e5837f71d 100644 --- a/eos/saveddata/character.py +++ b/eos/saveddata/character.py @@ -31,9 +31,13 @@ logger = logging.getLogger(__name__) class Character(object): + ownerID = None + savedName = None + ID = None __itemList = None __itemIDMap = None __itemNameMap = None + apiID = None @classmethod def getSkillList(cls): diff --git a/eos/saveddata/crestchar.py b/eos/saveddata/crestchar.py index 51a32fe26..c4584b3e3 100644 --- a/eos/saveddata/crestchar.py +++ b/eos/saveddata/crestchar.py @@ -24,6 +24,9 @@ from sqlalchemy.orm import reconstructor class CrestChar(object): + name = None + ID = None + def __init__(self, id, name, refresh_token=None): self.ID = id self.name = name diff --git a/eos/saveddata/damagePattern.py b/eos/saveddata/damagePattern.py index f10e6b50b..5eb69cad0 100644 --- a/eos/saveddata/damagePattern.py +++ b/eos/saveddata/damagePattern.py @@ -21,6 +21,9 @@ import re class DamagePattern(object): + name = None + ID = None + Name = None DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive") def __init__(self, emAmount=25, thermalAmount=25, kineticAmount=25, explosiveAmount=25): diff --git a/eos/saveddata/fighter.py b/eos/saveddata/fighter.py index 1e3e5f137..a4d2c349d 100644 --- a/eos/saveddata/fighter.py +++ b/eos/saveddata/fighter.py @@ -33,6 +33,7 @@ logger = logging.getLogger(__name__) class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): DAMAGE_TYPES = ("em", "kinetic", "explosive", "thermal") DAMAGE_TYPES2 = ("EM", "Kin", "Exp", "Therm") + owner = None def __init__(self, item): """Initialize a fighter from the program""" diff --git a/eos/saveddata/fighterAbility.py b/eos/saveddata/fighterAbility.py index cb7c34912..cae7497a7 100644 --- a/eos/saveddata/fighterAbility.py +++ b/eos/saveddata/fighterAbility.py @@ -27,6 +27,7 @@ logger = logging.getLogger(__name__) class FighterAbility(object): DAMAGE_TYPES = ("em", "kinetic", "explosive", "thermal") DAMAGE_TYPES2 = ("EM", "Kin", "Exp", "Therm") + fighter = None # We aren't able to get data on the charges that can be stored with fighters. So we hardcode that data here, keyed # with the fighter squadron role diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 3b4b7a99f..426f263e3 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -49,6 +49,18 @@ class ImplantLocation(Enum): class Fit(object): """Represents a fitting, with modules, ship, implants, etc.""" + name = None + shipID = None + booster = None + ownerID = None + __projectedFits = None + __commandFits = None + projectedOnto = None + boostedOnto = None + ID = None + owner = None + notes = None + PEAK_RECHARGE = 0.25 def __init__(self, ship=None, name=""): diff --git a/eos/saveddata/implant.py b/eos/saveddata/implant.py index 837642ca6..5d8a9a388 100644 --- a/eos/saveddata/implant.py +++ b/eos/saveddata/implant.py @@ -29,6 +29,8 @@ logger = logging.getLogger(__name__) class Implant(HandledItem, ItemAttrShortcut): + ID = None + def __init__(self, item): self.__item = item diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 993d54765..38c8e6dd1 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -71,6 +71,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): def __init__(self, item): """Initialize a module from the program""" + self.owner = None + self.dummySlot = None self.__item = item if item is not None and self.isInvalid: diff --git a/eos/saveddata/override.py b/eos/saveddata/override.py index c4f8a1e02..ba6ff4f14 100644 --- a/eos/saveddata/override.py +++ b/eos/saveddata/override.py @@ -28,6 +28,8 @@ logger = logging.getLogger(__name__) class Override(EqBase): + itemID = None + def __init__(self, item, attr, value): self.itemID = item.ID self.__item = item diff --git a/eos/saveddata/targetResists.py b/eos/saveddata/targetResists.py index 67cd323a8..3082fd319 100644 --- a/eos/saveddata/targetResists.py +++ b/eos/saveddata/targetResists.py @@ -22,6 +22,8 @@ import re class TargetResists(object): # also determined import/export order - VERY IMPORTANT + name = None + ID = None DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive") def __init__(self, emAmount=0, thermalAmount=0, kineticAmount=0, explosiveAmount=0): diff --git a/eos/saveddata/user.py b/eos/saveddata/user.py index 8c3905a0d..564199a9e 100644 --- a/eos/saveddata/user.py +++ b/eos/saveddata/user.py @@ -25,6 +25,9 @@ from sqlalchemy.orm import validates class User(object): + username = None + ID = None + def __init__(self, username, password=None, admin=False): self.username = username if password is not None: diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index e5e9b85a7..abda59de4 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -30,6 +30,9 @@ class PriceViewFull(StatsView): def __init__(self, parent): StatsView.__init__(self) + self.labelPriceTotal = None + self.labelPriceFittings = None + self.labelPriceShip = None self.parent = parent self._cachedShip = 0 self._cachedFittings = 0 diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 02a5ae6c0..94578d8ac 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -35,6 +35,8 @@ import gui.builtinViews.emptyView from gui.utils.exportHtml import exportHtml from logging import getLogger +from gui.chromeTabs import EVT_NOTEBOOK_PAGE_CHANGED + from service.fit import Fit from service.market import Market @@ -160,7 +162,7 @@ class FittingView(d.Display): self.Bind(wx.EVT_SHOW, self.OnShow) self.Bind(wx.EVT_MOTION, self.OnMouseMove) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow) - self.parent.Bind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) + self.parent.Bind(EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) def OnLeaveWindow(self, event): self.SetToolTip(None) @@ -209,7 +211,7 @@ class FittingView(d.Display): wx.PostEvent(self.mainFrame, gui.shipBrowser.FitSelected(fitID=fitID)) def Destroy(self): - self.parent.Unbind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, handler=self.pageChanged) + self.parent.Unbind(EVT_NOTEBOOK_PAGE_CHANGED, handler=self.pageChanged) self.mainFrame.Unbind(GE.FIT_CHANGED, handler=self.fitChanged) self.mainFrame.Unbind(gui.shipBrowser.EVT_FIT_RENAMED, handler=self.fitRenamed) self.mainFrame.Unbind(gui.shipBrowser.EVT_FIT_REMOVED, handler=self.fitRemoved) diff --git a/gui/display.py b/gui/display.py index 4bbdc7b40..dcc3f7343 100644 --- a/gui/display.py +++ b/gui/display.py @@ -26,6 +26,8 @@ from gui.cachingImageList import CachingImageList class Display(wx.ListCtrl): + DEFAULT_COLS = None + def __init__(self, parent, size=wx.DefaultSize, style=0): wx.ListCtrl.__init__(self, parent, size=size, style=wx.LC_REPORT | style) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 175e14ab2..85f04c741 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -90,6 +90,7 @@ if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION disableOverrideEditor = False except ImportError as e: + AttributeEditor = None print("Error loading Attribute Editor: %s.\nAccess to Attribute Editor is disabled." % e.message) disableOverrideEditor = True diff --git a/gui/patternEditor.py b/gui/patternEditor.py index ed63fd9a3..c0a9be80c 100644 --- a/gui/patternEditor.py +++ b/gui/patternEditor.py @@ -55,6 +55,8 @@ class DmgPatternTextValidor(BaseValidator): class DmgPatternEntityEditor(EntityEditor): def __init__(self, parent): EntityEditor.__init__(self, parent, "Damage Profile") + self.btnDelete = None + self.btnRename = None self.SetEditorValidator(DmgPatternTextValidor) def getEntitiesFromContext(self): diff --git a/gui/statsView.py b/gui/statsView.py index 773063ca4..7281a4ea1 100644 --- a/gui/statsView.py +++ b/gui/statsView.py @@ -19,6 +19,7 @@ class StatsView(object): + name = None views = {} def __init__(self): diff --git a/gui/viewColumn.py b/gui/viewColumn.py index 34c3c89ce..5cbc5fb61 100644 --- a/gui/viewColumn.py +++ b/gui/viewColumn.py @@ -27,6 +27,7 @@ class ViewColumn(object): Once the missing methods are correctly implemented, they can be used as columns in a view. """ + name = None columns = {} def __init__(self, fittingView): diff --git a/pyfa.py b/pyfa.py index f89677534..3e01338cc 100755 --- a/pyfa.py +++ b/pyfa.py @@ -59,6 +59,7 @@ if not hasattr(sys, 'frozen'): try: import wxversion except ImportError: + wxversion = None print("Cannot find wxPython\nYou can download wxPython (2.8+) from http://www.wxpython.org/") sys.exit(1) @@ -86,6 +87,8 @@ if not hasattr(sys, 'frozen'): "You can download sqlalchemy (0.5.8+) from http://www.sqlalchemy.org/".format(sqlalchemy.__version__)) sys.exit(1) else: + if not sqlalchemy: + sqlalchemy = None print("Unknown sqlalchemy version string format, skipping check") except ImportError: @@ -97,6 +100,7 @@ if not hasattr(sys, 'frozen'): # noinspection PyPackageRequirements import dateutil.parser # noqa - Copied import statement from service/update.py except ImportError: + dateutil = None print("Cannot find python-dateutil.\nYou can download python-dateutil from https://pypi.python.org/pypi/python-dateutil") sys.exit(1) diff --git a/service/eveapi.py b/service/eveapi.py index 89b7ed68e..581819c27 100644 --- a/service/eveapi.py +++ b/service/eveapi.py @@ -699,6 +699,8 @@ class _Parser(object): class Element(object): + _name = None + # Element is a namespace for attributes and nested tags def __str__(self): return "" % self._name diff --git a/service/fit.py b/service/fit.py index dec2ae647..13ef7d078 100644 --- a/service/fit.py +++ b/service/fit.py @@ -41,6 +41,7 @@ logger = logging.getLogger(__name__) class Fit(object): instance = None + ID = None @classmethod def getInstance(cls): diff --git a/service/market.py b/service/market.py index 8a2abb107..7f728c648 100644 --- a/service/market.py +++ b/service/market.py @@ -173,6 +173,7 @@ class Market(object): instance = None def __init__(self): + self.getPrice = None self.priceCache = {} # Init recently used module storage