MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / FitRemoteRepsGraph

Class FitRemoteRepsGraph

graphs/data/fitRemoteReps/graph.py:31–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30
31class FitRemoteRepsGraph(FitGraph):
32
33 def __init__(self, *args, **kwargs):
34 super().__init__(*args, **kwargs)
35 self._timeCache = TimeCache()
36
37 def _clearInternalCache(self, reason, extraData):
38 # Here, we care only about fit changes, graph changes and option switches
39 # - Input changes are irrelevant as time cache cares only about
40 # time input, and it regenerates once time goes beyond cached value
41 if reason in (GraphCacheCleanupReason.fitChanged, GraphCacheCleanupReason.fitRemoved):
42 self._timeCache.clearForFit(extraData)
43 elif reason == GraphCacheCleanupReason.graphSwitched:
44 self._timeCache.clearAll()
45
46 # UI stuff
47 internalName = 'remoteRepsGraph'
48 name = _t('Remote Repairs')
49 xDefs = [
50 XDef(handle='distance', unit='km', label=_t('Distance'), mainInput=('distance', 'km')),
51 XDef(handle='time', unit='s', label=_t('Time'), mainInput=('time', 's'))]
52 yDefs = [
53 YDef(handle='rps', unit='HP/s', label=_t('Repair speed')),
54 YDef(handle='total', unit='HP', label=_t('Total repaired'))]
55 inputs = [
56 Input(handle='time', unit='s', label=_t('Time'), iconID=1392, defaultValue=None, defaultRange=(0, 80),
57 secondaryTooltip=_t('When set, uses repairing ship\'s exact RR stats at a given time\nWhen not set, uses repairing ship\'s RR stats as shown in stats panel of main window')),
58 Input(handle='distance', unit='km', label=_t('Distance'), iconID=1391, defaultValue=None, defaultRange=(0, 100),
59 mainTooltip=_t('Distance between the repairing ship and the target, as seen in overview (surface-to-surface)'),
60 secondaryTooltip=_t('Distance between the repairing ship and the target, as seen in overview (surface-to-surface)'))]
61 srcExtraCols = ('ShieldRR', 'ArmorRR', 'HullRR')
62 checkboxes = [InputCheckbox(handle='ancReload', label=_t('Reload ancillary RRs'), defaultValue=True)]
63
64 # Calculation stuff
65 _normalizers = {('distance', 'km'): lambda v, src, tgt: None if v is None else v * 1000}
66 _limiters = {'time': lambda src, tgt: (0, 2500)}
67 _getters = {
68 ('distance', 'rps'): Distance2RpsGetter,
69 ('distance', 'total'): Distance2RepAmountGetter,
70 ('time', 'rps'): Time2RpsGetter,
71 ('time', 'total'): Time2RepAmountGetter}
72 _denormalizers = {('distance', 'km'): lambda v, src, tgt: None if v is None else v / 1000}

Callers

nothing calls this directly

Calls 5

XDefClass · 0.90
YDefClass · 0.90
InputClass · 0.90
InputCheckboxClass · 0.90
_tFunction · 0.50

Tested by

no test coverage detected