diff --git a/graphs/data/__init__.py b/graphs/data/__init__.py index 23b872114..bd58e57e3 100644 --- a/graphs/data/__init__.py +++ b/graphs/data/__init__.py @@ -23,3 +23,4 @@ from . import fitShieldRegen from . import fitCapRegen from . import fitMobility from . import fitWarpTime +from . import fitLockTime diff --git a/graphs/data/fitLockTime/__init__.py b/graphs/data/fitLockTime/__init__.py new file mode 100644 index 000000000..13f22a3ae --- /dev/null +++ b/graphs/data/fitLockTime/__init__.py @@ -0,0 +1,24 @@ +# ============================================================================= +# 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 .graph import FitLockTimeGraph + + +FitLockTimeGraph.register() diff --git a/graphs/data/fitLockTime/getter.py b/graphs/data/fitLockTime/getter.py new file mode 100644 index 000000000..301c84c1c --- /dev/null +++ b/graphs/data/fitLockTime/getter.py @@ -0,0 +1,29 @@ +# ============================================================================= +# 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 graphs.data.base import SmoothPointGetter + + +class TgtSigRadius2LockTimeGetter(SmoothPointGetter): + + def _calculatePoint(self, x, miscParams, src, tgt, commonData): + tgtSigRadius = x + time = src.item.calculateLockTime(radius=tgtSigRadius) + return time diff --git a/graphs/data/fitLockTime/graph.py b/graphs/data/fitLockTime/graph.py new file mode 100644 index 000000000..66199fc89 --- /dev/null +++ b/graphs/data/fitLockTime/graph.py @@ -0,0 +1,39 @@ +# ============================================================================= +# 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 + +from graphs.data.base import FitGraph, Input, XDef, YDef +from .getter import TgtSigRadius2LockTimeGetter + + +class FitLockTimeGraph(FitGraph): + + # UI stuff + internalName = 'lockTimeGraph' + name = 'Lock Time' + xDefs = [XDef(handle='tgtSigRad', unit='m', label='Target signature radius', mainInput=('tgtSigRad', 'm'))] + yDefs = [YDef(handle='time', unit='s', label='Lock time')] + inputs = [Input(handle='tgtSigRad', unit='m', label='Target signature', iconID=1390, defaultValue=None, defaultRange=(25, 500))] + srcExtraCols = ('ScanResolution',) + + # Calculation stuff + _limiters = {'tgtSigRad': lambda src, tgt: (1, math.inf)} + _getters = {('tgtSigRad', 'time'): TgtSigRadius2LockTimeGetter} diff --git a/gui/builtinViewColumns/attributeDisplayGraph.py b/gui/builtinViewColumns/attributeDisplayGraph.py index b3d9c0e5e..62126bd84 100644 --- a/gui/builtinViewColumns/attributeDisplayGraph.py +++ b/gui/builtinViewColumns/attributeDisplayGraph.py @@ -299,3 +299,21 @@ class WarpDistanceColumn(GraphColumn): WarpDistanceColumn.register() + + +class ScanResolutionColumn(GraphColumn): + + name = 'ScanResolution' + stickPrefixToValue = True + + def __init__(self, fittingView, params): + super().__init__(fittingView, 74) + + def _getValue(self, fit): + return fit.ship.getModifiedItemAttr('scanResolution'), 'mm' + + def _getFitTooltip(self): + return 'Scan Resolution' + + +ScanResolutionColumn.register()