From 7e7b49d2e4e7bd790ebfeea5ce137a75d5dc7c19 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sat, 29 Jun 2019 10:21:16 +0300 Subject: [PATCH] Move shield regen graph to new infrastructure --- eos/graph/fitShieldAmountVsTime.py | 27 ---- eos/graph/fitShieldRegenVsShieldPerc.py | 22 ---- gui/builtinGraphs/__init__.py | 3 +- gui/builtinGraphs/base.py | 20 +-- gui/builtinGraphs/fitCapRegen.py | 41 +++--- gui/builtinGraphs/fitDamageStats.py | 60 +++------ gui/builtinGraphs/fitMobility.py | 30 ++--- gui/builtinGraphs/fitShieldAmountVsTime.py | 50 -------- gui/builtinGraphs/fitShieldRegen.py | 117 ++++++++++++++++++ .../fitShieldRegenVsShieldPerc.py | 51 -------- gui/builtinGraphs/fitWarpTime.py | 28 ++--- gui/builtinStatsViews/resistancesViewFull.py | 1 + gui/graphFrame/frame.py | 10 -- 13 files changed, 175 insertions(+), 285 deletions(-) delete mode 100644 eos/graph/fitShieldAmountVsTime.py delete mode 100644 eos/graph/fitShieldRegenVsShieldPerc.py delete mode 100644 gui/builtinGraphs/fitShieldAmountVsTime.py create mode 100644 gui/builtinGraphs/fitShieldRegen.py delete mode 100644 gui/builtinGraphs/fitShieldRegenVsShieldPerc.py diff --git a/eos/graph/fitShieldAmountVsTime.py b/eos/graph/fitShieldAmountVsTime.py deleted file mode 100644 index 443e1ea1c..000000000 --- a/eos/graph/fitShieldAmountVsTime.py +++ /dev/null @@ -1,27 +0,0 @@ -import math -from logbook import Logger - -from .base import SmoothGraph - - -pyfalog = Logger(__name__) - - -class FitShieldAmountVsTimeGraph(SmoothGraph): - - def __init__(self): - super().__init__() - import gui.mainFrame - self.mainFrame = gui.mainFrame.MainFrame.getInstance() - - def getYForX(self, fit, extraData, time): - if time < 0: - return 0 - maxShield = fit.ship.getModifiedItemAttr('shieldCapacity') - regenTime = fit.ship.getModifiedItemAttr('shieldRechargeRate') / 1000 - # https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate (shield is similar to cap) - shield = maxShield * (1 + math.exp(5 * -time / regenTime) * -1) ** 2 - useEhp = self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective - if fit.damagePattern is not None and useEhp: - shield = fit.damagePattern.effectivify(fit, shield, 'shield') - return shield diff --git a/eos/graph/fitShieldRegenVsShieldPerc.py b/eos/graph/fitShieldRegenVsShieldPerc.py deleted file mode 100644 index 3793d6727..000000000 --- a/eos/graph/fitShieldRegenVsShieldPerc.py +++ /dev/null @@ -1,22 +0,0 @@ -import math - -from .base import SmoothGraph - - -class FitShieldRegenVsShieldPercGraph(SmoothGraph): - - def __init__(self): - super().__init__() - import gui.mainFrame - self.mainFrame = gui.mainFrame.MainFrame.getInstance() - - def getYForX(self, fit, extraData, perc): - maxShield = fit.ship.getModifiedItemAttr('shieldCapacity') - regenTime = fit.ship.getModifiedItemAttr('shieldRechargeRate') / 1000 - currentShield = maxShield * perc / 100 - # https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate (shield is similar to cap) - regen = 10 * maxShield / regenTime * (math.sqrt(currentShield / maxShield) - currentShield / maxShield) - useEhp = self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective - if fit.damagePattern is not None and useEhp: - regen = fit.damagePattern.effectivify(fit, regen, 'shield') - return regen diff --git a/gui/builtinGraphs/__init__.py b/gui/builtinGraphs/__init__.py index 1cfd88290..82c10e1f7 100644 --- a/gui/builtinGraphs/__init__.py +++ b/gui/builtinGraphs/__init__.py @@ -2,8 +2,7 @@ from gui.builtinGraphs import ( # noqa: E402,F401 fitDamageStats, # fitDmgVsTime, - # fitShieldRegenVsShieldPerc, - # fitShieldAmountVsTime, + fitShieldRegen, fitCapRegen, fitMobility, fitWarpTime diff --git a/gui/builtinGraphs/base.py b/gui/builtinGraphs/base.py index c5e1262ab..83dfa775a 100644 --- a/gui/builtinGraphs/base.py +++ b/gui/builtinGraphs/base.py @@ -72,21 +72,9 @@ class FitGraph(metaclass=ABCMeta): def inputMap(self): return OrderedDict(((i.handle, i.unit), i) for i in self.inputs) - @property - def srcVectorDef(self): - return None - - @property - def tgtVectorDef(self): - return None - - @property - def hasTargets(self): - return False - - @property - def redrawOnEffectiveChange(self): - return False + srcVectorDef = None + tgtVectorDef = None + hasTargets = False def getPlotPoints(self, mainInput, miscInputs, xSpec, ySpec, fit, tgt=None): try: @@ -182,7 +170,7 @@ class FitGraph(metaclass=ABCMeta): values = [denormalizer(v, fit, tgt) for v in values] return values - def _iterLinear(self, valRange, resolution=100): + def _iterLinear(self, valRange, resolution=200): rangeLow = min(valRange) rangeHigh = max(valRange) # Amount is amount of ranges between points here, not amount of points diff --git a/gui/builtinGraphs/fitCapRegen.py b/gui/builtinGraphs/fitCapRegen.py index a0c1452f4..1dfb65130 100644 --- a/gui/builtinGraphs/fitCapRegen.py +++ b/gui/builtinGraphs/fitCapRegen.py @@ -25,35 +25,24 @@ from .base import FitGraph, XDef, YDef, Input class FitCapRegenGraph(FitGraph): - name = 'Capacitor Regeneration' - # UI stuff - @property - def xDefs(self): - return [ - XDef(handle='time', unit='s', label='Time', mainInput=('time', 's')), - XDef(handle='capAmount', unit='GJ', label='Cap amount', mainInput=('capAmount', '%')), - XDef(handle='capAmount', unit='%', label='Cap amount', mainInput=('capAmount', '%'))] - - @property - def yDefs(self): - return [ - YDef(handle='capAmount', unit='GJ', label='Cap amount'), - YDef(handle='capRegen', unit='GJ/s', label='Cap regen')] - - @property - def inputs(self): - return [ - Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=120, defaultRange=(0, 300), mainOnly=True), - Input(handle='capAmount', unit='%', label='Cap amount', iconID=1668, defaultValue=25, defaultRange=(0, 100), mainOnly=True)] + name = 'Capacitor Regeneration' + xDefs = [ + XDef(handle='time', unit='s', label='Time', mainInput=('time', 's')), + XDef(handle='capAmount', unit='GJ', label='Cap amount', mainInput=('capAmount', '%')), + XDef(handle='capAmount', unit='%', label='Cap amount', mainInput=('capAmount', '%'))] + yDefs = [ + YDef(handle='capAmount', unit='GJ', label='Cap amount'), + YDef(handle='capRegen', unit='GJ/s', label='Cap regen')] + inputs = [ + Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=120, defaultRange=(0, 300), mainOnly=True), + Input(handle='capAmount', unit='%', label='Cap amount', iconID=1668, defaultValue=25, defaultRange=(0, 100), mainOnly=True)] # Calculation stuff _normalizers = { ('capAmount', '%'): lambda v, fit, tgt: v / 100 * fit.ship.getModifiedItemAttr('capacitorCapacity')} - _limiters = { 'capAmount': lambda fit, tgt: (0, fit.ship.getModifiedItemAttr('capacitorCapacity'))} - _denormalizers = { ('capAmount', '%'): lambda v, fit, tgt: v * 100 / fit.ship.getModifiedItemAttr('capacitorCapacity')} @@ -75,9 +64,9 @@ class FitCapRegenGraph(FitGraph): capRegenTime = fit.ship.getModifiedItemAttr('rechargeRate') / 1000 for time in self._iterLinear(mainInput[1]): currentCapAmount = calculateCapAmount(maxCapAmount=maxCapAmount, capRegenTime=capRegenTime, time=time) - currentRegen = calculateCapRegen(maxCapAmount=maxCapAmount, capRegenTime=capRegenTime, currentCapAmount=currentCapAmount) + currentCapRegen = calculateCapRegen(maxCapAmount=maxCapAmount, capRegenTime=capRegenTime, currentCapAmount=currentCapAmount) xs.append(time) - ys.append(currentRegen) + ys.append(currentCapRegen) return xs, ys def _capAmount2capAmount(self, mainInput, miscInputs, fit, tgt): @@ -95,9 +84,9 @@ class FitCapRegenGraph(FitGraph): maxCapAmount = fit.ship.getModifiedItemAttr('capacitorCapacity') capRegenTime = fit.ship.getModifiedItemAttr('rechargeRate') / 1000 for currentCapAmount in self._iterLinear(mainInput[1]): - currentRegen = calculateCapRegen(maxCapAmount=maxCapAmount, capRegenTime=capRegenTime, currentCapAmount=currentCapAmount) + currentCapRegen = calculateCapRegen(maxCapAmount=maxCapAmount, capRegenTime=capRegenTime, currentCapAmount=currentCapAmount) xs.append(currentCapAmount) - ys.append(currentRegen) + ys.append(currentCapRegen) return xs, ys _getters = { diff --git a/gui/builtinGraphs/fitDamageStats.py b/gui/builtinGraphs/fitDamageStats.py index 60e1f17d5..50a8962bc 100644 --- a/gui/builtinGraphs/fitDamageStats.py +++ b/gui/builtinGraphs/fitDamageStats.py @@ -23,45 +23,27 @@ from .base import FitGraph, XDef, YDef, Input, VectorDef class FitDamageStatsGraph(FitGraph): - name = 'Damage Stats' - # UI stuff - @property - def xDefs(self): - return [ - XDef(handle='distance', unit='km', label='Distance', mainInput=('distance', 'km')), - XDef(handle='time', unit='s', label='Time', mainInput=('time', 's')), - XDef(handle='tgtSpeed', unit='m/s', label='Target speed', mainInput=('tgtSpeed', '%')), - XDef(handle='tgtSpeed', unit='%', label='Target speed', mainInput=('tgtSpeed', '%')), - XDef(handle='tgtSigRad', unit='m', label='Target signature radius', mainInput=('tgtSigRad', '%')), - XDef(handle='tgtSigRad', unit='%', label='Target signature radius', mainInput=('tgtSigRad', '%'))] - - @property - def yDefs(self): - return [ - YDef(handle='dps', unit=None, label='DPS'), - YDef(handle='volley', unit=None, label='Volley'), - YDef(handle='damage', unit=None, label='Damage inflicted')] - - @property - def inputs(self): - return [ - Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=None, defaultRange=(0, 80), mainOnly=False), - Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=50, defaultRange=(0, 100), mainOnly=False), - Input(handle='tgtSpeed', unit='%', label='Target speed', iconID=1389, defaultValue=100, defaultRange=(0, 100), mainOnly=False), - Input(handle='tgtSigRad', unit='%', label='Target signature', iconID=1390, defaultValue=100, defaultRange=(100, 200), mainOnly=True)] - - @property - def srcVectorDef(self): - return VectorDef(lengthHandle='atkSpeed', lengthUnit='%', angleHandle='atkAngle', angleUnit='degrees', label='Attacker') - - @property - def tgtVectorDef(self): - return VectorDef(lengthHandle='tgtSpeed', lengthUnit='%', angleHandle='tgtAngle', angleUnit='degrees', label='Target') - - @property - def hasTargets(self): - return True + name = 'Damage Stats' + xDefs = [ + XDef(handle='distance', unit='km', label='Distance', mainInput=('distance', 'km')), + XDef(handle='time', unit='s', label='Time', mainInput=('time', 's')), + XDef(handle='tgtSpeed', unit='m/s', label='Target speed', mainInput=('tgtSpeed', '%')), + XDef(handle='tgtSpeed', unit='%', label='Target speed', mainInput=('tgtSpeed', '%')), + XDef(handle='tgtSigRad', unit='m', label='Target signature radius', mainInput=('tgtSigRad', '%')), + XDef(handle='tgtSigRad', unit='%', label='Target signature radius', mainInput=('tgtSigRad', '%'))] + yDefs = [ + YDef(handle='dps', unit=None, label='DPS'), + YDef(handle='volley', unit=None, label='Volley'), + YDef(handle='damage', unit=None, label='Damage inflicted')] + inputs = [ + Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=None, defaultRange=(0, 80), mainOnly=False), + Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=50, defaultRange=(0, 100), mainOnly=False), + Input(handle='tgtSpeed', unit='%', label='Target speed', iconID=1389, defaultValue=100, defaultRange=(0, 100), mainOnly=False), + Input(handle='tgtSigRad', unit='%', label='Target signature', iconID=1390, defaultValue=100, defaultRange=(100, 200), mainOnly=True)] + srcVectorDef = VectorDef(lengthHandle='atkSpeed', lengthUnit='%', angleHandle='atkAngle', angleUnit='degrees', label='Attacker') + tgtVectorDef = VectorDef(lengthHandle='tgtSpeed', lengthUnit='%', angleHandle='tgtAngle', angleUnit='degrees', label='Target') + hasTargets = True # Calculation stuff _normalizers = { @@ -69,10 +51,8 @@ class FitDamageStatsGraph(FitGraph): ('atkSpeed', '%'): lambda v, fit, tgt: v / 100 * fit.ship.getModifiedItemAttr('maxVelocity'), ('tgtSpeed', '%'): lambda v, fit, tgt: v / 100 * tgt.ship.getModifiedItemAttr('maxVelocity'), ('tgtSigRad', '%'): lambda v, fit, tgt: v / 100 * fit.ship.getModifiedItemAttr('signatureRadius')} - _limiters = { 'time': lambda fit, tgt: (0, 2500)} - _denormalizers = { ('distance', 'km'): lambda v, fit, tgt: v / 1000, ('tgtSpeed', '%'): lambda v, fit, tgt: v * 100 / tgt.ship.getModifiedItemAttr('maxVelocity'), diff --git a/gui/builtinGraphs/fitMobility.py b/gui/builtinGraphs/fitMobility.py index 4a084d94f..385d570c2 100644 --- a/gui/builtinGraphs/fitMobility.py +++ b/gui/builtinGraphs/fitMobility.py @@ -25,29 +25,15 @@ from .base import FitGraph, XDef, YDef, Input class FitMobilityVsTimeGraph(FitGraph): - name = 'Mobility' - - def __init__(self): - super().__init__() - # UI stuff - @property - def xDefs(self): - return [XDef(handle='time', unit='s', label='Time', mainInput=('time', 's'))] - - @property - def yDefs(self): - return [ - YDef(handle='speed', unit='m/s', label='Speed'), - YDef(handle='distance', unit='km', label='Distance')] - - @property - def inputs(self): - return [Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=10, defaultRange=(0, 30), mainOnly=False)] - - @property - def xDef(self): - return XDef(inputDefault='0-80', inputLabel='Time (seconds)', inputIconID=1392, axisLabel='Time, s') + name = 'Mobility' + xDefs = [ + XDef(handle='time', unit='s', label='Time', mainInput=('time', 's'))] + yDefs = [ + YDef(handle='speed', unit='m/s', label='Speed'), + YDef(handle='distance', unit='km', label='Distance')] + inputs = [ + Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=10, defaultRange=(0, 30), mainOnly=False)] # Calculation stuff _denormalizers = { diff --git a/gui/builtinGraphs/fitShieldAmountVsTime.py b/gui/builtinGraphs/fitShieldAmountVsTime.py deleted file mode 100644 index 1cb16aef6..000000000 --- a/gui/builtinGraphs/fitShieldAmountVsTime.py +++ /dev/null @@ -1,50 +0,0 @@ -# ============================================================================= -# 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 . -# ============================================================================= - - -from collections import OrderedDict - -import gui.mainFrame -from eos.graph.fitShieldAmountVsTime import FitShieldAmountVsTimeGraph as EosGraph -from .base import FitGraph, XDef, YDef - - -class FitShieldAmountVsTimeGraph(FitGraph): - - name = 'Shield Amount vs Time' - - def __init__(self): - super().__init__() - self.eosGraph = EosGraph() - self.mainFrame = gui.mainFrame.MainFrame.getInstance() - - @property - def xDef(self): - return XDef(inputDefault='0-300', inputLabel='Time (seconds)', inputIconID=1392, axisLabel='Time, s') - - @property - def yDefs(self): - axisLabel = 'Shield amount, {}'.format('EHP' if self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective else 'HP') - return OrderedDict([('shieldAmount', YDef(switchLabel='Shield amount', axisLabel=axisLabel, eosGraph='eosGraph'))]) - - def redrawOnEffectiveChange(self): - return True - - -FitShieldAmountVsTimeGraph.register() diff --git a/gui/builtinGraphs/fitShieldRegen.py b/gui/builtinGraphs/fitShieldRegen.py new file mode 100644 index 000000000..837c722e4 --- /dev/null +++ b/gui/builtinGraphs/fitShieldRegen.py @@ -0,0 +1,117 @@ +# ============================================================================= +# 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 math + +import gui.mainFrame +from .base import FitGraph, XDef, YDef, Input + + +class FitShieldRegenGraph(FitGraph): + + # UI stuff + name = 'Shield Regeneration' + xDefs = [ + XDef(handle='time', unit='s', label='Time', mainInput=('time', 's')), + XDef(handle='shieldAmount', unit='EHP', label='Shield amount', mainInput=('shieldAmount', '%')), + XDef(handle='shieldAmount', unit='HP', label='Shield amount', mainInput=('shieldAmount', '%')), + XDef(handle='shieldAmount', unit='%', label='Shield amount', mainInput=('shieldAmount', '%'))] + yDefs = [ + YDef(handle='shieldAmount', unit='EHP', label='Shield amount'), + YDef(handle='shieldAmount', unit='HP', label='Shield amount'), + YDef(handle='shieldRegen', unit='EHP/s', label='Shield regen'), + YDef(handle='shieldRegen', unit='HP/s', label='Shield regen')] + inputs = [ + Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=120, defaultRange=(0, 300), mainOnly=True), + Input(handle='shieldAmount', unit='%', label='Shield amount', iconID=1384, defaultValue=25, defaultRange=(0, 100), mainOnly=True)] + + # Calculation stuff + _normalizers = { + ('shieldAmount', '%'): lambda v, fit, tgt: v / 100 * fit.ship.getModifiedItemAttr('shieldCapacity')} + _limiters = { + 'shieldAmount': lambda fit, tgt: (0, fit.ship.getModifiedItemAttr('shieldCapacity'))} + _denormalizers = { + ('shieldAmount', '%'): lambda v, fit, tgt: v * 100 / fit.ship.getModifiedItemAttr('shieldCapacity'), + ('shieldAmount', 'EHP'): lambda v, fit, tgt: fit.damagePattern.effectivify(fit, v, 'shield'), + ('shieldRegen', 'EHP/s'): lambda v, fit, tgt: fit.damagePattern.effectivify(fit, v, 'shield')} + + def _time2shieldAmount(self, mainInput, miscInputs, fit, tgt): + xs = [] + ys = [] + maxShieldAmount = fit.ship.getModifiedItemAttr('shieldCapacity') + shieldRegenTime = fit.ship.getModifiedItemAttr('shieldRechargeRate') / 1000 + for time in self._iterLinear(mainInput[1]): + currentShieldAmount = calculateShieldAmount(maxShieldAmount=maxShieldAmount, shieldRegenTime=shieldRegenTime, time=time) + xs.append(time) + ys.append(currentShieldAmount) + return xs, ys + + def _time2shieldRegen(self, mainInput, miscInputs, fit, tgt): + xs = [] + ys = [] + maxShieldAmount = fit.ship.getModifiedItemAttr('shieldCapacity') + shieldRegenTime = fit.ship.getModifiedItemAttr('shieldRechargeRate') / 1000 + for time in self._iterLinear(mainInput[1]): + currentShieldAmount = calculateShieldAmount(maxShieldAmount=maxShieldAmount, shieldRegenTime=shieldRegenTime, time=time) + currentShieldRegen = calculateShieldRegen(maxShieldAmount=maxShieldAmount, shieldRegenTime=shieldRegenTime, currentShieldAmount=currentShieldAmount) + xs.append(time) + ys.append(currentShieldRegen) + return xs, ys + + def _shieldAmount2shieldAmount(self, mainInput, miscInputs, fit, tgt): + # Useless, but valid combination of x and y + xs = [] + ys = [] + for currentShieldAmount in self._iterLinear(mainInput[1]): + xs.append(currentShieldAmount) + ys.append(currentShieldAmount) + return xs, ys + + def _shieldAmount2shieldRegen(self, mainInput, miscInputs, fit, tgt): + xs = [] + ys = [] + maxShieldAmount = fit.ship.getModifiedItemAttr('shieldCapacity') + shieldRegenTime = fit.ship.getModifiedItemAttr('shieldRechargeRate') / 1000 + for currentShieldAmount in self._iterLinear(mainInput[1]): + currentShieldRegen = calculateShieldRegen(maxShieldAmount=maxShieldAmount, shieldRegenTime=shieldRegenTime, currentShieldAmount=currentShieldAmount) + xs.append(currentShieldAmount) + ys.append(currentShieldRegen) + return xs, ys + + _getters = { + ('time', 'shieldAmount'): _time2shieldAmount, + ('time', 'shieldRegen'): _time2shieldRegen, + ('shieldAmount', 'shieldAmount'): _shieldAmount2shieldAmount, + ('shieldAmount', 'shieldRegen'): _shieldAmount2shieldRegen} + + +def calculateShieldAmount(maxShieldAmount, shieldRegenTime, time): + # The same formula as for cap + # https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate + return maxShieldAmount * (1 + math.exp(5 * -time / shieldRegenTime) * -1) ** 2 + + +def calculateShieldRegen(maxShieldAmount, shieldRegenTime, currentShieldAmount): + # The same formula as for cap + # https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate + return 10 * maxShieldAmount / shieldRegenTime * (math.sqrt(currentShieldAmount / maxShieldAmount) - currentShieldAmount / maxShieldAmount) + + +FitShieldRegenGraph.register() diff --git a/gui/builtinGraphs/fitShieldRegenVsShieldPerc.py b/gui/builtinGraphs/fitShieldRegenVsShieldPerc.py deleted file mode 100644 index 7dc8212cb..000000000 --- a/gui/builtinGraphs/fitShieldRegenVsShieldPerc.py +++ /dev/null @@ -1,51 +0,0 @@ -# ============================================================================= -# 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 . -# ============================================================================= - - -from collections import OrderedDict - -import gui.mainFrame -from eos.graph.fitShieldRegenVsShieldPerc import FitShieldRegenVsShieldPercGraph as EosGraph -from .base import FitGraph, XDef, YDef - - -class FitShieldRegenVsShieldPercGraph(FitGraph): - - name = 'Shield Regen vs Shield Amount' - - def __init__(self): - super().__init__() - self.eosGraph = EosGraph() - self.mainFrame = gui.mainFrame.MainFrame.getInstance() - - @property - def xDef(self): - return XDef(inputDefault='0-100', inputLabel='Shield amount (percent)', inputIconID=1384, axisLabel='Shield amount, %') - - @property - def yDefs(self): - axisLabel = 'Shield regen, {}/s'.format('EHP' if self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective else 'HP') - return OrderedDict([('shieldRegen', YDef(switchLabel='Shield regen', axisLabel=axisLabel, eosGraph='eosGraph'))]) - - @property - def redrawOnEffectiveChange(self): - return True - - -FitShieldRegenVsShieldPercGraph.register() diff --git a/gui/builtinGraphs/fitWarpTime.py b/gui/builtinGraphs/fitWarpTime.py index d2c322dec..2fd50301a 100644 --- a/gui/builtinGraphs/fitWarpTime.py +++ b/gui/builtinGraphs/fitWarpTime.py @@ -29,33 +29,23 @@ AU_METERS = 149597870700 class FitWarpTimeGraph(FitGraph): - name = 'Warp Time' - # UI stuff - @property - def xDefs(self): - return [ - XDef(handle='distance', unit='AU', label='Distance', mainInput=('distance', 'AU')), - XDef(handle='distance', unit='km', label='Distance', mainInput=('distance', 'km'))] - - @property - def yDefs(self): - return [YDef(handle='time', unit='s', label='Warp time')] - - @property - def inputs(self): - return [ - Input(handle='distance', unit='AU', label='Distance', iconID=1391, defaultValue=50, defaultRange=(0, 50), mainOnly=False), - Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=10000, defaultRange=(150, 5000), mainOnly=False)] + name = 'Warp Time' + xDefs = [ + XDef(handle='distance', unit='AU', label='Distance', mainInput=('distance', 'AU')), + XDef(handle='distance', unit='km', label='Distance', mainInput=('distance', 'km'))] + yDefs = [ + YDef(handle='time', unit='s', label='Warp time')] + inputs = [ + Input(handle='distance', unit='AU', label='Distance', iconID=1391, defaultValue=20, defaultRange=(0, 50), mainOnly=False), + Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=1000, defaultRange=(150, 5000), mainOnly=False)] # Calculation stuff _normalizers = { ('distance', 'AU'): lambda v, fit, tgt: v * AU_METERS, ('distance', 'km'): lambda v, fit, tgt: v * 1000} - _limiters = { 'distance': lambda fit, tgt: (0, fit.maxWarpDistance * AU_METERS)} - _denormalizers = { ('distance', 'AU'): lambda v, fit, tgt: v / AU_METERS, ('distance', 'km'): lambda v, fit, tgt: v / 1000} diff --git a/gui/builtinStatsViews/resistancesViewFull.py b/gui/builtinStatsViews/resistancesViewFull.py index d053b91b2..1dcf1da37 100644 --- a/gui/builtinStatsViews/resistancesViewFull.py +++ b/gui/builtinStatsViews/resistancesViewFull.py @@ -27,6 +27,7 @@ import gui.mainFrame import gui.globalEvents as GE from gui.utils import fonts + EffectiveHpToggled, EFFECTIVE_HP_TOGGLED = wx.lib.newevent.NewEvent() diff --git a/gui/graphFrame/frame.py b/gui/graphFrame/frame.py index 350f5870b..74482b1c3 100644 --- a/gui/graphFrame/frame.py +++ b/gui/graphFrame/frame.py @@ -121,8 +121,6 @@ class GraphFrame(wx.Frame): self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent) # Event bindings - external events self.mainFrame.Bind(GE.FIT_CHANGED, self.OnFitChanged) - from gui.builtinStatsViews.resistancesViewFull import EFFECTIVE_HP_TOGGLED # Grr crclar gons - self.mainFrame.Bind(EFFECTIVE_HP_TOGGLED, self.OnEhpToggled) self.Layout() self.UpdateWindowSize() @@ -150,13 +148,6 @@ class GraphFrame(wx.Frame): return event.Skip() - def OnEhpToggled(self, event): - event.Skip() - view = self.getView() - if view.redrawOnEffectiveChange: - view.clearCache() - self.draw() - def OnFitChanged(self, event): event.Skip() self.getView().clearCache(key=event.fitID) @@ -171,7 +162,6 @@ class GraphFrame(wx.Frame): def closeWindow(self): from gui.builtinStatsViews.resistancesViewFull import EFFECTIVE_HP_TOGGLED self.mainFrame.Unbind(GE.FIT_CHANGED, handler=self.OnFitChanged) - self.mainFrame.Unbind(EFFECTIVE_HP_TOGGLED, handler=self.OnEhpToggled) self.ctrlPanel.unbindExternalEvents() self.Destroy()