diff --git a/eos/graph/fitCapTime.py b/eos/graph/fitCapAmountTime.py similarity index 94% rename from eos/graph/fitCapTime.py rename to eos/graph/fitCapAmountTime.py index 125e1553d..84067674d 100644 --- a/eos/graph/fitCapTime.py +++ b/eos/graph/fitCapAmountTime.py @@ -7,7 +7,7 @@ from eos.graph import Graph pyfalog = Logger(__name__) -class FitCapTimeGraph(Graph): +class FitCapAmountTimeGraph(Graph): defaults = {"time": 0} diff --git a/eos/graph/fitCapRegenRelative.py b/eos/graph/fitCapRegenAmount.py similarity index 89% rename from eos/graph/fitCapRegenRelative.py rename to eos/graph/fitCapRegenAmount.py index 019e3d87b..48511c7f0 100644 --- a/eos/graph/fitCapRegenRelative.py +++ b/eos/graph/fitCapRegenAmount.py @@ -7,7 +7,7 @@ from eos.graph import Graph pyfalog = Logger(__name__) -class FitCapRegenRelativeGraph(Graph): +class FitCapRegenAmountGraph(Graph): defaults = {"percentage": '0-100'} @@ -16,7 +16,7 @@ class FitCapRegenRelativeGraph(Graph): self.fit = fit def calcRegen(self, data): - perc = data["percentage"] + perc = data['percentage'] maxCap = self.fit.ship.getModifiedItemAttr('capacitorCapacity') regenTime = self.fit.ship.getModifiedItemAttr('rechargeRate') / 1000 currentCap = maxCap * perc / 100 diff --git a/eos/graph/fitShieldAmountTime.py b/eos/graph/fitShieldAmountTime.py new file mode 100644 index 000000000..343619fac --- /dev/null +++ b/eos/graph/fitShieldAmountTime.py @@ -0,0 +1,28 @@ +import math +from logbook import Logger + +from eos.graph import Graph + + +pyfalog = Logger(__name__) + + +class FitShieldAmountTimeGraph(Graph): + + defaults = {"time": 0} + + def __init__(self, fit, data=None): + Graph.__init__(self, fit, self.calcRegen, data if data is not None else self.defaults) + self.fit = fit + import gui.mainFrame + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + + def calcRegen(self, data): + time = data["time"] + maxShield = self.fit.ship.getModifiedItemAttr('shieldCapacity') + regenTime = self.fit.ship.getModifiedItemAttr('shieldRechargeRate') / 1000 + shield = maxShield * (1 + math.e ** ((5 * -time) / regenTime) * -1) ** 2 + useEhp = self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective + if self.fit.damagePattern is not None and useEhp: + shield = self.fit.damagePattern.effectivify(self.fit, shield, 'shield') + return shield diff --git a/eos/graph/fitShieldRegenRelative.py b/eos/graph/fitShieldRegenAmount.py similarity index 96% rename from eos/graph/fitShieldRegenRelative.py rename to eos/graph/fitShieldRegenAmount.py index c4ae82581..92e39f075 100644 --- a/eos/graph/fitShieldRegenRelative.py +++ b/eos/graph/fitShieldRegenAmount.py @@ -20,20 +20,20 @@ import math from logbook import Logger -import gui.mainFrame from eos.graph import Graph pyfalog = Logger(__name__) -class FitShieldRegenRelativeGraph(Graph): +class FitShieldRegenAmountGraph(Graph): defaults = {"percentage": '0-100'} def __init__(self, fit, data=None): Graph.__init__(self, fit, self.calcRegen, data if data is not None else self.defaults) self.fit = fit + import gui.mainFrame self.mainFrame = gui.mainFrame.MainFrame.getInstance() def calcRegen(self, data): diff --git a/gui/builtinGraphs/__init__.py b/gui/builtinGraphs/__init__.py index 1ef325ae9..336cf9f06 100644 --- a/gui/builtinGraphs/__init__.py +++ b/gui/builtinGraphs/__init__.py @@ -2,7 +2,8 @@ __all__ = [ 'fitDpsRange', 'fitDpsTime', 'fitDmgTime', - 'fitShieldRegenRelative', - 'fitCapRegenRelative', - 'fitCapTime' + 'fitShieldRegenAmount', + 'fitShieldAmountTime', + 'fitCapRegenAmount', + 'fitCapAmountTime' ] diff --git a/gui/builtinGraphs/fitCapTime.py b/gui/builtinGraphs/fitCapAmountTime.py similarity index 80% rename from gui/builtinGraphs/fitCapTime.py rename to gui/builtinGraphs/fitCapAmountTime.py index 6d1897652..4ef07f835 100644 --- a/gui/builtinGraphs/fitCapTime.py +++ b/gui/builtinGraphs/fitCapAmountTime.py @@ -19,23 +19,23 @@ import gui.mainFrame from eos.graph import Data -from eos.graph.fitCapTime import FitCapTimeGraph as EosFitCapTimeGraph +from eos.graph.fitCapAmountTime import FitCapAmountTimeGraph as EosFitCapAmountTimeGraph from gui.bitmap_loader import BitmapLoader from gui.graph import Graph from service.attribute import Attribute -class FitCapTimeGraph(Graph): +class FitCapAmountTimeGraph(Graph): propertyLabelMap = {"time": "Time (seconds)"} - defaults = EosFitCapTimeGraph.defaults.copy() + defaults = EosFitCapAmountTimeGraph.defaults.copy() def __init__(self): Graph.__init__(self) self.defaults["time"] = "0-300" self.name = "Cap Amount vs. Time" - self.fitCapTime = None + self.eosGraph = None self.mainFrame = gui.mainFrame.MainFrame.getInstance() def getFields(self): @@ -50,11 +50,11 @@ class FitCapTimeGraph(Graph): return {"time": bitmap} def getPoints(self, fit, fields): - fitCapTime = getattr(self, "fitCapTime", None) - if fitCapTime is None or fitCapTime.fit != fit: - fitCapTime = self.fitCapTime = EosFitCapTimeGraph(fit) + eosGraph = getattr(self, "eosGraph", None) + if eosGraph is None or eosGraph.fit != fit: + eosGraph = self.eosGraph = EosFitCapAmountTimeGraph(fit) - fitCapTime.clearData() + eosGraph.clearData() variable = None for fieldName, value in fields.items(): d = Data(fieldName, value) @@ -65,17 +65,17 @@ class FitCapTimeGraph(Graph): # We can't handle more then one variable atm, OOPS FUCK OUT return False, "Can only handle 1 variable" - fitCapTime.setData(d) + eosGraph.setData(d) if variable is None: return False, "No variable" x = [] y = [] - for point, val in fitCapTime.getIterator(): + for point, val in eosGraph.getIterator(): x.append(point[variable]) y.append(val) return x, y -FitCapTimeGraph.register() +FitCapAmountTimeGraph.register() diff --git a/gui/builtinGraphs/fitCapRegenRelative.py b/gui/builtinGraphs/fitCapRegenAmount.py similarity index 75% rename from gui/builtinGraphs/fitCapRegenRelative.py rename to gui/builtinGraphs/fitCapRegenAmount.py index c0b3286bd..2fc066863 100644 --- a/gui/builtinGraphs/fitCapRegenRelative.py +++ b/gui/builtinGraphs/fitCapRegenAmount.py @@ -19,23 +19,23 @@ import gui.mainFrame from eos.graph import Data -from eos.graph.fitCapRegenRelative import FitCapRegenRelativeGraph as EosFitCapRegenRelativeGraph +from eos.graph.fitCapRegenAmount import FitCapRegenAmountGraph as EosFitCapRegenAmountGraph from gui.bitmap_loader import BitmapLoader from gui.graph import Graph from service.attribute import Attribute -class FitCapRegenRelativeGraph(Graph): +class FitCapRegenAmountGraph(Graph): - propertyLabelMap = {"percentage": "Cap amount (percent)"} + propertyLabelMap = {"percentage": "Cap Amount (percent)"} - defaults = EosFitCapRegenRelativeGraph.defaults.copy() + defaults = EosFitCapRegenAmountGraph.defaults.copy() def __init__(self): Graph.__init__(self) self.defaults["percentage"] = "0-100" self.name = "Cap Regen vs. Cap Amount" - self.capRegenRelative = None + self.eosGraph = None self.mainFrame = gui.mainFrame.MainFrame.getInstance() def getFields(self): @@ -50,11 +50,11 @@ class FitCapRegenRelativeGraph(Graph): return {"percentage": bitmap} def getPoints(self, fit, fields): - capRegenRelative = getattr(self, "capRegenRelative", None) - if capRegenRelative is None or capRegenRelative.fit != fit: - capRegenRelative = self.capRegenRelative = EosFitCapRegenRelativeGraph(fit) + eosGraph = getattr(self, "eosGraph", None) + if eosGraph is None or eosGraph.fit != fit: + eosGraph = self.eosGraph = EosFitCapRegenAmountGraph(fit) - capRegenRelative.clearData() + eosGraph.clearData() variable = None for fieldName, value in fields.items(): d = Data(fieldName, value) @@ -65,18 +65,18 @@ class FitCapRegenRelativeGraph(Graph): # We can't handle more then one variable atm, OOPS FUCK OUT return False, "Can only handle 1 variable" - capRegenRelative.setData(d) + eosGraph.setData(d) if variable is None: return False, "No variable" x = [] y = [] - for point, val in capRegenRelative.getIterator(): + for point, val in eosGraph.getIterator(): x.append(point[variable]) y.append(val) return x, y -FitCapRegenRelativeGraph.register() +FitCapRegenAmountGraph.register() diff --git a/gui/builtinGraphs/fitDmgTime.py b/gui/builtinGraphs/fitDmgTime.py index 772a47f0f..15333bcc4 100644 --- a/gui/builtinGraphs/fitDmgTime.py +++ b/gui/builtinGraphs/fitDmgTime.py @@ -35,7 +35,7 @@ class FitDmgTimeGraph(Graph): Graph.__init__(self) self.defaults["time"] = "0-80" self.name = "Damage Inflicted vs. Time" - self.fitDmgTime = None + self.eosGraph = None self.mainFrame = gui.mainFrame.MainFrame.getInstance() def getFields(self): @@ -50,11 +50,11 @@ class FitDmgTimeGraph(Graph): return {"time": bitmap} def getPoints(self, fit, fields): - fitDmgTime = getattr(self, "fitDmgTime", None) - if fitDmgTime is None or fitDmgTime.fit != fit: - fitDmgTime = self.fitDmgTime = EosFitDmgTimeGraph(fit) + eosGraph = getattr(self, "eosGraph", None) + if eosGraph is None or eosGraph.fit != fit: + eosGraph = self.eosGraph = EosFitDmgTimeGraph(fit) - fitDmgTime.clearData() + eosGraph.clearData() variable = None for fieldName, value in fields.items(): d = Data(fieldName, value) @@ -65,15 +65,15 @@ class FitDmgTimeGraph(Graph): # We can't handle more then one variable atm, OOPS FUCK OUT return False, "Can only handle 1 variable" - fitDmgTime.setData(d) + eosGraph.setData(d) if variable is None: return False, "No variable" x = [] y = [] - fitDmgTime.recalc() - for point, val in fitDmgTime.getIterator(): + eosGraph.recalc() + for point, val in eosGraph.getIterator(): x.append(point[variable]) y.append(val) return x, y diff --git a/gui/builtinGraphs/fitDpsRange.py b/gui/builtinGraphs/fitDpsRange.py index ca9e8b8e2..56b4b10cf 100644 --- a/gui/builtinGraphs/fitDpsRange.py +++ b/gui/builtinGraphs/fitDpsRange.py @@ -43,7 +43,7 @@ class FitDpsRangeGraph(Graph): Graph.__init__(self) self.defaults["distance"] = "0-100" self.name = "DPS vs. Range" - self.fitDpsRange = None + self.eosGraph = None self.mainFrame = gui.mainFrame.MainFrame.getInstance() def getFields(self): @@ -64,11 +64,11 @@ class FitDpsRangeGraph(Graph): return icons def getPoints(self, fit, fields): - fitDpsRange = getattr(self, "fitDpsRange", None) - if fitDpsRange is None or fitDpsRange.fit != fit: - fitDpsRange = self.fitDpsRange = EosFitDpsRangeGraph(fit) + eosGraph = getattr(self, "eosGraph", None) + if eosGraph is None or eosGraph.fit != fit: + eosGraph = self.eosGraph = EosFitDpsRangeGraph(fit) - fitDpsRange.clearData() + eosGraph.clearData() variable = None for fieldName, value in fields.items(): d = Data(fieldName, value) @@ -79,14 +79,14 @@ class FitDpsRangeGraph(Graph): # We can't handle more then one variable atm, OOPS FUCK OUT return False, "Can only handle 1 variable" - fitDpsRange.setData(d) + eosGraph.setData(d) if variable is None: return False, "No variable" x = [] y = [] - for point, val in fitDpsRange.getIterator(): + for point, val in eosGraph.getIterator(): x.append(point[variable]) y.append(val) diff --git a/gui/builtinGraphs/fitDpsTime.py b/gui/builtinGraphs/fitDpsTime.py index d29614b9c..3005b6151 100644 --- a/gui/builtinGraphs/fitDpsTime.py +++ b/gui/builtinGraphs/fitDpsTime.py @@ -35,7 +35,7 @@ class FitDpsTimeGraph(Graph): Graph.__init__(self) self.defaults["time"] = "0-80" self.name = "DPS vs. Time" - self.fitDpsTime = None + self.eosGraph = None self.mainFrame = gui.mainFrame.MainFrame.getInstance() def getFields(self): @@ -50,11 +50,11 @@ class FitDpsTimeGraph(Graph): return {"time": bitmap} def getPoints(self, fit, fields): - fitDpsTime = getattr(self, "fitDpsTime", None) - if fitDpsTime is None or fitDpsTime.fit != fit: - fitDpsTime = self.fitDpsTime = EosFitDpsTimeGraph(fit) + eosGraph = getattr(self, "eosGraph", None) + if eosGraph is None or eosGraph.fit != fit: + eosGraph = self.eosGraph = EosFitDpsTimeGraph(fit) - fitDpsTime.clearData() + eosGraph.clearData() variable = None for fieldName, value in fields.items(): d = Data(fieldName, value) @@ -65,15 +65,15 @@ class FitDpsTimeGraph(Graph): # We can't handle more then one variable atm, OOPS FUCK OUT return False, "Can only handle 1 variable" - fitDpsTime.setData(d) + eosGraph.setData(d) if variable is None: return False, "No variable" x = [] y = [] - fitDpsTime.recalc() - for point, val in fitDpsTime.getIterator(): + eosGraph.recalc() + for point, val in eosGraph.getIterator(): x.append(point[variable]) y.append(val) diff --git a/gui/builtinGraphs/fitShieldAmountTime.py b/gui/builtinGraphs/fitShieldAmountTime.py new file mode 100644 index 000000000..a4eee47e8 --- /dev/null +++ b/gui/builtinGraphs/fitShieldAmountTime.py @@ -0,0 +1,85 @@ +# ============================================================================= +# Copyright (C) 2010 Diego Duclos +# +# This file is part of pyfa. +# +# pyfa is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# pyfa 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with pyfa. If not, see . +# ============================================================================= + +import gui.mainFrame +from eos.graph import Data +from eos.graph.fitShieldAmountTime import FitShieldAmountTimeGraph as EosFitShieldAmountTimeGraph +from gui.bitmap_loader import BitmapLoader +from gui.graph import Graph +from service.attribute import Attribute + + +class FitShieldAmountTimeGraph(Graph): + + propertyLabelMap = {"time": "Time (seconds)"} + + defaults = EosFitShieldAmountTimeGraph.defaults.copy() + + def __init__(self): + Graph.__init__(self) + self.defaults["time"] = "0-300" + self.name = "Shield Amount vs. Time" + self.eosGraph = None + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + + def getFields(self): + return self.defaults + + def getLabels(self): + return self.propertyLabelMap + + def getIcons(self): + iconFile = Attribute.getInstance().getAttributeInfo('duration').iconID + bitmap = BitmapLoader.getBitmap(iconFile, "icons") + return {"time": bitmap} + + def getPoints(self, fit, fields): + eosGraph = getattr(self, "eosGraph", None) + if eosGraph is None or eosGraph.fit != fit: + eosGraph = self.eosGraph = EosFitShieldAmountTimeGraph(fit) + + eosGraph.clearData() + variable = None + for fieldName, value in fields.items(): + d = Data(fieldName, value) + if not d.isConstant(): + if variable is None: + variable = fieldName + else: + # We can't handle more then one variable atm, OOPS FUCK OUT + return False, "Can only handle 1 variable" + + eosGraph.setData(d) + + if variable is None: + return False, "No variable" + + x = [] + y = [] + for point, val in eosGraph.getIterator(): + x.append(point[variable]) + y.append(val) + return x, y + + @property + def redrawOnEffectiveChange(self): + return True + + +FitShieldAmountTimeGraph.register() diff --git a/gui/builtinGraphs/fitShieldRegenRelative.py b/gui/builtinGraphs/fitShieldRegenAmount.py similarity index 75% rename from gui/builtinGraphs/fitShieldRegenRelative.py rename to gui/builtinGraphs/fitShieldRegenAmount.py index 56a5c3a7e..8a20802ff 100644 --- a/gui/builtinGraphs/fitShieldRegenRelative.py +++ b/gui/builtinGraphs/fitShieldRegenAmount.py @@ -19,23 +19,23 @@ import gui.mainFrame from eos.graph import Data -from eos.graph.fitShieldRegenRelative import FitShieldRegenRelativeGraph as EosFitShieldRegenRelativeGraph +from eos.graph.fitShieldRegenAmount import FitShieldRegenAmountGraph as EosFitShieldRegenAmountGraph from gui.bitmap_loader import BitmapLoader from gui.graph import Graph from service.attribute import Attribute -class FitShieldRegenRelativeGraph(Graph): +class FitShieldRegenAmountGraph(Graph): propertyLabelMap = {"percentage": "Shield Capacity (percent)"} - defaults = EosFitShieldRegenRelativeGraph.defaults.copy() + defaults = EosFitShieldRegenAmountGraph.defaults.copy() def __init__(self): Graph.__init__(self) self.defaults["percentage"] = "0-100" - self.name = "Shield Regen vs. Shield Capacity" - self.shieldRegenRelative = None + self.name = "Shield Regen vs. Shield Amount" + self.eosGraph = None self.mainFrame = gui.mainFrame.MainFrame.getInstance() def getFields(self): @@ -50,11 +50,11 @@ class FitShieldRegenRelativeGraph(Graph): return {"percentage": bitmap} def getPoints(self, fit, fields): - shieldRegenRelative = getattr(self, "shieldRegenRelative", None) - if shieldRegenRelative is None or shieldRegenRelative.fit != fit: - shieldRegenRelative = self.shieldRegenRelative = EosFitShieldRegenRelativeGraph(fit) + eosGraph = getattr(self, "eosGraph", None) + if eosGraph is None or eosGraph.fit != fit: + eosGraph = self.eosGraph = EosFitShieldRegenAmountGraph(fit) - shieldRegenRelative.clearData() + eosGraph.clearData() variable = None for fieldName, value in fields.items(): d = Data(fieldName, value) @@ -65,14 +65,14 @@ class FitShieldRegenRelativeGraph(Graph): # We can't handle more then one variable atm, OOPS FUCK OUT return False, "Can only handle 1 variable" - shieldRegenRelative.setData(d) + eosGraph.setData(d) if variable is None: return False, "No variable" x = [] y = [] - for point, val in shieldRegenRelative.getIterator(): + for point, val in eosGraph.getIterator(): x.append(point[variable]) y.append(val) @@ -83,4 +83,4 @@ class FitShieldRegenRelativeGraph(Graph): return True -FitShieldRegenRelativeGraph.register() +FitShieldRegenAmountGraph.register()