diff --git a/eos/__init__.py b/eos/__init__.py index f6e146b5f..96a3c75be 100644 --- a/eos/__init__.py +++ b/eos/__init__.py @@ -1,8 +1,8 @@ -version = "0.2.3" -tag = "git" - - -def test(): - import tests.runTests - import unittest - unittest.main(defaultTest="discover", testLoader=tests.runTests.loader) +version = "0.2.3" +tag = "git" + + +def test(): + import tests.runTests + import unittest + unittest.main(defaultTest="discover", testLoader=tests.runTests.loader) diff --git a/eos/db/gamedata/metaData.py b/eos/db/gamedata/metaData.py index 6bf500a72..bb23e9315 100644 --- a/eos/db/gamedata/metaData.py +++ b/eos/db/gamedata/metaData.py @@ -1,30 +1,30 @@ -# =============================================================================== -# Copyright (C) 2010 Diego Duclos -# -# This file is part of eos. -# -# eos is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# eos is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with eos. If not, see . -# =============================================================================== - -from sqlalchemy import Column, Table, String -from sqlalchemy.orm import mapper - -from eos.db import gamedata_meta -from eos.types import MetaData - -metadata_table = Table("metadata", gamedata_meta, - Column("field_name", String, primary_key=True), - Column("field_value", String)) - -mapper(MetaData, metadata_table) +# =============================================================================== +# Copyright (C) 2010 Diego Duclos +# +# This file is part of eos. +# +# eos is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# eos is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with eos. If not, see . +# =============================================================================== + +from sqlalchemy import Column, Table, String +from sqlalchemy.orm import mapper + +from eos.db import gamedata_meta +from eos.types import MetaData + +metadata_table = Table("metadata", gamedata_meta, + Column("field_name", String, primary_key=True), + Column("field_value", String)) + +mapper(MetaData, metadata_table) diff --git a/eos/effects/modifyactivearmorresonancepostpercent.py b/eos/effects/modifyactivearmorresonancepostpercent.py index be8b613a8..6a6a9e571 100644 --- a/eos/effects/modifyactivearmorresonancepostpercent.py +++ b/eos/effects/modifyactivearmorresonancepostpercent.py @@ -1,13 +1,13 @@ -# modifyActiveArmorResonancePostPercent -# -# Used by: -# Modules from group: Armor Hardener (156 of 156) -# Modules from group: Flex Armor Hardener (4 of 4) -type = "active" - - -def handler(fit, module, context): - for damageType in ("kinetic", "thermal", "explosive", "em"): - fit.ship.boostItemAttr("armor%sDamageResonance" % damageType.capitalize(), - module.getModifiedItemAttr("%sDamageResistanceBonus" % damageType), - stackingPenalties=True) +# modifyActiveArmorResonancePostPercent +# +# Used by: +# Modules from group: Armor Hardener (156 of 156) +# Modules from group: Flex Armor Hardener (4 of 4) +type = "active" + + +def handler(fit, module, context): + for damageType in ("kinetic", "thermal", "explosive", "em"): + fit.ship.boostItemAttr("armor%sDamageResonance" % damageType.capitalize(), + module.getModifiedItemAttr("%sDamageResistanceBonus" % damageType), + stackingPenalties=True) diff --git a/eos/effects/modifyactiveshieldresonancepostpercent.py b/eos/effects/modifyactiveshieldresonancepostpercent.py index 41e70a776..04c2edac3 100644 --- a/eos/effects/modifyactiveshieldresonancepostpercent.py +++ b/eos/effects/modifyactiveshieldresonancepostpercent.py @@ -1,13 +1,13 @@ -# modifyActiveShieldResonancePostPercent -# -# Used by: -# Modules from group: Flex Shield Hardener (5 of 5) -# Modules from group: Shield Hardener (97 of 97) -type = "active" - - -def handler(fit, module, context): - for damageType in ("kinetic", "thermal", "explosive", "em"): - fit.ship.boostItemAttr("shield" + damageType.capitalize() + "DamageResonance", - module.getModifiedItemAttr(damageType + "DamageResistanceBonus"), - stackingPenalties=True) +# modifyActiveShieldResonancePostPercent +# +# Used by: +# Modules from group: Flex Shield Hardener (5 of 5) +# Modules from group: Shield Hardener (97 of 97) +type = "active" + + +def handler(fit, module, context): + for damageType in ("kinetic", "thermal", "explosive", "em"): + fit.ship.boostItemAttr("shield" + damageType.capitalize() + "DamageResonance", + module.getModifiedItemAttr(damageType + "DamageResistanceBonus"), + stackingPenalties=True) diff --git a/eos/effects/shipbonusrepairsystemsbonusatc2.py b/eos/effects/shipbonusrepairsystemsbonusatc2.py index b2f7bd1aa..c761ad921 100644 --- a/eos/effects/shipbonusrepairsystemsbonusatc2.py +++ b/eos/effects/shipbonusrepairsystemsbonusatc2.py @@ -1,10 +1,10 @@ -# shipBonusRepairSystemsBonusATC2 -# -# Used by: -# Ship: Vangel -type = "passive" - - -def handler(fit, ship, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Repair Systems"), - "armorDamageAmount", ship.getModifiedItemAttr("shipBonusATC2")) +# shipBonusRepairSystemsBonusATC2 +# +# Used by: +# Ship: Vangel +type = "passive" + + +def handler(fit, ship, context): + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Repair Systems"), + "armorDamageAmount", ship.getModifiedItemAttr("shipBonusATC2")) diff --git a/eos/effects/shipenergyneutralizertransferamountbonusab.py b/eos/effects/shipenergyneutralizertransferamountbonusab.py index c814b51b5..925a33c92 100644 --- a/eos/effects/shipenergyneutralizertransferamountbonusab.py +++ b/eos/effects/shipenergyneutralizertransferamountbonusab.py @@ -1,11 +1,11 @@ -# shipEnergyNeutralizerTransferAmountBonusAB -# -# Used by: -# Ship: Bhaalgorn -type = "passive" - - -def handler(fit, ship, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Neutralizer", - "energyNeutralizerAmount", ship.getModifiedItemAttr("shipBonusAB"), - skill="Amarr Battleship") +# shipEnergyNeutralizerTransferAmountBonusAB +# +# Used by: +# Ship: Bhaalgorn +type = "passive" + + +def handler(fit, ship, context): + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Energy Neutralizer", + "energyNeutralizerAmount", ship.getModifiedItemAttr("shipBonusAB"), + skill="Amarr Battleship") diff --git a/eos/effects/skillreactivearmorhardenercapneedbonus.py b/eos/effects/skillreactivearmorhardenercapneedbonus.py index 22b9f94c4..a8baab0f4 100644 --- a/eos/effects/skillreactivearmorhardenercapneedbonus.py +++ b/eos/effects/skillreactivearmorhardenercapneedbonus.py @@ -1,13 +1,13 @@ -# skillReactiveArmorHardenerCapNeedBonus -# -# Used by: -# Skill: Resistance Phasing -type = "passive" - - -def handler(fit, src, context): - lvl = src.level - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Armor Resistance Shift Hardener", "capacitorNeed", - src.getModifiedItemAttr("capNeedBonus") * lvl) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Resistance Phasing"), "capacitorNeed", - src.getModifiedItemAttr("capNeedBonus") * lvl) +# skillReactiveArmorHardenerCapNeedBonus +# +# Used by: +# Skill: Resistance Phasing +type = "passive" + + +def handler(fit, src, context): + lvl = src.level + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Armor Resistance Shift Hardener", "capacitorNeed", + src.getModifiedItemAttr("capNeedBonus") * lvl) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Resistance Phasing"), "capacitorNeed", + src.getModifiedItemAttr("capNeedBonus") * lvl) diff --git a/eos/effects/skillreactivearmorhardenerdurationbonus.py b/eos/effects/skillreactivearmorhardenerdurationbonus.py index 9ecabd1ca..00ced0d4f 100644 --- a/eos/effects/skillreactivearmorhardenerdurationbonus.py +++ b/eos/effects/skillreactivearmorhardenerdurationbonus.py @@ -1,13 +1,13 @@ -# skillReactiveArmorHardenerDurationBonus -# -# Used by: -# Skill: Resistance Phasing -type = "passive" - - -def handler(fit, src, context): - lvl = src.level - fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Armor Resistance Shift Hardener", "duration", - src.getModifiedItemAttr("durationBonus") * lvl) - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Resistance Phasing"), "duration", - src.getModifiedItemAttr("durationBonus") * lvl) +# skillReactiveArmorHardenerDurationBonus +# +# Used by: +# Skill: Resistance Phasing +type = "passive" + + +def handler(fit, src, context): + lvl = src.level + fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Armor Resistance Shift Hardener", "duration", + src.getModifiedItemAttr("durationBonus") * lvl) + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Resistance Phasing"), "duration", + src.getModifiedItemAttr("durationBonus") * lvl) diff --git a/eos/effects/subsystembonusamarrdefensivearmorrepairamount.py b/eos/effects/subsystembonusamarrdefensivearmorrepairamount.py index 27bb5924b..4928f9906 100644 --- a/eos/effects/subsystembonusamarrdefensivearmorrepairamount.py +++ b/eos/effects/subsystembonusamarrdefensivearmorrepairamount.py @@ -1,11 +1,11 @@ -# subsystemBonusAmarrDefensiveArmorRepairAmount -# -# Used by: -# Subsystem: Legion Defensive - Nanobot Injector -type = "passive" - - -def handler(fit, module, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Repair Systems"), - "armorDamageAmount", module.getModifiedItemAttr("subsystemBonusAmarrDefensive"), - skill="Amarr Defensive Systems") +# subsystemBonusAmarrDefensiveArmorRepairAmount +# +# Used by: +# Subsystem: Legion Defensive - Nanobot Injector +type = "passive" + + +def handler(fit, module, context): + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Repair Systems"), + "armorDamageAmount", module.getModifiedItemAttr("subsystemBonusAmarrDefensive"), + skill="Amarr Defensive Systems") diff --git a/eos/effects/subsystembonusgallentedefensivearmorrepairamount.py b/eos/effects/subsystembonusgallentedefensivearmorrepairamount.py index 5b17e2461..32dc79789 100644 --- a/eos/effects/subsystembonusgallentedefensivearmorrepairamount.py +++ b/eos/effects/subsystembonusgallentedefensivearmorrepairamount.py @@ -1,11 +1,11 @@ -# subsystemBonusGallenteDefensiveArmorRepairAmount -# -# Used by: -# Subsystem: Proteus Defensive - Nanobot Injector -type = "passive" - - -def handler(fit, module, context): - fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Repair Systems"), - "armorDamageAmount", module.getModifiedItemAttr("subsystemBonusGallenteDefensive"), - skill="Gallente Defensive Systems") +# subsystemBonusGallenteDefensiveArmorRepairAmount +# +# Used by: +# Subsystem: Proteus Defensive - Nanobot Injector +type = "passive" + + +def handler(fit, module, context): + fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Repair Systems"), + "armorDamageAmount", module.getModifiedItemAttr("subsystemBonusGallenteDefensive"), + skill="Gallente Defensive Systems") diff --git a/eos/enum.py b/eos/enum.py index e9fb20a0b..04caea536 100644 --- a/eos/enum.py +++ b/eos/enum.py @@ -1,23 +1,23 @@ -class Enum(): - def __init__(self): - pass - - @classmethod - def getTypes(cls): - for stuff in cls.__dict__: - if stuff.upper() == stuff: - yield stuff - - @classmethod - def getName(cls, v): - map = getattr(cls, "_map", None) - if map is None: - map = cls._map = {} - for type in cls.getTypes(): - map[cls.getValue(type)] = type - - return map.get(v) - - @classmethod - def getValue(cls, type): - return cls.__dict__[type] +class Enum(): + def __init__(self): + pass + + @classmethod + def getTypes(cls): + for stuff in cls.__dict__: + if stuff.upper() == stuff: + yield stuff + + @classmethod + def getName(cls, v): + map = getattr(cls, "_map", None) + if map is None: + map = cls._map = {} + for type in cls.getTypes(): + map[cls.getValue(type)] = type + + return map.get(v) + + @classmethod + def getValue(cls, type): + return cls.__dict__[type] diff --git a/eos/eqBase.py b/eos/eqBase.py index a400aec33..2b8d35b33 100644 --- a/eos/eqBase.py +++ b/eos/eqBase.py @@ -1,29 +1,29 @@ -# =============================================================================== -# Copyright (C) 2010 Diego Duclos -# -# This file is part of eos. -# -# eos is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# eos is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with eos. If not, see . -# =============================================================================== - - -class EqBase(object): - def __eq__(self, other): - return type(self) == type(other) and self.ID == other.ID - - def __ne__(self, other): - return type(self) != type(other) or self.ID != other.ID - - def __hash__(self): - return id(type(self)) + self.ID +# =============================================================================== +# Copyright (C) 2010 Diego Duclos +# +# This file is part of eos. +# +# eos is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# eos is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with eos. If not, see . +# =============================================================================== + + +class EqBase(object): + def __eq__(self, other): + return type(self) == type(other) and self.ID == other.ID + + def __ne__(self, other): + return type(self) != type(other) or self.ID != other.ID + + def __hash__(self): + return id(type(self)) + self.ID diff --git a/eos/graph/__init__.py b/eos/graph/__init__.py index 882ac35d1..44f6905c7 100644 --- a/eos/graph/__init__.py +++ b/eos/graph/__init__.py @@ -1,118 +1,118 @@ -# =============================================================================== -# Copyright (C) 2010 Diego Duclos -# -# This file is part of eos. -# -# eos is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# eos is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with eos. If not, see . -# =============================================================================== - -import itertools - - -class Graph(object): - def __init__(self, fit, function, data=None): - self.fit = fit - self.data = {} - if data is not None: - for name, d in data.iteritems(): - self.setData(Data(name, d)) - - self.function = function - - def clearData(self): - self.data.clear() - - def setData(self, data): - self.data[data.name] = data - - def getIterator(self): - pointNames = [] - pointIterators = [] - for data in self.data.itervalues(): - pointNames.append(data.name) - pointIterators.append(data) - - return self._iterator(pointNames, pointIterators) - - def _iterator(self, pointNames, pointIterators): - for pointValues in itertools.product(*pointIterators): - point = {} - for i in xrange(len(pointValues)): - point[pointNames[i]] = pointValues[i] - - yield point, self.function(point) - - -class Data(object): - def __init__(self, name, dataString, step=None): - self.name = name - self.step = step - self.data = self.parseString(dataString) - - def parseString(self, dataString): - if not isinstance(dataString, basestring): - return (Constant(dataString),) - - dataList = [] - for data in dataString.split(";"): - if isinstance(data, basestring) and "-" in data: - # Dealing with a range - dataList.append(Range(data, self.step)) - else: - dataList.append(Constant(data)) - - return dataList - - def __iter__(self): - for data in self.data: - for value in data: - yield value - - def isConstant(self): - return len(self.data) == 1 and self.data[0].isConstant() - - -class Constant(object): - def __init__(self, const): - if isinstance(const, basestring): - self.value = None if const == "" else float(const) - else: - self.value = const - - def __iter__(self): - yield self.value - - def isConstant(self): - return True - - -class Range(object): - def __init__(self, string, step): - start, end = string.split("-") - self.start = float(start) - self.end = float(end) - self.step = step - - def __iter__(self): - current = start = self.start - end = self.end - step = self.step or (end - start) / 50.0 - i = 1 - while current < end: - current = start + i * step - i += 1 - yield current - - def isConstant(self): - return False +# =============================================================================== +# Copyright (C) 2010 Diego Duclos +# +# This file is part of eos. +# +# eos is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# eos is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with eos. If not, see . +# =============================================================================== + +import itertools + + +class Graph(object): + def __init__(self, fit, function, data=None): + self.fit = fit + self.data = {} + if data is not None: + for name, d in data.iteritems(): + self.setData(Data(name, d)) + + self.function = function + + def clearData(self): + self.data.clear() + + def setData(self, data): + self.data[data.name] = data + + def getIterator(self): + pointNames = [] + pointIterators = [] + for data in self.data.itervalues(): + pointNames.append(data.name) + pointIterators.append(data) + + return self._iterator(pointNames, pointIterators) + + def _iterator(self, pointNames, pointIterators): + for pointValues in itertools.product(*pointIterators): + point = {} + for i in xrange(len(pointValues)): + point[pointNames[i]] = pointValues[i] + + yield point, self.function(point) + + +class Data(object): + def __init__(self, name, dataString, step=None): + self.name = name + self.step = step + self.data = self.parseString(dataString) + + def parseString(self, dataString): + if not isinstance(dataString, basestring): + return (Constant(dataString),) + + dataList = [] + for data in dataString.split(";"): + if isinstance(data, basestring) and "-" in data: + # Dealing with a range + dataList.append(Range(data, self.step)) + else: + dataList.append(Constant(data)) + + return dataList + + def __iter__(self): + for data in self.data: + for value in data: + yield value + + def isConstant(self): + return len(self.data) == 1 and self.data[0].isConstant() + + +class Constant(object): + def __init__(self, const): + if isinstance(const, basestring): + self.value = None if const == "" else float(const) + else: + self.value = const + + def __iter__(self): + yield self.value + + def isConstant(self): + return True + + +class Range(object): + def __init__(self, string, step): + start, end = string.split("-") + self.start = float(start) + self.end = float(end) + self.step = step + + def __iter__(self): + current = start = self.start + end = self.end + step = self.step or (end - start) / 50.0 + i = 1 + while current < end: + current = start + i * step + i += 1 + yield current + + def isConstant(self): + return False diff --git a/gui/builtinContextMenus/metaSwap.py b/gui/builtinContextMenus/metaSwap.py index 3462410e5..245f864d7 100644 Binary files a/gui/builtinContextMenus/metaSwap.py and b/gui/builtinContextMenus/metaSwap.py differ diff --git a/gui/builtinContextMenus/moduleAmmoPicker.py b/gui/builtinContextMenus/moduleAmmoPicker.py index e69aac4cd..f130c2130 100644 Binary files a/gui/builtinContextMenus/moduleAmmoPicker.py and b/gui/builtinContextMenus/moduleAmmoPicker.py differ diff --git a/gui/builtinGraphs/__init__.py b/gui/builtinGraphs/__init__.py index ec25b90b2..31eaaaf9e 100644 --- a/gui/builtinGraphs/__init__.py +++ b/gui/builtinGraphs/__init__.py @@ -1 +1 @@ -__all__ = ["fitDps"] +__all__ = ["fitDps"] diff --git a/gui/builtinViewColumns/__init__.py b/gui/builtinViewColumns/__init__.py index d66f423bf..cff8bc614 100644 --- a/gui/builtinViewColumns/__init__.py +++ b/gui/builtinViewColumns/__init__.py @@ -1,2 +1,2 @@ -__all__ = ["ammo", "ammoIcon", "attributeDisplay", "baseIcon", "baseName", - "capacitorUse", "maxRange", "price", "propertyDisplay", "state", "misc", "abilities"] +__all__ = ["ammo", "ammoIcon", "attributeDisplay", "baseIcon", "baseName", + "capacitorUse", "maxRange", "price", "propertyDisplay", "state", "misc", "abilities"] diff --git a/gui/builtinViewColumns/baseName.py b/gui/builtinViewColumns/baseName.py index 973219b2c..ef68015f8 100644 Binary files a/gui/builtinViewColumns/baseName.py and b/gui/builtinViewColumns/baseName.py differ