Add a ton of default values

This commit is contained in:
Ebag333
2017-02-09 00:56:33 -08:00
parent f2c84692a9
commit 7865219164
27 changed files with 104 additions and 7 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -19,6 +19,8 @@
class EqBase(object):
ID = None
def __eq__(self, other):
return type(self) == type(other) and self.ID == other.ID

View File

@@ -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

View File

@@ -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):

View File

@@ -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

View File

@@ -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):

View File

@@ -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"""

View File

@@ -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

View File

@@ -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=""):

View File

@@ -29,6 +29,8 @@ logger = logging.getLogger(__name__)
class Implant(HandledItem, ItemAttrShortcut):
ID = None
def __init__(self, item):
self.__item = item

View File

@@ -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:

View File

@@ -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

View File

@@ -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):

View File

@@ -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:

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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):

View File

@@ -19,6 +19,7 @@
class StatsView(object):
name = None
views = {}
def __init__(self):

View File

@@ -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):

View File

@@ -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)

View File

@@ -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 "<Element '%s'>" % self._name

View File

@@ -41,6 +41,7 @@ logger = logging.getLogger(__name__)
class Fit(object):
instance = None
ID = None
@classmethod
def getInstance(cls):

View File

@@ -173,6 +173,7 @@ class Market(object):
instance = None
def __init__(self):
self.getPrice = None
self.priceCache = {}
# Init recently used module storage