i18n: more annotation for context menus, stats view tooltips
This commit is contained in:
@@ -32,7 +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):
|
||||
|
||||
@@ -302,7 +302,7 @@ class SourceWrapperList(BaseWrapperList):
|
||||
selection = self.getSelectedWrappers()
|
||||
mainItem = self.getWrapper(clickedPos)
|
||||
|
||||
itemContext = None if mainItem is None else 'Fit'
|
||||
itemContext = None if mainItem is None else _t('Fit')
|
||||
menu = ContextMenu.getMenu(self, mainItem, selection, ('graphFitList', itemContext), ('graphFitListMisc', itemContext))
|
||||
if menu:
|
||||
self.PopupMenu(menu)
|
||||
@@ -355,7 +355,7 @@ class TargetWrapperList(BaseWrapperList):
|
||||
selection = self.getSelectedWrappers()
|
||||
mainItem = self.getWrapper(clickedPos)
|
||||
|
||||
itemContext = None if mainItem is None else 'Target'
|
||||
itemContext = None if mainItem is None else _t('Target')
|
||||
menu = ContextMenu.getMenu(self, mainItem, selection, ('graphTgtList', itemContext), ('graphTgtListMisc', itemContext))
|
||||
if menu:
|
||||
self.PopupMenu(menu)
|
||||
|
||||
@@ -29,7 +29,7 @@ from gui.contextMenu import ContextMenu
|
||||
from gui.utils.staticHelpers import DragDropHelper
|
||||
from service.fit import Fit
|
||||
from service.market import Market
|
||||
|
||||
_t = wx.GetTranslation
|
||||
|
||||
class BoosterViewDrop(wx.DropTarget):
|
||||
def __init__(self, dropFn, *args, **kwargs):
|
||||
@@ -212,7 +212,7 @@ class BoosterView(d.Display):
|
||||
else:
|
||||
if booster in self.original:
|
||||
mainBooster = booster
|
||||
itemContext = None if mainBooster is None else "Booster"
|
||||
itemContext = None if mainBooster is None else _t("Booster")
|
||||
menu = ContextMenu.getMenu(self, mainBooster, selection, ("boosterItem", itemContext), ("boosterItemMisc", itemContext))
|
||||
if menu:
|
||||
self.PopupMenu(menu)
|
||||
|
||||
@@ -30,6 +30,7 @@ from gui.contextMenu import ContextMenu
|
||||
from gui.utils.staticHelpers import DragDropHelper
|
||||
from service.fit import Fit
|
||||
|
||||
_t = wx.GetTranslation
|
||||
|
||||
class DummyItem:
|
||||
|
||||
@@ -197,7 +198,7 @@ class CommandView(d.Display):
|
||||
pass
|
||||
contexts = []
|
||||
if mainCommandFit is not None:
|
||||
contexts.append(('commandFit', 'Command Fit'))
|
||||
contexts.append(('commandFit', _t('Command Fit')))
|
||||
contexts.append(('commandView',))
|
||||
menu = ContextMenu.getMenu(self, mainCommandFit, selection, *contexts)
|
||||
if menu:
|
||||
|
||||
@@ -41,7 +41,7 @@ from service.market import Market
|
||||
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
_t = wx.GetTranslation
|
||||
|
||||
class DummyItem:
|
||||
def __init__(self, txt):
|
||||
@@ -303,7 +303,7 @@ class ProjectedView(d.Display):
|
||||
|
||||
if isinstance(mainItem, EosModule):
|
||||
modSrcContext = 'projectedModule'
|
||||
modItemContext = 'Projected Item'
|
||||
modItemContext = _t('Projected Item')
|
||||
modFullContext = (modSrcContext, modItemContext)
|
||||
contexts.append(modFullContext)
|
||||
if mainItem.charge is not None:
|
||||
@@ -313,17 +313,17 @@ class ProjectedView(d.Display):
|
||||
contexts.append(chargeFullContext)
|
||||
elif isinstance(mainItem, EosDrone):
|
||||
srcContext = 'projectedDrone'
|
||||
itemContext = 'Projected Item'
|
||||
itemContext = _t('Projected Item')
|
||||
droneFullContext = (srcContext, itemContext)
|
||||
contexts.append(droneFullContext)
|
||||
elif isinstance(mainItem, EosFighter):
|
||||
srcContext = 'projectedFighter'
|
||||
itemContext = 'Projected Item'
|
||||
itemContext = _t('Projected Item')
|
||||
fighterFullContext = (srcContext, itemContext)
|
||||
contexts.append(fighterFullContext)
|
||||
else:
|
||||
fitSrcContext = 'projectedFit'
|
||||
fitItemContext = 'Projected Item'
|
||||
fitItemContext = _t('Projected Item')
|
||||
fitFullContext = (fitSrcContext, fitItemContext)
|
||||
contexts.append(fitFullContext)
|
||||
contexts.append(('projected',))
|
||||
|
||||
@@ -15,7 +15,7 @@ from service.market import Market
|
||||
from .events import FitSelected, Stage3Selected
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
_t = wx.GetTranslation
|
||||
|
||||
class ShipItem(SFItem.SFBrowserItem):
|
||||
|
||||
@@ -108,7 +108,7 @@ class ShipItem(SFItem.SFBrowserItem):
|
||||
def OnShowPopup(self, event):
|
||||
pos = event.GetPosition()
|
||||
pos = self.ScreenToClient(pos)
|
||||
contexts = [("baseShip", "Ship Basic")]
|
||||
contexts = [("baseShip", _t("Ship Basic"))]
|
||||
menu = ContextMenu.getMenu(self, self.baseItem, (self.baseItem,), *contexts)
|
||||
self.PopupMenu(menu, pos)
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ class ResistancesViewFull(StatsView):
|
||||
self.stEHPs.SetToolTip(wx.ToolTip(_t("Click to toggle between effective HP and raw HP")))
|
||||
|
||||
def toggleEHP(self, event):
|
||||
wx.PostEvent(self.mainFrame, GE.EffectiveHpToggled(effective=self.stEHPs.GetLabel() == "HP"))
|
||||
wx.PostEvent(self.mainFrame, GE.EffectiveHpToggled(effective=self.stEHPs.GetLabel() == _t("HP")))
|
||||
|
||||
def ehpSwitch(self, event):
|
||||
event.Skip()
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
# =============================================================================
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
from gui.statsView import StatsView
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
from collections import OrderedDict
|
||||
|
||||
_t = wx.GetTranslation
|
||||
|
||||
@@ -104,7 +106,8 @@ class TargetingMiscViewMinimal(StatsView):
|
||||
|
||||
sensorValues = {
|
||||
"main": lambda: fit.scanStrength,
|
||||
"jamChance": lambda: fit.jamChance}
|
||||
"jamChance": lambda: fit.jamChance
|
||||
}
|
||||
|
||||
cargoNamesOrder = OrderedDict((
|
||||
("fleetHangarCapacity", _t("Fleet hangar")),
|
||||
@@ -143,7 +146,8 @@ class TargetingMiscViewMinimal(StatsView):
|
||||
"specialSalvageHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialSalvageHoldCapacity"),
|
||||
"specialCommandCenterHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialCommandCenterHoldCapacity"),
|
||||
"specialPlanetaryCommoditiesHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialPlanetaryCommoditiesHoldCapacity"),
|
||||
"specialQuafeHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialQuafeHoldCapacity")}
|
||||
"specialQuafeHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialQuafeHoldCapacity")
|
||||
}
|
||||
|
||||
stats = (("labelTargets", {"main": lambda: fit.maxTargets}, 3, 0, 0, ""),
|
||||
("labelRange", {"main": lambda: fit.maxTargetRange / 1000}, 3, 0, 0, "km"),
|
||||
@@ -157,10 +161,10 @@ class TargetingMiscViewMinimal(StatsView):
|
||||
("labelFullCargo", cargoValues, 4, 0, 9, "m\u00B3"))
|
||||
|
||||
counter = 0
|
||||
RADII = [("Pod", 25), ("Interceptor", 33), ("Frigate", 38),
|
||||
("Destroyer", 83), ("Cruiser", 130),
|
||||
("Battlecruiser", 265), ("Battleship", 420),
|
||||
("Carrier", 3000)]
|
||||
RADII = [(_t("Pod"), 25), (_t("Interceptor"), 33), (_t("Frigate"), 38),
|
||||
(_t("Destroyer"), 83), (_t("Cruiser"), 130),
|
||||
(_t("Battlecruiser"), 265), (_t("Battleship"), 420),
|
||||
(_t("Carrier"), 3000)]
|
||||
for labelName, valueDict, prec, lowest, highest, unit in stats:
|
||||
label = getattr(self, labelName)
|
||||
newValues = {}
|
||||
@@ -185,8 +189,8 @@ class TargetingMiscViewMinimal(StatsView):
|
||||
ecmChance = round(ecmChance, 1)
|
||||
if ecmChance:
|
||||
label.SetLabel("{} ({}%)".format(
|
||||
formatAmount(mainValue, prec, lowest, highest),
|
||||
formatAmount(ecmChance, 3, 0, 0)))
|
||||
formatAmount(mainValue, prec, lowest, highest),
|
||||
formatAmount(ecmChance, 3, 0, 0)))
|
||||
else:
|
||||
label.SetLabel("{}".format(formatAmount(mainValue, prec, lowest, highest)))
|
||||
else:
|
||||
@@ -194,35 +198,35 @@ class TargetingMiscViewMinimal(StatsView):
|
||||
# Tooltip stuff
|
||||
if fit:
|
||||
if labelName == "labelScanRes":
|
||||
lockTime = "%s\n" % "Lock Times".center(30)
|
||||
lockTime = "%s\n" % _t("Lock Times").center(30)
|
||||
for size, radius in RADII:
|
||||
left = "%.1fs" % fit.calculateLockTime(radius)
|
||||
right = "%s [%d]" % (size, radius)
|
||||
lockTime += "%5s\t%s\n" % (left, right)
|
||||
label.SetToolTip(wx.ToolTip(lockTime))
|
||||
elif labelName == "labelFullWarpSpeed":
|
||||
maxWarpDistance = "Max Warp Distance: %.1f AU" % fit.maxWarpDistance
|
||||
maxWarpDistance = _t("Max Warp Distance: %.1f AU") % fit.maxWarpDistance
|
||||
if fit.ship.getModifiedItemAttr("warpScrambleStatus"):
|
||||
warpScrambleStatus = "Warp Core Strength: %.1f" % (fit.ship.getModifiedItemAttr("warpScrambleStatus") * -1)
|
||||
warpScrambleStatus = _t("Warp Core Strength: %.1f") % (fit.ship.getModifiedItemAttr("warpScrambleStatus") * -1)
|
||||
else:
|
||||
warpScrambleStatus = "Warp Core Strength: %.1f" % 0
|
||||
warpScrambleStatus = _t("Warp Core Strength: %.1f") % 0
|
||||
label.SetToolTip(wx.ToolTip("%s\n%s" % (maxWarpDistance, warpScrambleStatus)))
|
||||
elif labelName == "labelSensorStr":
|
||||
ecmChance = otherValues["jamChance"]
|
||||
ecmChance = round(ecmChance, 1)
|
||||
if ecmChance > 0:
|
||||
label.SetToolTip(wx.ToolTip("Type: {}\n{}% chance to be jammed".format(
|
||||
fit.scanType,
|
||||
formatAmount(ecmChance, 3, 0, 0))))
|
||||
label.SetToolTip(wx.ToolTip(
|
||||
_t("Type: {0}\n").foramt(fit.scanType) + "{}%".format(formatAmount(ecmChance, 3, 0, 0)) + _t(" chance to be jammed").format(
|
||||
formatAmount(ecmChance, 3, 0, 0))))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip("Type: {}".format(fit.scanType)))
|
||||
label.SetToolTip(wx.ToolTip(_t("Type: {}").format(fit.scanType)))
|
||||
elif labelName == "labelFullAlignTime":
|
||||
alignTime = "Align:\t%.3fs" % mainValue
|
||||
mass = 'Mass:\t{:,.0f}kg'.format(fit.ship.getModifiedItemAttr("mass"))
|
||||
agility = "Agility:\t%.3fx" % (fit.ship.getModifiedItemAttr("agility") or 0)
|
||||
alignTime = _t("Align:\t%.3fs") % mainValue
|
||||
mass = _t('Mass:\t{:,.0f}kg').format(fit.ship.getModifiedItemAttr("mass"))
|
||||
agility = _t("Agility:\t%.3fx") % (fit.ship.getModifiedItemAttr("agility") or 0)
|
||||
label.SetToolTip(wx.ToolTip("%s\n%s\n%s" % (alignTime, mass, agility)))
|
||||
elif labelName == "labelFullCargo":
|
||||
tipLines = ["Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])]
|
||||
tipLines = [_t("Cargohold: ")+"{:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])]
|
||||
for attrName, tipAlias in list(cargoNamesOrder.items()):
|
||||
if newValues[attrName] > 0:
|
||||
tipLines.append("{}: {:,.2f}m\u00B3".format(tipAlias, newValues[attrName]))
|
||||
@@ -234,11 +238,11 @@ class TargetingMiscViewMinimal(StatsView):
|
||||
self._cachedValues[counter] = newValues
|
||||
elif labelName == "labelFullWarpSpeed":
|
||||
if fit:
|
||||
maxWarpDistance = "Max Warp Distance: %.1f AU" % fit.maxWarpDistance
|
||||
maxWarpDistance = _t("Max Warp Distance: %.1f AU") % fit.maxWarpDistance
|
||||
if fit.ship.getModifiedItemAttr("warpScrambleStatus"):
|
||||
warpScrambleStatus = "Warp Core Strength: %.1f" % (fit.ship.getModifiedItemAttr("warpScrambleStatus") * -1)
|
||||
warpScrambleStatus = _t("Warp Core Strength: %.1f") % (fit.ship.getModifiedItemAttr("warpScrambleStatus") * -1)
|
||||
else:
|
||||
warpScrambleStatus = "Warp Core Strength: %.1f" % 0
|
||||
warpScrambleStatus = _t("Warp Core Strength: %.1f") % 0
|
||||
label.SetToolTip(wx.ToolTip("%s\n%s" % (maxWarpDistance, warpScrambleStatus)))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip(""))
|
||||
@@ -247,7 +251,7 @@ class TargetingMiscViewMinimal(StatsView):
|
||||
cachedCargo = self._cachedValues[counter]
|
||||
# if you add stuff to cargo, the capacity doesn't change and thus it is still cached
|
||||
# This assures us that we force refresh of cargo tooltip
|
||||
tipLines = ["Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])]
|
||||
tipLines = [_t("Cargohold: ")+"{:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])]
|
||||
for attrName, tipAlias in list(cargoNamesOrder.items()):
|
||||
if cachedCargo[attrName] > 0:
|
||||
tipLines.append("{}: {:,.2f}m\u00B3".format(tipAlias, cachedCargo[attrName]))
|
||||
@@ -258,7 +262,7 @@ class TargetingMiscViewMinimal(StatsView):
|
||||
# forces update of probe size, since this stat is used by both sig radius and sensor str
|
||||
if labelName == "labelFullSigRadius":
|
||||
if fit:
|
||||
label.SetToolTip(wx.ToolTip("Probe Size: %.3f" % (fit.probeSize or 0)))
|
||||
label.SetToolTip(wx.ToolTip(_t("Probe Size: %.3f") % (fit.probeSize or 0)))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip(""))
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ from config import slotColourMap
|
||||
from gui.fitCommands.helpers import getSimilarModPositions
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
_t = wx.GetTranslation
|
||||
|
||||
|
||||
# Tab spawning handler
|
||||
@@ -653,11 +654,11 @@ class FittingView(d.Display):
|
||||
contexts.append(fullContext)
|
||||
elif isinstance(mainMod, Mode):
|
||||
srcContext = "fittingMode"
|
||||
itemContext = "Tactical Mode"
|
||||
itemContext = _t("Tactical Mode")
|
||||
fullContext = (srcContext, itemContext)
|
||||
if srcContext not in tuple(fCtx[0] for fCtx in contexts):
|
||||
contexts.append(fullContext)
|
||||
contexts.append(("fittingShip", "Ship" if not fit.isStructure else "Citadel"))
|
||||
contexts.append(("fittingShip", _t("Ship") if not fit.isStructure else _t("Citadel")))
|
||||
|
||||
menu = ContextMenu.getMenu(self, mainMod, selection, *contexts)
|
||||
self.PopupMenu(menu)
|
||||
|
||||
@@ -605,7 +605,7 @@ class SkillTreeView(wx.Panel):
|
||||
eveItem = Market.getInstance().getItem(id)
|
||||
|
||||
srcContext = "skillItem"
|
||||
itemContext = "Skill"
|
||||
itemContext = _t("Skill")
|
||||
context = (srcContext, itemContext)
|
||||
menu = ContextMenu.getMenu(self, eveItem, [eveItem], context)
|
||||
char = self.charEditor.entityEditor.getActiveEntity()
|
||||
|
||||
Reference in New Issue
Block a user