Add shield amount vs time graph
This commit is contained in:
@@ -7,7 +7,7 @@ from eos.graph import Graph
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class FitCapTimeGraph(Graph):
|
||||
class FitCapAmountTimeGraph(Graph):
|
||||
|
||||
defaults = {"time": 0}
|
||||
|
||||
@@ -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
|
||||
28
eos/graph/fitShieldAmountTime.py
Normal file
28
eos/graph/fitShieldAmountTime.py
Normal file
@@ -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
|
||||
@@ -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):
|
||||
@@ -2,7 +2,8 @@ __all__ = [
|
||||
'fitDpsRange',
|
||||
'fitDpsTime',
|
||||
'fitDmgTime',
|
||||
'fitShieldRegenRelative',
|
||||
'fitCapRegenRelative',
|
||||
'fitCapTime'
|
||||
'fitShieldRegenAmount',
|
||||
'fitShieldAmountTime',
|
||||
'fitCapRegenAmount',
|
||||
'fitCapAmountTime'
|
||||
]
|
||||
|
||||
@@ -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()
|
||||
@@ -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()
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
85
gui/builtinGraphs/fitShieldAmountTime.py
Normal file
85
gui/builtinGraphs/fitShieldAmountTime.py
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
# =============================================================================
|
||||
|
||||
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()
|
||||
@@ -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()
|
||||
Reference in New Issue
Block a user