From 6b11fd0a91d8234f04e5f3318c82139d469454e5 Mon Sep 17 00:00:00 2001 From: zhaoweny Date: Fri, 17 Jul 2020 12:44:47 +0800 Subject: [PATCH] i18n: string annotation for graph panels --- graphs/data/fitCapacitor/graph.py | 27 +++++----- graphs/data/fitDamageStats/graph.py | 49 ++++++++++--------- graphs/data/fitEwarStats/graph.py | 33 +++++++------ graphs/data/fitLockTime/graph.py | 15 +++--- graphs/data/fitMobility/graph.py | 31 +++++++----- graphs/data/fitRemoteReps/graph.py | 27 ++++++---- graphs/data/fitShieldRegen/graph.py | 28 ++++++----- graphs/data/fitWarpTime/graph.py | 19 ++++--- graphs/gui/ctrlPanel.py | 10 ++-- graphs/gui/frame.py | 4 +- graphs/gui/lists.py | 5 +- graphs/style.py | 32 ++++++------ gui/builtinContextMenus/graphDmgDroneMode.py | 6 +-- .../targetProfile/adder.py | 2 +- 14 files changed, 160 insertions(+), 128 deletions(-) diff --git a/graphs/data/fitCapacitor/graph.py b/graphs/data/fitCapacitor/graph.py index 21adf3125..1b55a9e14 100644 --- a/graphs/data/fitCapacitor/graph.py +++ b/graphs/data/fitCapacitor/graph.py @@ -18,31 +18,34 @@ # ============================================================================= -from graphs.data.base import FitGraph, XDef, YDef, Input, InputCheckbox +import wx + +from graphs.data.base import FitGraph, Input, InputCheckbox, XDef, YDef from .getter import CapAmount2CapAmountGetter, CapAmount2CapRegenGetter, Time2CapAmountGetter, Time2CapRegenGetter +_t = wx.GetTranslation + class FitCapacitorGraph(FitGraph): - # UI stuff internalName = 'capacitorGraph' - name = 'Capacitor' + name = _t('Capacitor') 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', '%'))] + XDef(handle='time', unit='s', label=_t('Time'), mainInput=('time', 's')), + XDef(handle='capAmount', unit='GJ', label=_t('Cap amount'), mainInput=('capAmount', '%')), + XDef(handle='capAmount', unit='%', label=_t('Cap amount'), mainInput=('capAmount', '%'))] yDefs = [ - YDef(handle='capAmount', unit='GJ', label='Cap amount'), - YDef(handle='capRegen', unit='GJ/s', label='Cap regen')] + YDef(handle='capAmount', unit='GJ', label=_t('Cap amount')), + YDef(handle='capRegen', unit='GJ/s', label=_t('Cap regen'))] inputs = [ - Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=120, defaultRange=(0, 300), conditions=[ + Input(handle='time', unit='s', label=_t('Time'), iconID=1392, defaultValue=120, defaultRange=(0, 300), conditions=[ (('time', 's'), None)]), - Input(handle='capAmount', unit='%', label='Cap amount', iconID=1668, defaultValue=25, defaultRange=(0, 100), conditions=[ + Input(handle='capAmount', unit='%', label=_t('Cap amount'), iconID=1668, defaultValue=25, defaultRange=(0, 100), conditions=[ (('capAmount', 'GJ'), None), (('capAmount', '%'), None)]), - Input(handle='capAmountT0', unit='%', label='Starting cap amount', iconID=1668, defaultValue=100, defaultRange=(0, 100), conditions=[ + Input(handle='capAmountT0', unit='%', label=_t('Starting cap amount'), iconID=1668, defaultValue=100, defaultRange=(0, 100), conditions=[ (('time', 's'), None)])] - checkboxes = [InputCheckbox(handle='useCapsim', label='Use capacitor simulator', defaultValue=True, conditions=[ + checkboxes = [InputCheckbox(handle='useCapsim', label=_t('Use capacitor simulator'), defaultValue=True, conditions=[ (('time', 's'), ('capAmount', 'GJ'))])] srcExtraCols = ('CapAmount', 'CapTime') diff --git a/graphs/data/fitDamageStats/graph.py b/graphs/data/fitDamageStats/graph.py index 960c27b55..bde7d71b6 100644 --- a/graphs/data/fitDamageStats/graph.py +++ b/graphs/data/fitDamageStats/graph.py @@ -18,15 +18,17 @@ # ============================================================================= -from graphs.data.base import FitGraph, XDef, YDef, Input, VectorDef +import wx + +from graphs.data.base import FitGraph, Input, VectorDef, XDef, YDef from service.const import GraphCacheCleanupReason from service.settings import GraphSettings from .cache import ProjectedDataCache, TimeCache -from .getter import ( - Distance2DpsGetter, Distance2VolleyGetter, Distance2InflictedDamageGetter, - Time2DpsGetter, Time2VolleyGetter, Time2InflictedDamageGetter, - TgtSpeed2DpsGetter, TgtSpeed2VolleyGetter, TgtSpeed2InflictedDamageGetter, - TgtSigRadius2DpsGetter, TgtSigRadius2VolleyGetter, TgtSigRadius2InflictedDamageGetter) +from .getter import (Distance2DpsGetter, Distance2InflictedDamageGetter, Distance2VolleyGetter, TgtSigRadius2DpsGetter, TgtSigRadius2InflictedDamageGetter, + TgtSigRadius2VolleyGetter, TgtSpeed2DpsGetter, TgtSpeed2InflictedDamageGetter, TgtSpeed2VolleyGetter, Time2DpsGetter, + Time2InflictedDamageGetter, Time2VolleyGetter) + +_t = wx.GetTranslation class FitDamageStatsGraph(FitGraph): @@ -51,23 +53,26 @@ class FitDamageStatsGraph(FitGraph): # UI stuff internalName = 'dmgStatsGraph' - name = 'Damage Stats' + name = _t('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', '%'))] + XDef(handle='distance', unit='km', label=_t('Distance'), mainInput=('distance', 'km')), + XDef(handle='time', unit='s', label=_t('Time'), mainInput=('time', 's')), + XDef(handle='tgtSpeed', unit='m/s', label=_t('Target speed'), mainInput=('tgtSpeed', '%')), + XDef(handle='tgtSpeed', unit='%', label=_t('Target speed'), mainInput=('tgtSpeed', '%')), + XDef(handle='tgtSigRad', unit='m', label=_t('Target signature radius'), mainInput=('tgtSigRad', '%')), + XDef(handle='tgtSigRad', unit='%', label=_t('Target signature radius'), mainInput=('tgtSigRad', '%'))] inputs = [ - Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=None, defaultRange=(0, 100), mainTooltip='Distance between the attacker and the target, as seen in overview (surface-to-surface)', secondaryTooltip='Distance between the attacker and the target, as seen in overview (surface-to-surface)\nWhen set, places the target that far away from the attacker\nWhen not set, attacker\'s weapons always hit the target'), - Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=None, defaultRange=(0, 80), secondaryTooltip='When set, uses attacker\'s exact damage stats at a given time\nWhen not set, uses attacker\'s damage stats as shown in stats panel of main window'), - Input(handle='tgtSpeed', unit='%', label='Target speed', iconID=1389, defaultValue=100, defaultRange=(0, 100)), - Input(handle='tgtSigRad', unit='%', label='Target signature', iconID=1390, defaultValue=100, defaultRange=(100, 200), conditions=[ + Input(handle='distance', unit='km', label=_t('Distance'), iconID=1391, defaultValue=None, defaultRange=(0, 100), + mainTooltip=_t('Distance between the attacker and the target, as seen in overview (surface-to-surface)'), + secondaryTooltip=_t('Distance between the attacker and the target, as seen in overview (surface-to-surface)\nWhen set, places the target that far away from the attacker\nWhen not set, attacker\'s weapons always hit the target')), + Input(handle='time', unit='s', label=_t('Time'), iconID=1392, defaultValue=None, defaultRange=(0, 80), + secondaryTooltip=_t('When set, uses attacker\'s exact damage stats at a given time\nWhen not set, uses attacker\'s damage stats as shown in stats panel of main window')), + Input(handle='tgtSpeed', unit='%', label=_t('Target speed'), iconID=1389, defaultValue=100, defaultRange=(0, 100)), + Input(handle='tgtSigRad', unit='%', label=_t('Target signature'), iconID=1390, defaultValue=100, defaultRange=(100, 200), conditions=[ (('tgtSigRad', 'm'), None), (('tgtSigRad', '%'), None)])] - srcVectorDef = VectorDef(lengthHandle='atkSpeed', lengthUnit='%', angleHandle='atkAngle', angleUnit='degrees', label='Attacker') - tgtVectorDef = VectorDef(lengthHandle='tgtSpeed', lengthUnit='%', angleHandle='tgtAngle', angleUnit='degrees', label='Target') + srcVectorDef = VectorDef(lengthHandle='atkSpeed', lengthUnit='%', angleHandle='atkAngle', angleUnit='degrees', label=_t('Attacker')) + tgtVectorDef = VectorDef(lengthHandle='tgtSpeed', lengthUnit='%', angleHandle='tgtAngle', angleUnit='degrees', label=_t('Target')) hasTargets = True srcExtraCols = ('Dps', 'Volley', 'Speed', 'Radius') @@ -75,9 +80,9 @@ class FitDamageStatsGraph(FitGraph): def yDefs(self): ignoreResists = GraphSettings.getInstance().get('ignoreResists') return [ - YDef(handle='dps', unit=None, label='DPS' if ignoreResists else 'Effective DPS'), - YDef(handle='volley', unit=None, label='Volley' if ignoreResists else 'Effective volley'), - YDef(handle='damage', unit=None, label='Damage inflicted' if ignoreResists else 'Effective damage inflicted')] + YDef(handle='dps', unit=None, label=_t('DPS') if ignoreResists else _t('Effective DPS')), + YDef(handle='volley', unit=None, label=_t('Volley') if ignoreResists else _t('Effective volley')), + YDef(handle='damage', unit=None, label=_t('Damage inflicted') if ignoreResists else _t('Effective damage inflicted'))] @property def tgtExtraCols(self): diff --git a/graphs/data/fitEwarStats/graph.py b/graphs/data/fitEwarStats/graph.py index 65deeee6f..d83969dd0 100644 --- a/graphs/data/fitEwarStats/graph.py +++ b/graphs/data/fitEwarStats/graph.py @@ -18,30 +18,31 @@ # ============================================================================= +import wx + from graphs.data.base import FitGraph, Input, XDef, YDef -from .getter import ( - Distance2NeutingStrGetter, Distance2WebbingStrGetter, Distance2EcmStrMaxGetter, - Distance2DampStrLockRangeGetter, Distance2TdStrOptimalGetter, Distance2GdStrRangeGetter, - Distance2TpStrGetter) +from .getter import (Distance2DampStrLockRangeGetter, Distance2EcmStrMaxGetter, Distance2GdStrRangeGetter, Distance2NeutingStrGetter, Distance2TdStrOptimalGetter, + Distance2TpStrGetter, Distance2WebbingStrGetter) + +_t = wx.GetTranslation class FitEwarStatsGraph(FitGraph): - # UI stuff internalName = 'ewarStatsGraph' - name = 'Electronic Warfare Stats' - xDefs = [XDef(handle='distance', unit='km', label='Distance', mainInput=('distance', 'km'))] + name = _t('Electronic Warfare Stats') + xDefs = [XDef(handle='distance', unit='km', label=_t('Distance'), mainInput=('distance', 'km'))] yDefs = [ - YDef(handle='neutStr', unit=None, label='Cap neutralized per second', selectorLabel='Neuts: cap per second'), - YDef(handle='webStr', unit='%', label='Speed reduction', selectorLabel='Webs: speed reduction'), - YDef(handle='ecmStrMax', unit=None, label='Combined ECM strength', selectorLabel='ECM: combined strength'), - YDef(handle='dampStrLockRange', unit='%', label='Lock range reduction', selectorLabel='Damps: lock range reduction'), - YDef(handle='tdStrOptimal', unit='%', label='Turret optimal range reduction', selectorLabel='TDs: turret optimal range reduction'), - YDef(handle='gdStrRange', unit='%', label='Missile flight range reduction', selectorLabel='GDs: missile flight range reduction'), - YDef(handle='tpStr', unit='%', label='Signature radius increase', selectorLabel='TPs: signature radius increase')] + YDef(handle='neutStr', unit=None, label=_t('Cap neutralized per second'), selectorLabel=_t('Neuts: cap per second')), + YDef(handle='webStr', unit='%', label=_t('Speed reduction'), selectorLabel=_t('Webs: speed reduction')), + YDef(handle='ecmStrMax', unit=None, label=_t('Combined ECM strength'), selectorLabel=_t('ECM: combined strength')), + YDef(handle='dampStrLockRange', unit='%', label=_t('Lock range reduction'), selectorLabel=_t('Damps: lock range reduction')), + YDef(handle='tdStrOptimal', unit='%', label=_t('Turret optimal range reduction'), selectorLabel=_t('TDs: turret optimal range reduction')), + YDef(handle='gdStrRange', unit='%', label=_t('Missile flight range reduction'), selectorLabel=_t('GDs: missile flight range reduction')), + YDef(handle='tpStr', unit='%', label=_t('Signature radius increase'), selectorLabel=_t('TPs: signature radius increase'))] inputs = [ - Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=None, defaultRange=(0, 100)), - Input(handle='resist', unit='%', label='Target resistance', iconID=1393, defaultValue=0, defaultRange=(0, 100))] + Input(handle='distance', unit='km', label=_t('Distance'), iconID=1391, defaultValue=None, defaultRange=(0, 100)), + Input(handle='resist', unit='%', label=_t('Target resistance'), iconID=1393, defaultValue=0, defaultRange=(0, 100))] # Calculation stuff _normalizers = { diff --git a/graphs/data/fitLockTime/graph.py b/graphs/data/fitLockTime/graph.py index 135c61319..9649ca108 100644 --- a/graphs/data/fitLockTime/graph.py +++ b/graphs/data/fitLockTime/graph.py @@ -20,18 +20,21 @@ import math -from graphs.data.base import FitGraph, XDef, YDef, Input +import wx + +from graphs.data.base import FitGraph, Input, XDef, YDef from .getter import TgtSigRadius2LockTimeGetter +_t = wx.GetTranslation + 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))] + name = _t('Lock Time') + xDefs = [XDef(handle='tgtSigRad', unit='m', label=_t('Target signature radius'), mainInput=('tgtSigRad', 'm'))] + yDefs = [YDef(handle='time', unit='s', label=_t('Lock time'))] + inputs = [Input(handle='tgtSigRad', unit='m', label=_t('Target signature'), iconID=1390, defaultValue=None, defaultRange=(25, 500))] srcExtraCols = ('ScanResolution',) # Calculation stuff diff --git a/graphs/data/fitMobility/graph.py b/graphs/data/fitMobility/graph.py index 9ab9818ef..8054e6a93 100644 --- a/graphs/data/fitMobility/graph.py +++ b/graphs/data/fitMobility/graph.py @@ -18,27 +18,32 @@ # ============================================================================= -from graphs.data.base import FitGraph, XDef, YDef, Input -from .getter import Time2SpeedGetter, Time2DistanceGetter, Time2MomentumGetter, Time2BumpSpeedGetter, Time2BumpDistanceGetter +import wx + +from graphs.data.base import FitGraph, Input, XDef, YDef +from .getter import Time2BumpDistanceGetter, Time2BumpSpeedGetter, Time2DistanceGetter, Time2MomentumGetter, Time2SpeedGetter + +_t = wx.GetTranslation class FitMobilityGraph(FitGraph): - # UI stuff internalName = 'mobilityGraph' - name = 'Mobility' - xDefs = [XDef(handle='time', unit='s', label='Time', mainInput=('time', 's'))] + name = _t('Mobility') + xDefs = [XDef(handle='time', unit='s', label=_t('Time'), mainInput=('time', 's'))] yDefs = [ - YDef(handle='speed', unit='m/s', label='Speed'), - YDef(handle='distance', unit='km', label='Distance'), - YDef(handle='momentum', unit='Gkg⋅m/s', label='Momentum'), - YDef(handle='bumpSpeed', unit='m/s', label='Target speed', selectorLabel='Bump speed'), - YDef(handle='bumpDistance', unit='km', label='Target distance traveled', selectorLabel='Bump distance')] + YDef(handle='speed', unit='m/s', label=_t('Speed')), + YDef(handle='distance', unit='km', label=_t('Distance')), + YDef(handle='momentum', unit='Gkg⋅m/s', label=_t('Momentum')), + YDef(handle='bumpSpeed', unit='m/s', label=_t('Target speed'), selectorLabel=_t('Bump speed')), + YDef(handle='bumpDistance', unit='km', label=_t('Target distance traveled'), selectorLabel=_t('Bump distance'))] inputs = [ - Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=10, defaultRange=(0, 30)), + Input(handle='time', unit='s', label=_t('Time'), iconID=1392, defaultValue=10, defaultRange=(0, 30)), # Default values in target fields correspond to a random carrier/fax - Input(handle='tgtMass', unit='Mkg', label='Target mass', iconID=76, defaultValue=1300, defaultRange=(100, 2500), conditions=[(None, ('bumpSpeed', 'm/s')), (None, ('bumpDistance', 'km'))], secondaryTooltip='Defined in millions of kilograms'), - Input(handle='tgtInertia', unit=None, label='Target inertia factor', iconID=1401, defaultValue=0.015, defaultRange=(0.03, 0.1), conditions=[(None, ('bumpDistance', 'km'))], secondaryTooltip='Inertia Modifier attribute value of the target ship')] + Input(handle='tgtMass', unit='Mkg', label=_t('Target mass'), iconID=76, defaultValue=1300, defaultRange=(100, 2500), + conditions=[(None, ('bumpSpeed', 'm/s')), (None, ('bumpDistance', 'km'))], secondaryTooltip=_t('Defined in millions of kilograms')), + Input(handle='tgtInertia', unit=None, label=_t('Target inertia factor'), iconID=1401, defaultValue=0.015, defaultRange=(0.03, 0.1), + conditions=[(None, ('bumpDistance', 'km'))], secondaryTooltip=_t('Inertia Modifier attribute value of the target ship'))] srcExtraCols = ('Speed', 'Agility') # Calculation stuff diff --git a/graphs/data/fitRemoteReps/graph.py b/graphs/data/fitRemoteReps/graph.py index 540a27c27..535b24111 100644 --- a/graphs/data/fitRemoteReps/graph.py +++ b/graphs/data/fitRemoteReps/graph.py @@ -18,10 +18,14 @@ # ============================================================================= -from graphs.data.base import FitGraph, XDef, YDef, Input, InputCheckbox +import wx + +from graphs.data.base import FitGraph, Input, InputCheckbox, XDef, YDef from service.const import GraphCacheCleanupReason from .cache import TimeCache -from .getter import Distance2RpsGetter, Distance2RepAmountGetter, Time2RpsGetter, Time2RepAmountGetter +from .getter import Distance2RepAmountGetter, Distance2RpsGetter, Time2RepAmountGetter, Time2RpsGetter + +_t = wx.GetTranslation class FitRemoteRepsGraph(FitGraph): @@ -41,18 +45,21 @@ class FitRemoteRepsGraph(FitGraph): # UI stuff internalName = 'remoteRepsGraph' - name = 'Remote Repairs' + name = _t('Remote Repairs') xDefs = [ - XDef(handle='distance', unit='km', label='Distance', mainInput=('distance', 'km')), - XDef(handle='time', unit='s', label='Time', mainInput=('time', 's'))] + XDef(handle='distance', unit='km', label=_t('Distance'), mainInput=('distance', 'km')), + XDef(handle='time', unit='s', label=_t('Time'), mainInput=('time', 's'))] yDefs = [ - YDef(handle='rps', unit='HP/s', label='Repair speed'), - YDef(handle='total', unit='HP', label='Total repaired')] + YDef(handle='rps', unit='HP/s', label=_t('Repair speed')), + YDef(handle='total', unit='HP', label=_t('Total repaired'))] inputs = [ - Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=None, defaultRange=(0, 80), secondaryTooltip='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'), - Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=None, defaultRange=(0, 100), mainTooltip='Distance between the repairing ship and the target, as seen in overview (surface-to-surface)', secondaryTooltip='Distance between the repairing ship and the target, as seen in overview (surface-to-surface)')] + Input(handle='time', unit='s', label=_t('Time'), iconID=1392, defaultValue=None, defaultRange=(0, 80), + 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')), + Input(handle='distance', unit='km', label=_t('Distance'), iconID=1391, defaultValue=None, defaultRange=(0, 100), + mainTooltip=_t('Distance between the repairing ship and the target, as seen in overview (surface-to-surface)'), + secondaryTooltip=_t('Distance between the repairing ship and the target, as seen in overview (surface-to-surface)'))] srcExtraCols = ('ShieldRR', 'ArmorRR', 'HullRR') - checkboxes = [InputCheckbox(handle='ancReload', label='Reload ancillary RRs', defaultValue=True)] + checkboxes = [InputCheckbox(handle='ancReload', label=_t('Reload ancillary RRs'), defaultValue=True)] # Calculation stuff _normalizers = {('distance', 'km'): lambda v, src, tgt: None if v is None else v * 1000} diff --git a/graphs/data/fitShieldRegen/graph.py b/graphs/data/fitShieldRegen/graph.py index df969a3e1..e9bd1c67c 100644 --- a/graphs/data/fitShieldRegen/graph.py +++ b/graphs/data/fitShieldRegen/graph.py @@ -18,11 +18,13 @@ # ============================================================================= +import wx + import gui.mainFrame -from graphs.data.base import FitGraph, XDef, YDef, Input -from .getter import ( - Time2ShieldAmountGetter, Time2ShieldRegenGetter, - ShieldAmount2ShieldAmountGetter, ShieldAmount2ShieldRegenGetter) +from graphs.data.base import FitGraph, Input, XDef, YDef +from .getter import (ShieldAmount2ShieldAmountGetter, ShieldAmount2ShieldRegenGetter, Time2ShieldAmountGetter, Time2ShieldRegenGetter) + +_t = wx.GetTranslation class FitShieldRegenGraph(FitGraph): @@ -33,15 +35,15 @@ class FitShieldRegenGraph(FitGraph): # UI stuff internalName = 'shieldRegenGraph' - name = 'Shield Regeneration' + name = _t('Shield Regeneration') inputs = [ - Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=120, defaultRange=(0, 300), conditions=[ + Input(handle='time', unit='s', label=_t('Time'), iconID=1392, defaultValue=120, defaultRange=(0, 300), conditions=[ (('time', 's'), None)]), - Input(handle='shieldAmount', unit='%', label='Shield amount', iconID=1384, defaultValue=25, defaultRange=(0, 100), conditions=[ + Input(handle='shieldAmount', unit='%', label=_t('Shield amount'), iconID=1384, defaultValue=25, defaultRange=(0, 100), conditions=[ (('shieldAmount', 'EHP'), None), (('shieldAmount', 'HP'), None), (('shieldAmount', '%'), None)]), - Input(handle='shieldAmountT0', unit='%', label='Starting shield amount', iconID=1384, defaultValue=0, defaultRange=(0, 100), conditions=[ + Input(handle='shieldAmountT0', unit='%', label=_t('Starting shield amount'), iconID=1384, defaultValue=0, defaultRange=(0, 100), conditions=[ (('time', 's'), None)])] srcExtraCols = ('ShieldAmount', 'ShieldTime') usesHpEffectivity = True @@ -49,15 +51,15 @@ class FitShieldRegenGraph(FitGraph): @property def xDefs(self): return [ - XDef(handle='time', unit='s', label='Time', mainInput=('time', 's')), - XDef(handle='shieldAmount', unit='EHP' if self.isEffective else 'HP', label='Shield amount', mainInput=('shieldAmount', '%')), - XDef(handle='shieldAmount', unit='%', label='Shield amount', mainInput=('shieldAmount', '%'))] + XDef(handle='time', unit='s', label=_t('Time'), mainInput=('time', 's')), + XDef(handle='shieldAmount', unit='EHP' if self.isEffective else 'HP', label=_t('Shield amount'), mainInput=('shieldAmount', '%')), + XDef(handle='shieldAmount', unit='%', label=_t('Shield amount'), mainInput=('shieldAmount', '%'))] @property def yDefs(self): return [ - YDef(handle='shieldAmount', unit='EHP' if self.isEffective else 'HP', label='Shield amount'), - YDef(handle='shieldRegen', unit='EHP/s' if self.isEffective else 'HP/s', label='Shield regen')] + YDef(handle='shieldAmount', unit='EHP' if self.isEffective else 'HP', label=_t('Shield amount')), + YDef(handle='shieldRegen', unit='EHP/s' if self.isEffective else 'HP/s', label=_t('Shield regen'))] # Calculation stuff _normalizers = { diff --git a/graphs/data/fitWarpTime/graph.py b/graphs/data/fitWarpTime/graph.py index f1080b293..87735f884 100644 --- a/graphs/data/fitWarpTime/graph.py +++ b/graphs/data/fitWarpTime/graph.py @@ -18,11 +18,15 @@ # ============================================================================= +import wx + from graphs.data.base import FitGraph, Input, XDef, YDef from service.const import GraphCacheCleanupReason from .cache import SubwarpSpeedCache from .getter import AU_METERS, Distance2TimeGetter +_t = wx.GetTranslation + class FitWarpTimeGraph(FitGraph): @@ -38,20 +42,21 @@ class FitWarpTimeGraph(FitGraph): # UI stuff internalName = 'warpTimeGraph' - name = 'Warp Time' + name = _t('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')] + XDef(handle='distance', unit='AU', label=_t('Distance'), mainInput=('distance', 'AU')), + XDef(handle='distance', unit='km', label=_t('Distance'), mainInput=('distance', 'km'))] + yDefs = [YDef(handle='time', unit='s', label=_t('Warp time'))] inputs = [ - Input(handle='distance', unit='AU', label='Distance', iconID=1391, defaultValue=20, defaultRange=(0, 50)), - Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=1000, defaultRange=(150, 5000))] + Input(handle='distance', unit='AU', label=_t('Distance'), iconID=1391, defaultValue=20, defaultRange=(0, 50)), + Input(handle='distance', unit='km', label=_t('Distance'), iconID=1391, defaultValue=1000, defaultRange=(150, 5000))] srcExtraCols = ('WarpSpeed', 'WarpDistance') # Calculation stuff _normalizers = { ('distance', 'AU'): lambda v, src, tgt: v * AU_METERS, - ('distance', 'km'): lambda v, src, tgt: v * 1000} + ('distance', 'km'): lambda v, src, tgt: v * 1000 + } _limiters = {'distance': lambda src, tgt: (0, src.item.maxWarpDistance * AU_METERS)} _getters = {('distance', 'time'): Distance2TimeGetter} _denormalizers = { diff --git a/graphs/gui/ctrlPanel.py b/graphs/gui/ctrlPanel.py index 2d78611df..418bbe468 100644 --- a/graphs/gui/ctrlPanel.py +++ b/graphs/gui/ctrlPanel.py @@ -31,10 +31,10 @@ from service.fit import Fit from .lists import SourceWrapperList, TargetWrapperList from .vector import VectorPicker - InputData = namedtuple('InputData', ('handle', 'unit', 'value')) InputBox = namedtuple('InputBox', ('handle', 'unit', 'textBox', 'icon', 'label')) CheckBox = namedtuple('CheckBox', ('handle', 'checkBox')) +_t = wx.GetTranslation class GraphControlPanel(wx.Panel): @@ -53,7 +53,7 @@ class GraphControlPanel(wx.Panel): commonOptsSizer = wx.BoxSizer(wx.VERTICAL) ySubSelectionSizer = wx.BoxSizer(wx.HORIZONTAL) - yText = wx.StaticText(self, wx.ID_ANY, 'Axis Y:') + yText = wx.StaticText(self, wx.ID_ANY, _t('Axis Y:')) ySubSelectionSizer.Add(yText, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) self.ySubSelection = wx.Choice(self, wx.ID_ANY) self.ySubSelection.Bind(wx.EVT_CHOICE, self.OnYTypeUpdate) @@ -61,18 +61,18 @@ class GraphControlPanel(wx.Panel): commonOptsSizer.Add(ySubSelectionSizer, 0, wx.EXPAND | wx.ALL, 0) xSubSelectionSizer = wx.BoxSizer(wx.HORIZONTAL) - xText = wx.StaticText(self, wx.ID_ANY, 'Axis X:') + xText = wx.StaticText(self, wx.ID_ANY, _t('Axis X:')) xSubSelectionSizer.Add(xText, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) self.xSubSelection = wx.Choice(self, wx.ID_ANY) self.xSubSelection.Bind(wx.EVT_CHOICE, self.OnXTypeUpdate) xSubSelectionSizer.Add(self.xSubSelection, 1, wx.EXPAND | wx.ALL, 0) commonOptsSizer.Add(xSubSelectionSizer, 0, wx.EXPAND | wx.TOP, 5) - self.showLegendCb = wx.CheckBox(self, wx.ID_ANY, 'Show legend', wx.DefaultPosition, wx.DefaultSize, 0) + self.showLegendCb = wx.CheckBox(self, wx.ID_ANY, _t('Show legend'), wx.DefaultPosition, wx.DefaultSize, 0) self.showLegendCb.SetValue(True) self.showLegendCb.Bind(wx.EVT_CHECKBOX, self.OnShowLegendChange) commonOptsSizer.Add(self.showLegendCb, 0, wx.EXPAND | wx.TOP, 5) - self.showY0Cb = wx.CheckBox(self, wx.ID_ANY, 'Always show Y = 0', wx.DefaultPosition, wx.DefaultSize, 0) + self.showY0Cb = wx.CheckBox(self, wx.ID_ANY, _t('Always show Y = 0'), wx.DefaultPosition, wx.DefaultSize, 0) self.showY0Cb.SetValue(True) self.showY0Cb.Bind(wx.EVT_CHECKBOX, self.OnShowY0Change) commonOptsSizer.Add(self.showY0Cb, 0, wx.EXPAND | wx.TOP, 5) diff --git a/graphs/gui/frame.py b/graphs/gui/frame.py index f0dddcb76..794d3c85b 100644 --- a/graphs/gui/frame.py +++ b/graphs/gui/frame.py @@ -34,8 +34,8 @@ from service.settings import GraphSettings from . import canvasPanel from .ctrlPanel import GraphControlPanel - pyfalog = Logger(__name__) +_t = wx.GetTranslation REDRAW_DELAY = 500 @@ -48,7 +48,7 @@ class GraphFrame(AuxiliaryFrame): pyfalog.warning('Matplotlib is not enabled. Skipping initialization.') return - super().__init__(parent, title='Graphs', size=(520, 390), resizeable=True) + super().__init__(parent, title=_t('Graphs'), size=(520, 390), resizeable=True) self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.includeHidden = includeHidden diff --git a/graphs/gui/lists.py b/graphs/gui/lists.py index 9d21c0527..a63efebcd 100644 --- a/graphs/gui/lists.py +++ b/graphs/gui/lists.py @@ -32,6 +32,7 @@ from gui.contextMenu import ContextMenu from service.const import GraphCacheCleanupReason from service.fit import Fit from .stylePickers import ColorPickerPopup, LightnessPickerPopup, LineStylePickerPopup + _t = wx.GetTranslation class BaseWrapperList(gui.display.Display): @@ -309,7 +310,7 @@ class SourceWrapperList(BaseWrapperList): @property def defaultTTText(self): - return 'Drag a fit into this list to graph it' + return _t('Drag a fit into this list to graph it') class TargetWrapperList(BaseWrapperList): @@ -366,7 +367,7 @@ class TargetWrapperList(BaseWrapperList): @property def defaultTTText(self): - return 'Drag a fit into this list to have your fits graphed against it' + return _t('Drag a fit into this list to have your fits graphed against it') # Context menu handlers def addProfile(self, profile): diff --git a/graphs/style.py b/graphs/style.py index 6b1746fdc..678b61cd8 100644 --- a/graphs/style.py +++ b/graphs/style.py @@ -25,9 +25,9 @@ import wx from service.const import GraphColor, GraphLightness, GraphLineStyle - ColorData = namedtuple('ColorData', ('hsl', 'name', 'iconName')) LightnessData = namedtuple('LightnessData', ('name', 'iconName', 'func')) +_t = wx.GetTranslation class LineStyleData: @@ -49,14 +49,14 @@ class LineStyleData: # In HSL format BASE_COLORS = OrderedDict([ - (GraphColor.red, ColorData((0 / 360.0, 1.0, 0.5), 'Red', 'color_red')), - (GraphColor.green, ColorData((120 / 360.0, 1.0, 0.5), 'Green', 'color_green')), - (GraphColor.blue, ColorData((240 / 360.0, 1.0, 0.5), 'Blue', 'color_blue')), - (GraphColor.orange, ColorData((40 / 360.0, 1.0, 0.5), 'Orange', 'color_orange')), - (GraphColor.magenta, ColorData((300 / 360.0, 1.0, 0.5), 'Magenta', 'color_magenta')), - (GraphColor.cyan, ColorData((180 / 360.0, 1.0, 0.5), 'Cyan', 'color_cyan')), - (GraphColor.purple, ColorData((275 / 360.0, 1.0, 0.5), 'Purple', 'color_purple')), - (GraphColor.yellow, ColorData((56 / 360.0, 1.0, 0.5), 'Yellow', 'color_yellow'))]) + (GraphColor.red, ColorData((0 / 360.0, 1.0, 0.5), _t('Red'), 'color_red')), + (GraphColor.green, ColorData((120 / 360.0, 1.0, 0.5), _t('Green'), 'color_green')), + (GraphColor.blue, ColorData((240 / 360.0, 1.0, 0.5), _t('Blue'), 'color_blue')), + (GraphColor.orange, ColorData((40 / 360.0, 1.0, 0.5), _t('Orange'), 'color_orange')), + (GraphColor.magenta, ColorData((300 / 360.0, 1.0, 0.5), _t('Magenta'), 'color_magenta')), + (GraphColor.cyan, ColorData((180 / 360.0, 1.0, 0.5), _t('Cyan'), 'color_cyan')), + (GraphColor.purple, ColorData((275 / 360.0, 1.0, 0.5), _t('Purple'), 'color_purple')), + (GraphColor.yellow, ColorData((56 / 360.0, 1.0, 0.5), _t('Yellow'), 'color_yellow'))]) def hsl_to_hsv(hsl): @@ -77,13 +77,13 @@ def brighten(hsl): LIGHTNESSES = OrderedDict([ - (GraphLightness.normal, LightnessData('Normal', 'lightness_normal', lambda hsl: hsl)), - (GraphLightness.dark, LightnessData('Dark', 'lightness_dark', darken)), - (GraphLightness.bright, LightnessData('Bright', 'lightness_bright', brighten))]) + (GraphLightness.normal, LightnessData(_t('Normal'), 'lightness_normal', lambda hsl: hsl)), + (GraphLightness.dark, LightnessData(_t('Dark'), 'lightness_dark', darken)), + (GraphLightness.bright, LightnessData(_t('Bright'), 'lightness_bright', brighten))]) STYLES = OrderedDict([ - (GraphLineStyle.solid, LineStyleData('Solid', 'style_solid', 'solid')), - (GraphLineStyle.dashed, LineStyleData('Dashed', 'style_dashed', (0, (5, 1)))), - (GraphLineStyle.dotted, LineStyleData('Dotted', 'style_dotted', (0, (1, 1)))), - (GraphLineStyle.dashdotted, LineStyleData('Dash-dotted', 'style_dashdot', (0, (3, 1, 1, 1))))]) + (GraphLineStyle.solid, LineStyleData(_t('Solid'), 'style_solid', 'solid')), + (GraphLineStyle.dashed, LineStyleData(_t('Dashed'), 'style_dashed', (0, (5, 1)))), + (GraphLineStyle.dotted, LineStyleData(_t('Dotted'), 'style_dotted', (0, (1, 1)))), + (GraphLineStyle.dashdotted, LineStyleData(_t('Dash-dotted'), 'style_dashdot', (0, (3, 1, 1, 1))))]) diff --git a/gui/builtinContextMenus/graphDmgDroneMode.py b/gui/builtinContextMenus/graphDmgDroneMode.py index e637dd8d0..361c861ff 100644 --- a/gui/builtinContextMenus/graphDmgDroneMode.py +++ b/gui/builtinContextMenus/graphDmgDroneMode.py @@ -40,9 +40,9 @@ class GraphDmgDroneModeMenu(ContextMenuUnconditional): bindmenu = m self.idOptionMap = {} optionMap = OrderedDict([ - (GraphDpsDroneMode.auto, 'Auto'), - (GraphDpsDroneMode.followTarget, 'Stick to Target'), - (GraphDpsDroneMode.followAttacker, 'Stick to Attacker')]) + (GraphDpsDroneMode.auto, _t('Auto')), + (GraphDpsDroneMode.followTarget, _t('Stick to Target')), + (GraphDpsDroneMode.followAttacker, _t('Stick to Attacker'))]) for option, label in optionMap.items(): menuId = ContextMenuUnconditional.nextID() item = wx.MenuItem(m, menuId, label, kind=wx.ITEM_CHECK) diff --git a/gui/builtinContextMenus/targetProfile/adder.py b/gui/builtinContextMenus/targetProfile/adder.py index 8b3089e66..1df7d7b2d 100644 --- a/gui/builtinContextMenus/targetProfile/adder.py +++ b/gui/builtinContextMenus/targetProfile/adder.py @@ -26,7 +26,7 @@ class TargetProfileAdder(ContextMenuUnconditional): return True def getText(self, callingWindow, itmContext): - return 'Add Target Profile' + return _t('Add Target Profile') def handleProfileAdd(self, event): profile = self.eventProfileMap.get(event.Id, False)