From 9b73f1c22122502a367870efb3d896dd7b64c860 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sat, 20 Jun 2020 15:13:33 -0400 Subject: [PATCH] Final conversion of `_t()` --- gui/builtinStatsViews/resistancesViewFull.py | 26 +++--- gui/builtinStatsViews/resourcesViewFull.py | 26 +++--- .../targetingMiscViewMinimal.py | 58 ++++++------- gui/characterEditor.py | 78 ++++++++--------- gui/characterSelection.py | 22 ++--- gui/chrome_tabs.py | 2 +- gui/esiFittings.py | 60 ++++++------- gui/fitBrowserLite.py | 4 +- gui/itemStats.py | 24 +++--- gui/mainFrame.py | 80 +++++++++--------- gui/mainMenuBar.py | 84 +++++++++---------- gui/multiSwitch.py | 4 +- gui/patternEditor.py | 26 +++--- gui/targetProfileEditor.py | 44 +++++----- 14 files changed, 269 insertions(+), 269 deletions(-) diff --git a/gui/builtinStatsViews/resistancesViewFull.py b/gui/builtinStatsViews/resistancesViewFull.py index 05ef64283..66fa4cc40 100644 --- a/gui/builtinStatsViews/resistancesViewFull.py +++ b/gui/builtinStatsViews/resistancesViewFull.py @@ -28,7 +28,7 @@ from gui.statsView import StatsView from gui.utils import fonts from gui.utils.numberFormatter import formatAmount -_ = wx.GetTranslation +_t = wx.GetTranslation class ResistancesViewFull(StatsView): @@ -44,7 +44,7 @@ class ResistancesViewFull(StatsView): self.mainFrame.Bind(GE.EFFECTIVE_HP_TOGGLED, self.ehpSwitch) def getHeaderText(self, fit): - return _("Resistances") + return _t("Resistances") def getTextExtentW(self, text): width, height = self.parent.GetTextExtent(text) @@ -58,7 +58,7 @@ class ResistancesViewFull(StatsView): # Custom header EHP headerContentSizer = self.headerPanel.Parent.GetHeaderContentSizer() - self.stEff = wx.StaticText(headerPanel, wx.ID_ANY, "(" + _("Effective HP") + ": ") + self.stEff = wx.StaticText(headerPanel, wx.ID_ANY, "(" + _t("Effective HP") + ": ") headerContentSizer.Add(self.stEff) headerPanel.GetParent().AddToggleItem(self.stEff) @@ -82,10 +82,10 @@ class ResistancesViewFull(StatsView): sizerResistances.Add(wx.StaticText(contentPanel, wx.ID_ANY), wx.GBPosition(row, col), wx.GBSpan(1, 1)) col += 1 toolTipText = { - "em": _("Electromagnetic resistance"), - "thermal": _("Thermal resistance"), - "kinetic": _("Kinetic resistance"), - "explosive": _("Explosive resistance") + "em": _t("Electromagnetic resistance"), + "thermal": _t("Thermal resistance"), + "kinetic": _t("Kinetic resistance"), + "explosive": _t("Explosive resistance") } for damageType in ("em", "thermal", "kinetic", "explosive"): bitmap = BitmapLoader.getStaticBitmap("%s_big" % damageType, contentPanel, "gui") @@ -94,7 +94,7 @@ class ResistancesViewFull(StatsView): sizerResistances.Add(bitmap, wx.GBPosition(row, col), wx.GBSpan(1, 1), wx.ALIGN_CENTER) col += 1 self.stEHPs = wx.Button(contentPanel, style=wx.BU_EXACTFIT, label="EHP") - self.stEHPs.SetToolTip(wx.ToolTip(_("Click to toggle between effective HP and raw HP"))) + self.stEHPs.SetToolTip(wx.ToolTip(_t("Click to toggle between effective HP and raw HP"))) self.stEHPs.Bind(wx.EVT_BUTTON, self.toggleEHP) @@ -109,10 +109,10 @@ class ResistancesViewFull(StatsView): ((198, 133, 38), (81, 83, 67))) toolTipText = { - "shield": _("Shield resistance"), - "armor": _("Armor resistance"), - "hull": _("Hull resistance"), - "damagePattern": _("Incoming damage pattern") + "shield": _t("Shield resistance"), + "armor": _t("Armor resistance"), + "hull": _t("Hull resistance"), + "damagePattern": _t("Incoming damage pattern") } for tankType in ("shield", "armor", "hull", "separator", "damagePattern"): if tankType != "separator": @@ -166,7 +166,7 @@ class ResistancesViewFull(StatsView): row += 1 col = 0 - self.stEHPs.SetToolTip(wx.ToolTip(_("Click to toggle between effective HP and raw HP"))) + 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")) diff --git a/gui/builtinStatsViews/resourcesViewFull.py b/gui/builtinStatsViews/resourcesViewFull.py index 32719f8e0..77d0b5755 100644 --- a/gui/builtinStatsViews/resourcesViewFull.py +++ b/gui/builtinStatsViews/resourcesViewFull.py @@ -30,7 +30,7 @@ from eos.const import FittingHardpoint from gui.utils.numberFormatter import formatAmount -_ = wx.GetTranslation +_t = wx.GetTranslation class ResourcesViewFull(StatsView): @@ -81,7 +81,7 @@ class ResourcesViewFull(StatsView): self.headerPanel.Layout() def getHeaderText(self, fit): - return _("Resources") + return _t("Resources") def getTextExtentW(self, text): width, height = self.parent.GetTextExtent(text) @@ -108,11 +108,11 @@ class ResourcesViewFull(StatsView): sizer.AddStretchSpacer() # Turrets & launcher hardslots display tooltipText = { - "turret": _("Turret hardpoints"), - "launcher": _("Launcher hardpoints"), - "drones": _("Drones active"), - "fighter": _("Fighter squadrons active"), - "calibration": _("Calibration") + "turret": _t("Turret hardpoints"), + "launcher": _t("Launcher hardpoints"), + "drones": _t("Drones active"), + "fighter": _t("Fighter squadrons active"), + "calibration": _t("Calibration") } for type_ in ("turret", "launcher", "drones", "fighter", "calibration"): box = wx.BoxSizer(wx.HORIZONTAL) @@ -150,12 +150,12 @@ class ResourcesViewFull(StatsView): # PG, Cpu & drone stuff tooltipText = { - "cpu": _("CPU"), - "pg": _("PowerGrid"), - "droneBay": _("Drone bay"), - "fighterBay": _("Fighter bay"), - "droneBandwidth": _("Drone bandwidth"), - "cargoBay": _("Cargo bay") + "cpu": _t("CPU"), + "pg": _t("PowerGrid"), + "droneBay": _t("Drone bay"), + "fighterBay": _t("Fighter bay"), + "droneBandwidth": _t("Drone bandwidth"), + "cargoBay": _t("Cargo bay") } for i, group in enumerate((("cpu", "pg"), ("cargoBay", "droneBay", "fighterBay", "droneBandwidth"))): main = wx.BoxSizer(wx.VERTICAL) diff --git a/gui/builtinStatsViews/targetingMiscViewMinimal.py b/gui/builtinStatsViews/targetingMiscViewMinimal.py index b9656e0bb..16812b7d8 100644 --- a/gui/builtinStatsViews/targetingMiscViewMinimal.py +++ b/gui/builtinStatsViews/targetingMiscViewMinimal.py @@ -23,7 +23,7 @@ from gui.statsView import StatsView from gui.utils.numberFormatter import formatAmount from collections import OrderedDict -_ = wx.GetTranslation +_t = wx.GetTranslation class TargetingMiscViewMinimal(StatsView): @@ -35,7 +35,7 @@ class TargetingMiscViewMinimal(StatsView): self._cachedValues = [] def getHeaderText(self, fit): - return _("Targeting && Misc") + return _t("Targeting && Misc") def getTextExtentW(self, text): width, height = self.parent.GetTextExtent(text) @@ -57,11 +57,11 @@ class TargetingMiscViewMinimal(StatsView): gridTargetingMisc.Add(gridTargeting, 0, wx.ALIGN_LEFT | wx.ALL, 5) - labels = ((_("Targets"), "Targets", ""), - (_("Range"), "Range", "km"), - (_("Scan res."), "ScanRes", "mm"), - (_("Sensor str."), "SensorStr", ""), - (_("Drone range"), "CtrlRange", "km")) + labels = ((_t("Targets"), "Targets", ""), + (_t("Range"), "Range", "km"), + (_t("Scan res."), "ScanRes", "mm"), + (_t("Sensor str."), "SensorStr", ""), + (_t("Drone range"), "CtrlRange", "km")) for header, labelShort, unit in labels: gridTargeting.Add(wx.StaticText(contentPanel, wx.ID_ANY, "%s: " % header), 0, wx.ALIGN_LEFT) @@ -81,11 +81,11 @@ class TargetingMiscViewMinimal(StatsView): gridMisc.AddGrowableCol(1) gridTargetingMisc.Add(gridMisc, 0, wx.ALIGN_LEFT | wx.ALL, 5) - labels = ((_("Speed"), "Speed", "m/s"), - (_("Align time"), "AlignTime", "s"), - (_("Signature"), "SigRadius", "m"), - (_("Warp Speed"), "WarpSpeed", "AU/s"), - (_("Cargo"), "Cargo", "m\u00B3")) + labels = ((_t("Speed"), "Speed", "m/s"), + (_t("Align time"), "AlignTime", "s"), + (_t("Signature"), "SigRadius", "m"), + (_t("Warp Speed"), "WarpSpeed", "AU/s"), + (_t("Cargo"), "Cargo", "m\u00B3")) for header, labelShort, unit in labels: gridMisc.Add(wx.StaticText(contentPanel, wx.ID_ANY, "%s: " % header), 0, wx.ALIGN_LEFT) @@ -107,23 +107,23 @@ class TargetingMiscViewMinimal(StatsView): "jamChance": lambda: fit.jamChance} cargoNamesOrder = OrderedDict(( - ("fleetHangarCapacity", _("Fleet hangar")), - ("shipMaintenanceBayCapacity", _("Maintenance bay")), - ("specialAmmoHoldCapacity", _("Ammo hold")), - ("specialFuelBayCapacity", _("Fuel bay")), - ("specialShipHoldCapacity", _("Ship hold")), - ("specialSmallShipHoldCapacity", _("Small ship hold")), - ("specialMediumShipHoldCapacity", _("Medium ship hold")), - ("specialLargeShipHoldCapacity", _("Large ship hold")), - ("specialIndustrialShipHoldCapacity", _("Industrial ship hold")), - ("specialOreHoldCapacity", _("Ore hold")), - ("specialMineralHoldCapacity", _("Mineral hold")), - ("specialMaterialBayCapacity", _("Material bay")), - ("specialGasHoldCapacity", _("Gas hold")), - ("specialSalvageHoldCapacity", _("Salvage hold")), - ("specialCommandCenterHoldCapacity", _("Command center hold")), - ("specialPlanetaryCommoditiesHoldCapacity", _("Planetary goods hold")), - ("specialQuafeHoldCapacity", _("Quafe hold")))) + ("fleetHangarCapacity", _t("Fleet hangar")), + ("shipMaintenanceBayCapacity", _t("Maintenance bay")), + ("specialAmmoHoldCapacity", _t("Ammo hold")), + ("specialFuelBayCapacity", _t("Fuel bay")), + ("specialShipHoldCapacity", _t("Ship hold")), + ("specialSmallShipHoldCapacity", _t("Small ship hold")), + ("specialMediumShipHoldCapacity", _t("Medium ship hold")), + ("specialLargeShipHoldCapacity", _t("Large ship hold")), + ("specialIndustrialShipHoldCapacity", _t("Industrial ship hold")), + ("specialOreHoldCapacity", _t("Ore hold")), + ("specialMineralHoldCapacity", _t("Mineral hold")), + ("specialMaterialBayCapacity", _t("Material bay")), + ("specialGasHoldCapacity", _t("Gas hold")), + ("specialSalvageHoldCapacity", _t("Salvage hold")), + ("specialCommandCenterHoldCapacity", _t("Command center hold")), + ("specialPlanetaryCommoditiesHoldCapacity", _t("Planetary goods hold")), + ("specialQuafeHoldCapacity", _t("Quafe hold")))) cargoValues = { "main": lambda: fit.ship.getModifiedItemAttr("capacity"), diff --git a/gui/characterEditor.py b/gui/characterEditor.py index c80feb015..380ffbd8f 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -45,7 +45,7 @@ from service.esi import Esi from service.fit import Fit from service.market import Market -_ = wx.GetTranslation +_t = wx.GetTranslation pyfalog = Logger(__name__) @@ -73,21 +73,21 @@ class CharacterTextValidor(BaseValidator): try: if len(text) == 0: - raise ValueError(_("You must supply a name for the Character!")) + raise ValueError(_t("You must supply a name for the Character!")) elif text in [x.name for x in sChar.getCharacterList()]: - raise ValueError(_("Character name already in use, please choose another.")) + raise ValueError(_t("Character name already in use, please choose another.")) return True except ValueError as e: pyfalog.error(e) - wx.MessageBox("{}".format(e), _("Error")) + wx.MessageBox("{}".format(e), _t("Error")) textCtrl.SetFocus() return False class CharacterEntityEditor(EntityEditor): def __init__(self, parent): - EntityEditor.__init__(self, parent, _("Character")) + EntityEditor.__init__(self, parent, _t("Character")) self.SetEditorValidator(CharacterTextValidor) def getEntitiesFromContext(self): @@ -134,7 +134,7 @@ class CharacterEditor(AuxiliaryFrame): def __init__(self, parent): super().__init__( - parent, id=wx.ID_ANY, title=_("Character Editor"), resizeable=True, pos=wx.DefaultPosition, + parent, id=wx.ID_ANY, title=_t("Character Editor"), resizeable=True, pos=wx.DefaultPosition, size=wx.Size(950, 650) if "wxGTK" in wx.PlatformInfo else wx.Size(850, 600)) i = wx.Icon(BitmapLoader.getBitmap("character_small", "gui")) @@ -157,9 +157,9 @@ class CharacterEditor(AuxiliaryFrame): self.iview = ImplantEditorView(self.viewsNBContainer, self) self.aview = APIView(self.viewsNBContainer) - self.viewsNBContainer.AddPage(self.sview, _("Skills")) - self.viewsNBContainer.AddPage(self.iview, _("Implants")) - self.viewsNBContainer.AddPage(self.aview, _("EVE SSO")) + self.viewsNBContainer.AddPage(self.sview, _t("Skills")) + self.viewsNBContainer.AddPage(self.iview, _t("Implants")) + self.viewsNBContainer.AddPage(self.aview, _t("EVE SSO")) mainSizer.Add(self.viewsNBContainer, 1, wx.EXPAND | wx.ALL, 5) @@ -278,10 +278,10 @@ class CharacterEditor(AuxiliaryFrame): with TextEntryValidatedDialog( parent, CharacterTextValidor, - _("Enter a name for your new Character:"), - _("Save Character As...") + _t("Enter a name for your new Character:"), + _t("Save Character As...") ) as dlg: - dlg.SetValue(_("{} Copy").format(name)) + dlg.SetValue(_t("{} Copy").format(name)) dlg.txtctrl.SetInsertionPointEnd() dlg.CenterOnParent() @@ -323,7 +323,7 @@ class SkillTreeView(wx.Panel): self.clonesChoice.Bind(wx.EVT_CHOICE, self.cloneChanged) self.clonesChoice.SetToolTip( - wx.ToolTip(_("Setting an Alpha clone does not replace the character's skills, but rather caps them to Alpha levels."))) + wx.ToolTip(_t("Setting an Alpha clone does not replace the character's skills, but rather caps them to Alpha levels."))) pmainSizer.Add(hSizer, 0, wx.EXPAND | wx.ALL, 5) @@ -339,8 +339,8 @@ class SkillTreeView(wx.Panel): self.skillBookImageId = self.imageList.Add(wx.Icon(BitmapLoader.getBitmap("skill_small", "gui"))) self.skillBookDirtyImageId = self.imageList.Add(wx.Icon(BitmapLoader.getBitmap("skill_small_red", "gui"))) - tree.AppendColumn(_("Skill")) - tree.AppendColumn(_("Level")) + tree.AppendColumn(_t("Skill")) + tree.AppendColumn(_t("Level")) # tree.SetMainColumn(0) self.root = tree.GetRootItem() @@ -353,7 +353,7 @@ class SkillTreeView(wx.Panel): tree.SetColumnWidth(0, 525) tree.SetColumnWidth(1, 100) - self.secStatusLabel = _("Sec Status: {0:.2f}") + self.secStatusLabel = _t("Sec Status: {0:.2f}") self.btnSecStatus = wx.Button(self, wx.ID_ANY, self.secStatusLabel.format(char.secStatus or 0.0)) self.btnSecStatus.Bind(wx.EVT_BUTTON, self.onSecStatus) @@ -369,8 +369,8 @@ class SkillTreeView(wx.Panel): bSizerButtons.AddStretchSpacer() - importExport = ((_("Import"), wx.ART_FILE_OPEN, _("from")), - (_("Export"), wx.ART_FILE_SAVE_AS, _("to"))) + importExport = ((_t("Import"), wx.ART_FILE_OPEN, _t("from")), + (_t("Export"), wx.ART_FILE_SAVE_AS, _t("to"))) for name, art, direction in importExport: bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) @@ -382,7 +382,7 @@ class SkillTreeView(wx.Panel): btn.Layout() setattr(self, "{}Btn".format(name.lower()), btn) btn.Enable(True) - btn.SetToolTip(_("%s skills %s clipboard") % (name, direction)) + btn.SetToolTip(_t("%s skills %s clipboard") % (name, direction)) bSizerButtons.Add(btn, 0, wx.ALL, 5) btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Skills".format(name.lower()))) @@ -437,9 +437,9 @@ class SkillTreeView(wx.Panel): def importSkills(self, evt): with wx.MessageDialog( - self, (_("Importing skills into this character will set the skill levels as pending. To save the skills " + self, (_t("Importing skills into this character will set the skill levels as pending. To save the skills " "permanently, please click the Save button at the bottom of the window after importing")), - _("Import Skills"), wx.OK + _t("Import Skills"), wx.OK ) as dlg: dlg.ShowModal() @@ -460,7 +460,7 @@ class SkillTreeView(wx.Panel): raise except Exception as e: pyfalog.error(e) - with wx.MessageDialog(self, _("There was an error importing skills, please see log file"), _("Error"), wx.ICON_ERROR) as dlg: + with wx.MessageDialog(self, _t("There was an error importing skills, please see log file"), _t("Error"), wx.ICON_ERROR) as dlg: dlg.ShowModal() finally: @@ -529,7 +529,7 @@ class SkillTreeView(wx.Panel): iconId = self.skillBookDirtyImageId childId = tree.AppendItem(root, name, iconId, data=('skill', id)) - tree.SetItemText(childId, 1, _("Level {}d").format(int(level) if isinstance(level, float) else level)) + tree.SetItemText(childId, 1, _t("Level {}d").format(int(level) if isinstance(level, float) else level)) def populateSkillTree(self, event=None): sChar = Character.getInstance() @@ -588,7 +588,7 @@ class SkillTreeView(wx.Panel): childId = tree.AppendItem(root, name, iconId, data=('skill', id)) - tree.SetItemText(childId, 1, _("Level {}").format(int(level) if isinstance(level, float) else level)) + tree.SetItemText(childId, 1, _t("Level {}").format(int(level) if isinstance(level, float) else level)) def spawnMenu(self, event): item = event.GetItem() @@ -611,9 +611,9 @@ class SkillTreeView(wx.Panel): char = self.charEditor.entityEditor.getActiveEntity() if char.name not in ("All 0", "All 5"): menu.AppendSeparator() - menu.Append(self.idUnlearned, _("Unlearn")) + menu.Append(self.idUnlearned, _t("Unlearn")) for level in range(6): - menu.Append(self.idLevels[level], _("Level {}").format(level)) + menu.Append(self.idLevels[level], _t("Level {}").format(level)) menu.Bind(wx.EVT_MENU, self.changeLevel) self.PopupMenu(menu) @@ -754,8 +754,8 @@ class APIView(wx.Panel): hintSizer = wx.BoxSizer(wx.HORIZONTAL) hintSizer.AddStretchSpacer() self.stDisabledTip = wx.StaticText(self, wx.ID_ANY, - _("You cannot link All 0 or All 5 characters to an EVE character.") + "\n" + - _("Please select another character or make a new one."), style=wx.ALIGN_CENTER) + _t("You cannot link All 0 or All 5 characters to an EVE character.") + "\n" + + _t("Please select another character or make a new one."), style=wx.ALIGN_CENTER) self.stDisabledTip.Wrap(-1) hintSizer.Add(self.stDisabledTip, 0, wx.TOP | wx.BOTTOM, 10) @@ -768,14 +768,14 @@ class APIView(wx.Panel): fgSizerInput.SetFlexibleDirection(wx.BOTH) fgSizerInput.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) - self.m_staticCharText = wx.StaticText(self, wx.ID_ANY, _("Character:"), wx.DefaultPosition, wx.DefaultSize, 0) + self.m_staticCharText = wx.StaticText(self, wx.ID_ANY, _t("Character:"), wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticCharText.Wrap(-1) fgSizerInput.Add(self.m_staticCharText, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 10) self.charChoice = wx.Choice(self, wx.ID_ANY, style=0) fgSizerInput.Add(self.charChoice, 1, wx.TOP | wx.BOTTOM | wx.EXPAND, 10) - self.fetchButton = wx.Button(self, wx.ID_ANY, _("Get Skills"), wx.DefaultPosition, wx.DefaultSize, 0) + self.fetchButton = wx.Button(self, wx.ID_ANY, _t("Get Skills"), wx.DefaultPosition, wx.DefaultSize, 0) self.fetchButton.Bind(wx.EVT_BUTTON, self.fetchSkills) fgSizerInput.Add(self.fetchButton, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 10) @@ -786,12 +786,12 @@ class APIView(wx.Panel): self.m_staticline1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) pmainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.ALL, 10) - self.noCharactersTip = wx.StaticText(self, wx.ID_ANY, _("Don't see your EVE character in the list?"), style=wx.ALIGN_CENTER) + self.noCharactersTip = wx.StaticText(self, wx.ID_ANY, _t("Don't see your EVE character in the list?"), style=wx.ALIGN_CENTER) self.noCharactersTip.Wrap(-1) pmainSizer.Add(self.noCharactersTip, 0, wx.CENTER | wx.TOP | wx.BOTTOM, 0) - self.addButton = wx.Button(self, wx.ID_ANY, _("Log In with EVE SSO"), wx.DefaultPosition, wx.DefaultSize, 0) + self.addButton = wx.Button(self, wx.ID_ANY, _t("Log In with EVE SSO"), wx.DefaultPosition, wx.DefaultSize, 0) self.addButton.Bind(wx.EVT_BUTTON, self.addCharacter) pmainSizer.Add(self.addButton, 0, wx.ALL | wx.ALIGN_CENTER, 10) @@ -852,7 +852,7 @@ class APIView(wx.Panel): self.charChoice.Clear() - noneID = self.charChoice.Append(_("None"), None) + noneID = self.charChoice.Append(_t("None"), None) for char in ssoChars: currId = self.charChoice.Append(char.characterName, char.ID) @@ -894,25 +894,25 @@ class APIView(wx.Panel): pyfalog.warn(exc_value) wx.MessageBox( - _("Error fetching skill information"), - _("Error"), wx.ICON_ERROR | wx.STAY_ON_TOP) + _t("Error fetching skill information"), + _t("Error"), wx.ICON_ERROR | wx.STAY_ON_TOP) else: wx.MessageBox( - _("Successfully fetched skills"), _("Success"), wx.ICON_INFORMATION | wx.STAY_ON_TOP) + _t("Successfully fetched skills"), _t("Success"), wx.ICON_INFORMATION | wx.STAY_ON_TOP) class SecStatusDialog(wx.Dialog): def __init__(self, parent, sec): - super().__init__(parent, title=_("Set Security Status"), size=(300, 175), style=wx.DEFAULT_DIALOG_STYLE) + super().__init__(parent, title=_t("Set Security Status"), size=(300, 175), style=wx.DEFAULT_DIALOG_STYLE) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) bSizer1 = wx.BoxSizer(wx.VERTICAL) self.m_staticText1 = wx.StaticText(self, wx.ID_ANY, - _("Security Status is used in some CONCORD hull calculations"), - wx.DefaultPosition, wx.DefaultSize, 0) + _t("Security Status is used in some CONCORD hull calculations"), + wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText1.Wrap(-1) bSizer1.Add(self.m_staticText1, 1, wx.ALL | wx.EXPAND, 5) diff --git a/gui/characterSelection.py b/gui/characterSelection.py index 20a05108a..d403fa8bf 100644 --- a/gui/characterSelection.py +++ b/gui/characterSelection.py @@ -32,7 +32,7 @@ from gui.utils.clipboard import toClipboard from service.character import Character from service.fit import Fit -_ = wx.GetTranslation +_t = wx.GetTranslation pyfalog = Logger(__name__) @@ -44,7 +44,7 @@ class CharacterSelection(wx.Panel): mainSizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(mainSizer) - mainSizer.Add(wx.StaticText(self, wx.ID_ANY, _("Character: ")), 0, wx.CENTER | wx.RIGHT | wx.LEFT, 3) + mainSizer.Add(wx.StaticText(self, wx.ID_ANY, _t("Character: ")), 0, wx.CENTER | wx.RIGHT | wx.LEFT, 3) # cache current selection to fall back in case we choose to open char editor self.charCache = None @@ -65,7 +65,7 @@ class CharacterSelection(wx.Panel): self.btnRefresh.SetMinSize(size) self.btnRefresh.SetMaxSize(size) - self.btnRefresh.SetToolTip(_("Refresh Skills")) + self.btnRefresh.SetToolTip(_t("Refresh Skills")) self.btnRefresh.Bind(wx.EVT_BUTTON, self.refreshApi) self.btnRefresh.Enable(False) @@ -99,10 +99,10 @@ class CharacterSelection(wx.Panel): menu = wx.Menu() - grantItem = menu.Append(wx.ID_ANY, _("Grant Missing Skills")) + grantItem = menu.Append(wx.ID_ANY, _t("Grant Missing Skills")) self.Bind(wx.EVT_MENU, self.grantMissingSkills, grantItem) - exportItem = menu.Append(wx.ID_ANY, _("Copy Missing Skills")) + exportItem = menu.Append(wx.ID_ANY, _t("Copy Missing Skills")) self.Bind(wx.EVT_MENU, self.exportSkills, exportItem) self.PopupMenu(menu, pos) @@ -147,7 +147,7 @@ class CharacterSelection(wx.Panel): sFit = Fit.getInstance() sFit.changeChar(fitID, charID) - choice.Append("\u2015 " + _("Open Character Editor") + " \u2015", -1) + choice.Append("\u2015 " + _t("Open Character Editor") + " \u2015", -1) self.charCache = self.charChoice.GetCurrentSelection() if event is not None: @@ -170,8 +170,8 @@ class CharacterSelection(wx.Panel): pyfalog.warn(exc_value) wx.MessageBox( - _("Error fetching skill information"), - _("Error"), wx.ICON_ERROR | wx.STAY_ON_TOP) + _t("Error fetching skill information"), + _t("Error"), wx.ICON_ERROR | wx.STAY_ON_TOP) def charChanged(self, event): fitID = self.mainFrame.getActiveFit() @@ -227,7 +227,7 @@ class CharacterSelection(wx.Panel): if activeFitID is None: self.skillReqsStaticBitmap.SetBitmap(self.cleanSkills) - self.skillReqsStaticBitmap.SetToolTip(_("No active fit")) + self.skillReqsStaticBitmap.SetToolTip(_t("No active fit")) else: sCharacter = Character.getInstance() self.reqs = sCharacter.checkRequirements(fit) @@ -235,11 +235,11 @@ class CharacterSelection(wx.Panel): sCharacter.skillReqsDict = {'charname': fit.character.name, 'skills': []} if len(self.reqs) == 0: self.needsSkills = False - tip = _("All skill prerequisites have been met") + tip = _t("All skill prerequisites have been met") self.skillReqsStaticBitmap.SetBitmap(self.greenSkills) else: self.needsSkills = True - tip = _("Skills required:") + "\n" + tip = _t("Skills required:") + "\n" condensed = sFit.serviceFittingOptions["compactSkills"] if condensed: dict_ = self._buildSkillsTooltipCondensed(self.reqs, skillsMap={}) diff --git a/gui/chrome_tabs.py b/gui/chrome_tabs.py index 551ac688e..27b660770 100644 --- a/gui/chrome_tabs.py +++ b/gui/chrome_tabs.py @@ -24,7 +24,7 @@ from gui.bitmap_loader import BitmapLoader from gui.utils import color as color_utils, draw, fonts from service.fit import Fit -_ = wx.GetTranslation +_t = wx.GetTranslation _PageChanging, EVT_NOTEBOOK_PAGE_CHANGING = wx.lib.newevent.NewEvent() _PageChanged, EVT_NOTEBOOK_PAGE_CHANGED = wx.lib.newevent.NewEvent() _PageAdding, EVT_NOTEBOOK_PAGE_ADDING = wx.lib.newevent.NewEvent() diff --git a/gui/esiFittings.py b/gui/esiFittings.py index de35b4be3..7c15e2e52 100644 --- a/gui/esiFittings.py +++ b/gui/esiFittings.py @@ -21,7 +21,7 @@ from service.port.esi import ESIExportException from service.settings import EsiSettings -_ = wx.GetTranslation +_t = wx.GetTranslation pyfalog = Logger(__name__) @@ -29,7 +29,7 @@ class EveFittings(AuxiliaryFrame): def __init__(self, parent): super().__init__( - parent, id=wx.ID_ANY, title=_("Browse EVE Fittings"), pos=wx.DefaultPosition, + parent, id=wx.ID_ANY, title=_t("Browse EVE Fittings"), pos=wx.DefaultPosition, size=wx.Size(750, 450), resizeable=True) self.mainFrame = parent @@ -41,7 +41,7 @@ class EveFittings(AuxiliaryFrame): characterSelectSizer.Add(self.charChoice, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.updateCharList() - self.fetchBtn = wx.Button(self, wx.ID_ANY, _("Fetch Fits"), wx.DefaultPosition, wx.DefaultSize, 5) + self.fetchBtn = wx.Button(self, wx.ID_ANY, _t("Fetch Fits"), wx.DefaultPosition, wx.DefaultSize, 5) characterSelectSizer.Add(self.fetchBtn, 0, wx.ALL, 5) mainSizer.Add(characterSelectSizer, 0, wx.EXPAND, 5) @@ -61,8 +61,8 @@ class EveFittings(AuxiliaryFrame): fitSizer.Add(self.fitView, 1, wx.ALL | wx.EXPAND, 5) btnSizer = wx.BoxSizer(wx.HORIZONTAL) - self.importBtn = wx.Button(self, wx.ID_ANY, _("Import to pyfa"), wx.DefaultPosition, wx.DefaultSize, 5) - self.deleteBtn = wx.Button(self, wx.ID_ANY, _("Delete from EVE"), wx.DefaultPosition, wx.DefaultSize, 5) + self.importBtn = wx.Button(self, wx.ID_ANY, _t("Import to pyfa"), wx.DefaultPosition, wx.DefaultSize, 5) + self.deleteBtn = wx.Button(self, wx.ID_ANY, _t("Delete from EVE"), wx.DefaultPosition, wx.DefaultSize, 5) btnSizer.Add(self.importBtn, 1, wx.ALL, 5) btnSizer.Add(self.deleteBtn, 1, wx.ALL, 5) fitSizer.Add(btnSizer, 0, wx.EXPAND) @@ -108,10 +108,10 @@ class EveFittings(AuxiliaryFrame): def fetchFittings(self, event): sEsi = Esi.getInstance() - waitDialog = wx.BusyInfo(_("Fetching fits, please wait..."), parent=self) + waitDialog = wx.BusyInfo(_t("Fetching fits, please wait..."), parent=self) activeChar = self.getActiveCharacter() if activeChar is None: - msg = _("Need at least one ESI character to fetch") + msg = _t("Need at least one ESI character to fetch") pyfalog.warning(msg) self.statusbar.SetStatusText(msg) return @@ -123,7 +123,7 @@ class EveFittings(AuxiliaryFrame): self.fitTree.populateSkillTree(self.fittings) del waitDialog except requests.exceptions.ConnectionError: - msg = _("Connection error, please check your internet connection") + msg = _t("Connection error, please check your internet connection") pyfalog.error(msg) self.statusbar.SetStatusText(msg) except APIException as ex: @@ -153,8 +153,8 @@ class EveFittings(AuxiliaryFrame): data = json.loads(self.fitTree.fittingsTreeCtrl.GetItemData(selection)) with wx.MessageDialog( - self, _("Do you really want to delete {} ({}) from EVE?").format((data['name'], getItem(data['ship_type_id']).name)), - _("Confirm Delete"), wx.YES | wx.NO | wx.ICON_QUESTION + self, _t("Do you really want to delete {} ({}) from EVE?").format((data['name'], getItem(data['ship_type_id']).name)), + _t("Confirm Delete"), wx.YES | wx.NO | wx.ICON_QUESTION ) as dlg: if dlg.ShowModal() == wx.ID_YES: activeChar = self.getActiveCharacter() @@ -166,7 +166,7 @@ class EveFittings(AuxiliaryFrame): self.fitTree.populateSkillTree(self.fittings) self.fitView.update([]) except requests.exceptions.ConnectionError: - msg = _("Connection error, please check your internet connection") + msg = _t("Connection error, please check your internet connection") pyfalog.error(msg) self.statusbar.SetStatusText(msg) @@ -176,11 +176,11 @@ class ESIServerExceptionHandler: pyfalog.error(ex) with wx.MessageDialog( parentWindow, - _("There was an issue starting up the localized server, try setting " + _t("There was an issue starting up the localized server, try setting " "Login Authentication Method to Manual by going to Preferences -> EVE SS0 -> " "Login Authentication Method. If this doesn't fix the problem please file an " "issue on Github."), - _("Add Character Error"), + _t("Add Character Error"), wx.OK | wx.ICON_ERROR ) as dlg: dlg.ShowModal() @@ -193,9 +193,9 @@ class ESIExceptionHandler: pyfalog.error(ex) with wx.MessageDialog( parentWindow, - _("There was an error validating characters' SSO token. Please try " + _t("There was an error validating characters' SSO token. Please try " "logging into the character again to reset the token."), - _("Invalid Token"), + _t("Invalid Token"), wx.OK | wx.ICON_ERROR ) as dlg: dlg.ShowModal() @@ -208,7 +208,7 @@ class ExportToEve(AuxiliaryFrame): def __init__(self, parent): super().__init__( - parent, id=wx.ID_ANY, title=_("Export fit to EVE"), pos=wx.DefaultPosition, + parent, id=wx.ID_ANY, title=_t("Export fit to EVE"), pos=wx.DefaultPosition, size=wx.Size(400, 140) if "wxGTK" in wx.PlatformInfo else wx.Size(350, 115), resizeable=True) self.mainFrame = parent @@ -221,7 +221,7 @@ class ExportToEve(AuxiliaryFrame): self.updateCharList() self.charChoice.SetSelection(0) - self.exportBtn = wx.Button(self, wx.ID_ANY, _("Export Fit"), wx.DefaultPosition, wx.DefaultSize, 5) + self.exportBtn = wx.Button(self, wx.ID_ANY, _t("Export Fit"), wx.DefaultPosition, wx.DefaultSize, 5) hSizer.Add(self.exportBtn, 0, wx.ALL, 5) mainSizer.Add(hSizer, 0, wx.EXPAND, 5) @@ -278,10 +278,10 @@ class ExportToEve(AuxiliaryFrame): self.statusbar.SetStatusText("", 0) if fitID is None: - self.statusbar.SetStatusText(_("Please select an active fitting in the main window"), 1) + self.statusbar.SetStatusText(_t("Please select an active fitting in the main window"), 1) return - self.statusbar.SetStatusText(_("Sending request and awaiting response"), 1) + self.statusbar.SetStatusText(_t("Sending request and awaiting response"), 1) sEsi = Esi.getInstance() sFit = Fit.getInstance() @@ -291,13 +291,13 @@ class ExportToEve(AuxiliaryFrame): except ESIExportException as e: msg = str(e) if not msg: - msg = _("Failed to generate export data") + msg = _t("Failed to generate export data") pyfalog.warning(msg) self.statusbar.SetStatusText(msg, 1) return activeChar = self.getActiveCharacter() if activeChar is None: - msg = _("Need at least one ESI character to export") + msg = _t("Need at least one ESI character to export") pyfalog.warning(msg) self.statusbar.SetStatusText(msg, 1) return @@ -308,13 +308,13 @@ class ExportToEve(AuxiliaryFrame): self.statusbar.SetStatusText("", 0) self.statusbar.SetStatusText(res.reason, 1) except requests.exceptions.ConnectionError: - msg = _("Connection error, please check your internet connection") + msg = _t("Connection error, please check your internet connection") pyfalog.error(msg) - self.statusbar.SetStatusText(_("ERROR"), 0) + self.statusbar.SetStatusText(_t("ERROR"), 0) self.statusbar.SetStatusText(msg, 1) except ESIExportException as ex: pyfalog.error(ex) - self.statusbar.SetStatusText(_("ERROR"), 0) + self.statusbar.SetStatusText(_t("ERROR"), 0) self.statusbar.SetStatusText("{} - {}".format(res.status_code, res.reason), 1) except APIException as ex: try: @@ -322,7 +322,7 @@ class ExportToEve(AuxiliaryFrame): except (KeyboardInterrupt, SystemExit): raise except Exception as ex: - self.statusbar.SetStatusText(_("ERROR"), 0) + self.statusbar.SetStatusText(_t("ERROR"), 0) self.statusbar.SetStatusText("{} - {}".format(res.status_code, res.reason), 1) pyfalog.error(ex) @@ -331,15 +331,15 @@ class SsoCharacterMgmt(AuxiliaryFrame): def __init__(self, parent): super().__init__( - parent, id=wx.ID_ANY, title=_("SSO Character Management"), pos=wx.DefaultPosition, + parent, id=wx.ID_ANY, title=_t("SSO Character Management"), pos=wx.DefaultPosition, size=wx.Size(550, 250), resizeable=True) self.mainFrame = parent mainSizer = wx.BoxSizer(wx.HORIZONTAL) self.lcCharacters = wx.ListCtrl(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT) - self.lcCharacters.InsertColumn(0, heading=_('Character')) - self.lcCharacters.InsertColumn(1, heading=_('Character ID')) + self.lcCharacters.InsertColumn(0, heading=_t('Character')) + self.lcCharacters.InsertColumn(1, heading=_t('Character ID')) self.popCharList() @@ -347,10 +347,10 @@ class SsoCharacterMgmt(AuxiliaryFrame): btnSizer = wx.BoxSizer(wx.VERTICAL) - self.addBtn = wx.Button(self, wx.ID_ANY, _("Add Character"), wx.DefaultPosition, wx.DefaultSize, 0) + self.addBtn = wx.Button(self, wx.ID_ANY, _t("Add Character"), wx.DefaultPosition, wx.DefaultSize, 0) btnSizer.Add(self.addBtn, 0, wx.ALL | wx.EXPAND, 5) - self.deleteBtn = wx.Button(self, wx.ID_ANY, _("Remove Character"), wx.DefaultPosition, wx.DefaultSize, 0) + self.deleteBtn = wx.Button(self, wx.ID_ANY, _t("Remove Character"), wx.DefaultPosition, wx.DefaultSize, 0) btnSizer.Add(self.deleteBtn, 0, wx.ALL | wx.EXPAND, 5) mainSizer.Add(btnSizer, 0, wx.EXPAND, 5) diff --git a/gui/fitBrowserLite.py b/gui/fitBrowserLite.py index 06b188e0e..db3574082 100644 --- a/gui/fitBrowserLite.py +++ b/gui/fitBrowserLite.py @@ -6,7 +6,7 @@ import wx import gui.display as d from service.fit import Fit -_ = wx.GetTranslation +_t = wx.GetTranslation def fitSorter(fit): return fit.shipName, fit.name @@ -14,7 +14,7 @@ def fitSorter(fit): class FitBrowserLiteDialog(wx.Dialog): - def __init__(self, parent, title=_('Add Fits'), excludedFitIDs=()): + def __init__(self, parent, title=_t('Add Fits'), excludedFitIDs=()): super().__init__(parent, title=title, style=wx.DEFAULT_DIALOG_STYLE) listWidth = 250 if 'wxGTK' in wx.PlatformInfo else 200 diff --git a/gui/itemStats.py b/gui/itemStats.py index 10f097977..88d84f2c6 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -37,7 +37,7 @@ from gui.builtinItemStatsViews.itemRequirements import ItemRequirements from gui.builtinItemStatsViews.itemTraits import ItemTraits from service.market import Market -_ = wx.GetTranslation +_t = wx.GetTranslation class ItemStatsFrame(AuxiliaryFrame): @@ -55,7 +55,7 @@ class ItemStatsFrame(AuxiliaryFrame): super().__init__( parent=gui.mainFrame.MainFrame.getInstance(), id=wx.ID_ANY, - title=_("Item stats"), + title=_t("Item stats"), pos=pos, size=size, resizeable=True) @@ -84,7 +84,7 @@ class ItemStatsFrame(AuxiliaryFrame): itemImg = BitmapLoader.getBitmap(item.iconID, "icons") if itemImg is not None: self.SetIcon(wx.Icon(itemImg)) - self.SetTitle(_("{context}Stats: {name}{debug_info}").format( + self.SetTitle(_t("{context}Stats: {name}{debug_info}").format( context = "{} ".format(itmContext) if itmContext is not None else "", name = item.name, debug_info = " ({item_id})".format(item_id = item.ID) if config.debug else "")) @@ -163,37 +163,37 @@ class ItemStatsContainer(wx.Panel): if item.traits is not None: self.traits = ItemTraits(self.nbContainer, stuff, item) - self.nbContainer.AddPage(self.traits, _("Traits")) + self.nbContainer.AddPage(self.traits, _t("Traits")) if isinstance(stuff, Module) and stuff.isMutated: self.mutator = ItemMutatorPanel(self.nbContainer, stuff) - self.nbContainer.AddPage(self.mutator, _("Mutations")) + self.nbContainer.AddPage(self.mutator, _t("Mutations")) if item.description: self.desc = ItemDescription(self.nbContainer, stuff, item) - self.nbContainer.AddPage(self.desc, _("Description")) + self.nbContainer.AddPage(self.desc, _t("Description")) self.params = ItemParams(self.nbContainer, stuff, item, context) - self.nbContainer.AddPage(self.params, _("Attributes")) + self.nbContainer.AddPage(self.params, _t("Attributes")) items = sMkt.getVariationsByItems([item]) if len(items) > 1: self.compare = ItemCompare(self.nbContainer, stuff, item, items, context) - self.nbContainer.AddPage(self.compare, _("Compare")) + self.nbContainer.AddPage(self.compare, _t("Compare")) self.reqs = ItemRequirements(self.nbContainer, stuff, item) - self.nbContainer.AddPage(self.reqs, _("Requirements")) + self.nbContainer.AddPage(self.reqs, _t("Requirements")) if context == "Skill": self.dependents = ItemDependents(self.nbContainer, stuff, item) - self.nbContainer.AddPage(self.dependents, _("Dependents")) + self.nbContainer.AddPage(self.dependents, _t("Dependents")) self.effects = ItemEffects(self.nbContainer, stuff, item) - self.nbContainer.AddPage(self.effects, _("Effects")) + self.nbContainer.AddPage(self.effects, _t("Effects")) if stuff is not None: self.affectedby = ItemAffectedBy(self.nbContainer, stuff, item) - self.nbContainer.AddPage(self.affectedby, _("Affected by")) + self.nbContainer.AddPage(self.affectedby, _t("Affected by")) if config.debug: self.properties = ItemProperties(self.nbContainer, stuff, item, context) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index d50ca6d55..d67807b21 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -69,7 +69,7 @@ from service.price import Price from service.settings import HTMLExportSettings, SettingsProvider from service.update import Update -_ = wx.GetTranslation +_t = wx.GetTranslation pyfalog = Logger(__name__) @@ -179,11 +179,11 @@ class MainFrame(wx.Frame): shipBrowserImg = BitmapLoader.getImage("ship_small", "gui") self.marketBrowser = MarketBrowser(self.notebookBrowsers) - self.notebookBrowsers.AddPage(self.marketBrowser, _("Market"), image=marketImg, closeable=False) + self.notebookBrowsers.AddPage(self.marketBrowser, _t("Market"), image=marketImg, closeable=False) self.marketBrowser.splitter.SetSashPosition(self.marketHeight) self.shipBrowser = ShipBrowser(self.notebookBrowsers) - self.notebookBrowsers.AddPage(self.shipBrowser, _("Fittings"), image=shipBrowserImg, closeable=False) + self.notebookBrowsers.AddPage(self.shipBrowser, _t("Fittings"), image=shipBrowserImg, closeable=False) self.notebookBrowsers.SetSelection(1) @@ -270,7 +270,7 @@ class MainFrame(wx.Frame): self.fitMultiSwitch.AddPage() return - self.waitDialog = wx.BusyInfo(_("Loading previous fits..."), parent=self) + self.waitDialog = wx.BusyInfo(_t("Loading previous fits..."), parent=self) OpenFitsThread(fits, self.closeWaitDialog) def _getDisplayData(self): @@ -463,8 +463,8 @@ class MainFrame(wx.Frame): defaultFile = "%s - %s.xml" % (fit.ship.item.name, fit.name) if fit else None with wx.FileDialog( - self, _("Save Fitting As..."), - wildcard=_("EVE XML fitting files (*.xml)|*.xml"), + self, _t("Save Fitting As..."), + wildcard=_t("EVE XML fitting files (*.xml)|*.xml"), style=wx.FD_SAVE, defaultFile=defaultFile ) as dlg: @@ -643,15 +643,15 @@ class MainFrame(wx.Frame): if not fit.ignoreRestrictions: with wx.MessageDialog( - self, _("Are you sure you wish to ignore fitting restrictions for the " + self, _t("Are you sure you wish to ignore fitting restrictions for the " "current fit? This could lead to wildly inaccurate results and possible errors."), - _("Confirm"), wx.YES_NO | wx.ICON_QUESTION + _t("Confirm"), wx.YES_NO | wx.ICON_QUESTION ) as dlg: result = dlg.ShowModal() == wx.ID_YES else: with wx.MessageDialog( - self, _("Re-enabling fitting restrictions for this fit will also remove any illegal items " - "from the fit. Do you want to continue?"), _("Confirm"), wx.YES_NO | wx.ICON_QUESTION + self, _t("Re-enabling fitting restrictions for this fit will also remove any illegal items " + "from the fit. Do you want to continue?"), _t("Confirm"), wx.YES_NO | wx.ICON_QUESTION ) as dlg: result = dlg.ShowModal() == wx.ID_YES if result: @@ -669,7 +669,7 @@ class MainFrame(wx.Frame): menu = self.GetMenuBar() sEsi = Esi.getInstance() - menu.SetLabel(menu.ssoLoginId, _("Manage Characters")) + menu.SetLabel(menu.ssoLoginId, _t("Manage Characters")) enable = len(sEsi.getSsoCharacters()) == 0 menu.Enable(menu.eveFittingsId, not enable) menu.Enable(menu.exportToEveId, not enable) @@ -686,7 +686,7 @@ class MainFrame(wx.Frame): wx.PostEvent(self, GE.FitChanged(fitIDs=changedFitIDs)) menu = self.GetMenuBar() menu.SetLabel(menu.toggleOverridesId, - _("&Turn Overrides Off") if ModifiedAttributeDict.overrides_enabled else _("&Turn Overrides On")) + _t("&Turn Overrides Off") if ModifiedAttributeDict.overrides_enabled else _t("&Turn Overrides On")) def saveChar(self, event): sChr = Character.getInstance() @@ -719,7 +719,7 @@ class MainFrame(wx.Frame): fitItems = {i for i in Fit.fitItemIter(fit, forceFitImplants=True) if i is not fit.ship.item} self.disablerAll = wx.WindowDisabler() - self.waitDialog = wx.BusyInfo(_("Please Wait..."), parent=self) + self.waitDialog = wx.BusyInfo(_t("Please Wait..."), parent=self) Price.getInstance().findCheaperReplacements(fitItems, updateFitCb, fetchTimeout=10) def AdditionsTabSelect(self, event): @@ -803,11 +803,11 @@ class MainFrame(wx.Frame): sCharacter = Character.getInstance() with wx.FileDialog( self, - _("Export Skills Needed As..."), + _t("Export Skills Needed As..."), wildcard=("|".join([ - _("EVEMon skills training file") + " (*.emp)|*.emp", - _("EVEMon skills training XML file") +" (*.xml)|*.xml", - _("Text skills training file") + " (*.txt)|*.txt" + _t("EVEMon skills training file") + " (*.emp)|*.emp", + _t("EVEMon skills training XML file") + " (*.xml)|*.xml", + _t("Text skills training file") + " (*.txt)|*.txt" ])), style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT, ) as dlg: @@ -825,24 +825,24 @@ class MainFrame(wx.Frame): if '.' not in os.path.basename(filePath): filePath += ".{0}".format(saveFmt) - self.waitDialog = wx.BusyInfo(_("Exporting skills needed..."), parent=self) + self.waitDialog = wx.BusyInfo(_t("Exporting skills needed..."), parent=self) sCharacter.backupSkills(filePath, saveFmt, self.getActiveFit(), self.closeWaitDialog) def fileImportDialog(self, event): """Handles importing single/multiple EVE XML / EFT cfg fit files""" with wx.FileDialog( self, - _("Open One Or More Fitting Files"), + _t("Open One Or More Fitting Files"), wildcard=("|".join([ - _("EVE XML fitting files") + " (*.xml)|*.xml", - _("EFT text fitting files") + " (*.cfg)|*.cfg", - _("All Files") + "|*" + _t("EVE XML fitting files") + " (*.xml)|*.xml", + _t("EFT text fitting files") + " (*.cfg)|*.cfg", + _t("All Files") + "|*" ])), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE ) as dlg: if dlg.ShowModal() == wx.ID_OK: self.progressDialog = wx.ProgressDialog( - _("Importing fits"), + _t("Importing fits"), " " * 100, # set some arbitrary spacing to create width in window parent=self, style=wx.PD_CAN_ABORT | wx.PD_SMOOTH | wx.PD_ELAPSED_TIME | wx.PD_APP_MODAL @@ -856,8 +856,8 @@ class MainFrame(wx.Frame): with wx.FileDialog( self, - _("Save Backup As..."), - wildcard=_("EVE XML fitting file")+" (*.xml)|*.xml", + _t("Save Backup As..."), + wildcard=_t("EVE XML fitting file") + " (*.xml)|*.xml", style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT, defaultFile=defaultFile, ) as dlg: @@ -870,8 +870,8 @@ class MainFrame(wx.Frame): max_ = sFit.countAllFits() self.progressDialog = wx.ProgressDialog( - _("Backup fits"), - _("Backing up {} fits to: {}").format(max_, filePath), + _t("Backup fits"), + _t("Backing up {} fits to: {}").format(max_, filePath), maximum=max_, parent=self, style=wx.PD_CAN_ABORT | wx.PD_SMOOTH | wx.PD_ELAPSED_TIME | wx.PD_APP_MODAL @@ -890,19 +890,19 @@ class MainFrame(wx.Frame): if not os.path.isdir(os.path.dirname(path)): with wx.MessageDialog( self, - _("Invalid Path") + "\n\n" + - _("The following path is invalid or does not exist:") + + _t("Invalid Path") + "\n\n" + + _t("The following path is invalid or does not exist:") + f"\n{path}\n\n" + - _("Please verify path location pyfa's preferences."), - _("Error"), + _t("Please verify path location pyfa's preferences."), + _t("Error"), wx.OK | wx.ICON_ERROR ) as dlg: if dlg.ShowModal() == wx.ID_OK: return self.progressDialog = wx.ProgressDialog( - _("Backup fits"), - _("Generating HTML file at: {}").format(path), + _t("Backup fits"), + _t("Generating HTML file at: {}").format(path), maximum=max_, parent=self, style=wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME) @@ -944,12 +944,12 @@ class MainFrame(wx.Frame): _message = None if action & IPortUser.ID_ERROR: self.closeProgressDialog() - _message = _("Import Error") if action & IPortUser.PROCESS_IMPORT else _("Export Error") + _message = _t("Import Error") if action & IPortUser.PROCESS_IMPORT else _t("Export Error") with wx.MessageDialog( self, - _("The following error was generated") + + _t("The following error was generated") + f"\n\n{data}\n\n" + - _("Be aware that already processed fits were not saved"), + _t("Be aware that already processed fits were not saved"), _message, wx.OK | wx.ICON_ERROR ) as dlg: dlg.ShowModal() @@ -1008,16 +1008,16 @@ class MainFrame(wx.Frame): """ Imports character XML file from EVE API """ with wx.FileDialog( self, - _("Open One Or More Character Files"), + _t("Open One Or More Character Files"), wildcard="|".join([ - _("EVE API XML character files") + " (*.xml)|*.xml", - _("All Files") + "|*" + _t("EVE API XML character files") + " (*.xml)|*.xml", + _t("All Files") + "|*" ]), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE ) as dlg: if dlg.ShowModal() == wx.ID_OK: self.supress_left_up = True - self.waitDialog = wx.BusyInfo(_("Importing Character..."), parent=self) + self.waitDialog = wx.BusyInfo(_t("Importing Character..."), parent=self) sCharacter = Character.getInstance() sCharacter.importCharacter(dlg.GetPaths(), self.importCharacterCallback) diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index bc236953f..ef677575d 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -31,7 +31,7 @@ from logbook import Logger pyfalog = Logger(__name__) -_ = wx.GetTranslation +_t = wx.GetTranslation class MainMenuBar(wx.MenuBar): def __init__(self, mainFrame): pyfalog.debug("Initialize MainMenuBar") @@ -63,108 +63,108 @@ class MainMenuBar(wx.MenuBar): # File menu fileMenu = wx.Menu() - self.Append(fileMenu, _("&File")) + self.Append(fileMenu, _t("&File")) - fileMenu.Append(self.mainFrame.addPageId, _("&New Tab") + "\tCTRL+T", "Open a new fitting tab") - fileMenu.Append(self.mainFrame.closePageId, _("&Close Tab")+"\tCTRL+W", "Close the current fit") - fileMenu.Append(self.mainFrame.closeAllPagesId, _("&Close All Tabs") + "\tCTRL+ALT+W", "Close all open fits") + fileMenu.Append(self.mainFrame.addPageId, _t("&New Tab") + "\tCTRL+T", "Open a new fitting tab") + fileMenu.Append(self.mainFrame.closePageId, _t("&Close Tab") + "\tCTRL+W", "Close the current fit") + fileMenu.Append(self.mainFrame.closeAllPagesId, _t("&Close All Tabs") + "\tCTRL+ALT+W", "Close all open fits") fileMenu.AppendSeparator() - fileMenu.Append(self.backupFitsId, _("&Backup All Fittings"), _("Backup all fittings to a XML file")) - fileMenu.Append(self.exportHtmlId, _("Export All Fittings to &HTML"), _("Export fits to HTML file (set in Preferences)")) + fileMenu.Append(self.backupFitsId, _t("&Backup All Fittings"), _t("Backup all fittings to a XML file")) + fileMenu.Append(self.exportHtmlId, _t("Export All Fittings to &HTML"), _t("Export fits to HTML file (set in Preferences)")) fileMenu.AppendSeparator() fileMenu.Append(wx.ID_EXIT) # Fit menu fitMenu = wx.Menu() - self.Append(fitMenu, _("Fi&t")) + self.Append(fitMenu, _t("Fi&t")) - fitMenu.Append(wx.ID_UNDO, _("&Undo")+"\tCTRL+Z", _("Undo the most recent action")) - fitMenu.Append(wx.ID_REDO, _("&Redo")+"\tCTRL+Y", _("Redo the most recent undone action")) + fitMenu.Append(wx.ID_UNDO, _t("&Undo") + "\tCTRL+Z", _t("Undo the most recent action")) + fitMenu.Append(wx.ID_REDO, _t("&Redo") + "\tCTRL+Y", _t("Redo the most recent undone action")) fitMenu.AppendSeparator() - fitMenu.Append(wx.ID_COPY, _("&To Clipboard")+"\tCTRL+C", _("Export a fit to the clipboard")) - fitMenu.Append(wx.ID_PASTE, _("&From Clipboard")+"\tCTRL+V", _("Import a fit from the clipboard")) + fitMenu.Append(wx.ID_COPY, _t("&To Clipboard") + "\tCTRL+C", _t("Export a fit to the clipboard")) + fitMenu.Append(wx.ID_PASTE, _t("&From Clipboard") + "\tCTRL+V", _t("Import a fit from the clipboard")) fitMenu.AppendSeparator() - fitMenu.Append(wx.ID_OPEN, _("&Import Fittings")+"\tCTRL+O", _("Import fittings into pyfa")) - fitMenu.Append(wx.ID_SAVEAS, _("&Export Fitting")+"\tCTRL+S", _("Export fitting to another format")) + fitMenu.Append(wx.ID_OPEN, _t("&Import Fittings") + "\tCTRL+O", _t("Import fittings into pyfa")) + fitMenu.Append(wx.ID_SAVEAS, _t("&Export Fitting") + "\tCTRL+S", _t("Export fitting to another format")) fitMenu.AppendSeparator() - fitMenu.Append(self.optimizeFitPrice, _("&Optimize Fit Price")+"\tCTRL+D") - graphFrameItem = wx.MenuItem(fitMenu, self.graphFrameId, _("&Graphs")+"\tCTRL+G") + fitMenu.Append(self.optimizeFitPrice, _t("&Optimize Fit Price") + "\tCTRL+D") + graphFrameItem = wx.MenuItem(fitMenu, self.graphFrameId, _t("&Graphs") + "\tCTRL+G") graphFrameItem.SetBitmap(BitmapLoader.getBitmap("graphs_small", "gui")) fitMenu.Append(graphFrameItem) if not graphs.graphFrame_enabled: self.Enable(self.graphFrameId, False) - self.ignoreRestrictionItem = fitMenu.Append(self.toggleIgnoreRestrictionID, _("Disable Fitting Re&strictions")) + self.ignoreRestrictionItem = fitMenu.Append(self.toggleIgnoreRestrictionID, _t("Disable Fitting Re&strictions")) fitMenu.AppendSeparator() - fitMenu.Append(self.eveFittingsId, _("&Browse ESI Fittings")+"\tCTRL+B") - fitMenu.Append(self.exportToEveId, _("E&xport to ESI")+"\tCTRL+E") + fitMenu.Append(self.eveFittingsId, _t("&Browse ESI Fittings") + "\tCTRL+B") + fitMenu.Append(self.exportToEveId, _t("E&xport to ESI") + "\tCTRL+E") self.Enable(self.eveFittingsId, True) self.Enable(self.exportToEveId, True) # Character menu characterMenu = wx.Menu() - self.Append(characterMenu, _("&Character")) + self.Append(characterMenu, _t("&Character")) - characterMenu.Append(self.saveCharId, _("&Save Character")) - characterMenu.Append(self.saveCharAsId, _("Save Character &As...")) - characterMenu.Append(self.revertCharId, _("&Revert Character")) + characterMenu.Append(self.saveCharId, _t("&Save Character")) + characterMenu.Append(self.saveCharAsId, _t("Save Character &As...")) + characterMenu.Append(self.revertCharId, _t("&Revert Character")) characterMenu.AppendSeparator() - characterMenu.Append(self.importCharacterId, _("&Import Character File"), _("Import characters into pyfa from file")) - characterMenu.Append(self.exportSkillsNeededId, _("&Export Skills Needed"), _("Export skills needed for this fitting")) + characterMenu.Append(self.importCharacterId, _t("&Import Character File"), _t("Import characters into pyfa from file")) + characterMenu.Append(self.exportSkillsNeededId, _t("&Export Skills Needed"), _t("Export skills needed for this fitting")) characterMenu.AppendSeparator() - characterMenu.Append(self.ssoLoginId, _("&Manage ESI Characters")) + characterMenu.Append(self.ssoLoginId, _t("&Manage ESI Characters")) # Global Menu globalMenu = wx.Menu() if not self.mainFrame.disableOverrideEditor: - attrItem = wx.MenuItem(globalMenu, self.attrEditorId, _("Attribute &Overrides")) + attrItem = wx.MenuItem(globalMenu, self.attrEditorId, _t("Attribute &Overrides")) attrItem.SetBitmap(BitmapLoader.getBitmap("fit_rename_small", "gui")) globalMenu.Append(attrItem) - globalMenu.Append(self.toggleOverridesId, _("&Turn Overrides On")) + globalMenu.Append(self.toggleOverridesId, _t("&Turn Overrides On")) globalMenu.AppendSeparator() - self.Append(globalMenu, _("&Global")) + self.Append(globalMenu, _t("&Global")) preferencesShortCut = "CTRL+," if 'wxMac' in wx.PlatformInfo else "CTRL+P" - preferencesItem = wx.MenuItem(globalMenu, wx.ID_PREFERENCES, _("&Preferences")+"\t" + preferencesShortCut) + preferencesItem = wx.MenuItem(globalMenu, wx.ID_PREFERENCES, _t("&Preferences") + "\t" + preferencesShortCut) preferencesItem.SetBitmap(BitmapLoader.getBitmap("preferences_small", "gui")) globalMenu.Append(preferencesItem) # Editors menu editorsMenu = wx.Menu() - self.Append(editorsMenu, _("&Editors")) - charEditItem = wx.MenuItem(editorsMenu, self.characterEditorId, _("&Character Editor")+"\tCTRL+K") + self.Append(editorsMenu, _t("&Editors")) + charEditItem = wx.MenuItem(editorsMenu, self.characterEditorId, _t("&Character Editor") + "\tCTRL+K") charEditItem.SetBitmap(BitmapLoader.getBitmap("character_small", "gui")) editorsMenu.Append(charEditItem) - implantSetEditItem = wx.MenuItem(editorsMenu, self.implantSetEditorId, _("&Implant Set Editor")+"\tCTRL+I") + implantSetEditItem = wx.MenuItem(editorsMenu, self.implantSetEditorId, _t("&Implant Set Editor") + "\tCTRL+I") implantSetEditItem.SetBitmap(BitmapLoader.getBitmap("hardwire_small", "gui")) editorsMenu.Append(implantSetEditItem) - damagePatternEditItem = wx.MenuItem(editorsMenu, self.damagePatternEditorId, _("&Damage Pattern Editor")) + damagePatternEditItem = wx.MenuItem(editorsMenu, self.damagePatternEditorId, _t("&Damage Pattern Editor")) damagePatternEditItem.SetBitmap(BitmapLoader.getBitmap("damagePattern_small", "gui")) editorsMenu.Append(damagePatternEditItem) - targetProfileEditItem = wx.MenuItem(editorsMenu, self.targetProfileEditorId, _("&Target Profile Editor")) + targetProfileEditItem = wx.MenuItem(editorsMenu, self.targetProfileEditorId, _t("&Target Profile Editor")) targetProfileEditItem.SetBitmap(BitmapLoader.getBitmap("explosive_small", "gui")) editorsMenu.Append(targetProfileEditItem) # Help menu helpMenu = wx.Menu() - self.Append(helpMenu, _("&Help")) - helpMenu.Append(self.wikiId, _("&Wiki"), _("Go to wiki on GitHub")) - helpMenu.Append(self.forumId, _("&Forums"), _("Go to EVE Online Forum thread")) + self.Append(helpMenu, _t("&Help")) + helpMenu.Append(self.wikiId, _t("&Wiki"), _t("Go to wiki on GitHub")) + helpMenu.Append(self.forumId, _t("&Forums"), _t("Go to EVE Online Forum thread")) helpMenu.AppendSeparator() helpMenu.Append(wx.ID_ABOUT) if config.debug: - helpMenu.Append(self.mainFrame.widgetInspectMenuID, _("Open Wid&gets Inspect tool"), _("Open Widgets Inspect tool")) - helpMenu.Append(self.devToolsId, _("Open &Dev Tools"), _("Dev Tools")) + helpMenu.Append(self.mainFrame.widgetInspectMenuID, _t("Open Wid&gets Inspect tool"), _t("Open Widgets Inspect tool")) + helpMenu.Append(self.devToolsId, _t("Open &Dev Tools"), _t("Dev Tools")) self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged) self.mainFrame.Bind(GE.FIT_RENAMED, self.fitRenamed) @@ -197,9 +197,9 @@ class MainMenuBar(wx.MenuBar): fit = sFit.getFit(activeFitID) if fit.ignoreRestrictions: - self.ignoreRestrictionItem.SetItemLabel(_("Enable Fitting Re&strictions")) + self.ignoreRestrictionItem.SetItemLabel(_t("Enable Fitting Re&strictions")) else: - self.ignoreRestrictionItem.SetItemLabel(_("Disable Fitting Re&strictions")) + self.ignoreRestrictionItem.SetItemLabel(_t("Disable Fitting Re&strictions")) def fitRenamed(self, event): self.refreshUndo() diff --git a/gui/multiSwitch.py b/gui/multiSwitch.py index 8a975d2b9..0705f9048 100644 --- a/gui/multiSwitch.py +++ b/gui/multiSwitch.py @@ -21,7 +21,7 @@ from gui.chrome_tabs import ChromeNotebook import gui.builtinViews.emptyView import wx -_ = wx.GetTranslation +_t = wx.GetTranslation class MultiSwitch(ChromeNotebook): def __init__(self, parent): @@ -38,7 +38,7 @@ class MultiSwitch(ChromeNotebook): h(type, info) def AddPage(self, tabWnd=None, tabTitle=None, tabImage=None): - tabTitle = tabTitle or _("Empty Tab") + tabTitle = tabTitle or _t("Empty Tab") if tabWnd is None: tabWnd = gui.builtinViews.emptyView.BlankPage(self) tabWnd.handleDrag = lambda type, info: self.handleDrag(type, info) diff --git a/gui/patternEditor.py b/gui/patternEditor.py index 76fe08028..2e5ca1f94 100644 --- a/gui/patternEditor.py +++ b/gui/patternEditor.py @@ -32,7 +32,7 @@ from service.fit import Fit pyfalog = Logger(__name__) -_ = wx.GetTranslation +_t = wx.GetTranslation class DmgPatternNameValidator(BaseValidator): def __init__(self): @@ -48,21 +48,21 @@ class DmgPatternNameValidator(BaseValidator): try: if len(text) == 0: - raise ValueError(_("You must supply a name for your Damage Profile!")) + raise ValueError(_t("You must supply a name for your Damage Profile!")) elif text in [x.rawName for x in entityEditor.choices]: - raise ValueError(_("Damage Profile name already in use, please choose another.")) + raise ValueError(_t("Damage Profile name already in use, please choose another.")) return True except ValueError as e: pyfalog.error(e) - wx.MessageBox("{}".format(e), _("Error")) + wx.MessageBox("{}".format(e), _t("Error")) textCtrl.SetFocus() return False class DmgPatternEntityEditor(EntityEditor): def __init__(self, parent): - EntityEditor.__init__(self, parent, _("Damage Profile")) + EntityEditor.__init__(self, parent, _t("Damage Profile")) self.SetEditorValidator(DmgPatternNameValidator) def getEntitiesFromContext(self): @@ -96,7 +96,7 @@ class DmgPatternEditor(AuxiliaryFrame): def __init__(self, parent): super().__init__( - parent, id=wx.ID_ANY, title=_("Damage Pattern Editor"), resizeable=True, + parent, id=wx.ID_ANY, title=_t("Damage Pattern Editor"), resizeable=True, # Dropdown list widget is scaled to its longest content line on GTK, adapt to that size=wx.Size(500, 240) if "wxGTK" in wx.PlatformInfo else wx.Size(400, 240)) @@ -168,8 +168,8 @@ class DmgPatternEditor(AuxiliaryFrame): self.SetSizer(mainSizer) - importExport = (("Import", wx.ART_FILE_OPEN, _("from")), - ("Export", wx.ART_FILE_SAVE_AS, _("to"))) + importExport = (("Import", wx.ART_FILE_OPEN, _t("from")), + ("Export", wx.ART_FILE_SAVE_AS, _t("to"))) for name, art, direction in importExport: bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) @@ -181,7 +181,7 @@ class DmgPatternEditor(AuxiliaryFrame): btn.Layout() setattr(self, name, btn) btn.Enable(True) - btn.SetToolTip(_("%s patterns %s clipboard") % (name, direction)) + btn.SetToolTip(_t("%s patterns %s clipboard") % (name, direction)) footerSizer.Add(btn, 0) btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Patterns".format(name.lower()))) @@ -273,26 +273,26 @@ class DmgPatternEditor(AuxiliaryFrame): sDP = DamagePattern.getInstance() try: sDP.importPatterns(text) - self.stNotice.SetLabel(_("Patterns successfully imported from clipboard")) + self.stNotice.SetLabel(_t("Patterns successfully imported from clipboard")) except ImportError as e: pyfalog.error(e) self.stNotice.SetLabel(str(e)) except (KeyboardInterrupt, SystemExit): raise except Exception as e: - msg = _("Could not import from clipboard: unknown errors") + msg = _t("Could not import from clipboard: unknown errors") pyfalog.warning(msg) pyfalog.error(e) self.stNotice.SetLabel(msg) finally: self.entityEditor.refreshEntityList() else: - self.stNotice.SetLabel(_("Could not import from clipboard")) + self.stNotice.SetLabel(_t("Could not import from clipboard")) def exportPatterns(self, event): sDP = DamagePattern.getInstance() toClipboard(sDP.exportPatterns()) - self.stNotice.SetLabel(_("Patterns exported to clipboard")) + self.stNotice.SetLabel(_t("Patterns exported to clipboard")) def kbEvent(self, event): if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: diff --git a/gui/targetProfileEditor.py b/gui/targetProfileEditor.py index 556dd1afe..08c1384c2 100644 --- a/gui/targetProfileEditor.py +++ b/gui/targetProfileEditor.py @@ -38,7 +38,7 @@ from service.targetProfile import TargetProfile pyfalog = Logger(__name__) -_ = wx.GetTranslation +_t = wx.GetTranslation class ResistValidator(InputValidator): @@ -47,9 +47,9 @@ class ResistValidator(InputValidator): return True, '' value = strToFloat(value) if value is None: - return False, _('Incorrect formatting (decimals only)') + return False, _t('Incorrect formatting (decimals only)') if value < 0 or value > 100: - return False, _('Incorrect range (must be 0-100)') + return False, _t('Incorrect range (must be 0-100)') return True, '' @@ -68,14 +68,14 @@ class TargetProfileNameValidator(BaseValidator): try: if len(text) == 0: - raise ValueError(_("You must supply a name for your Target Profile!")) + raise ValueError(_t("You must supply a name for your Target Profile!")) elif text in [x.rawName for x in entityEditor.choices]: - raise ValueError(_("Target Profile name already in use, please choose another.")) + raise ValueError(_t("Target Profile name already in use, please choose another.")) return True except ValueError as e: pyfalog.error(e) - wx.MessageBox("{}".format(e), _("Error")) + wx.MessageBox("{}".format(e), _t("Error")) textCtrl.SetFocus() return False @@ -83,7 +83,7 @@ class TargetProfileNameValidator(BaseValidator): class TargetProfileEntityEditor(EntityEditor): def __init__(self, parent): - EntityEditor.__init__(self, parent=parent, entityName=_("Target Profile")) + EntityEditor.__init__(self, parent=parent, entityName=_t("Target Profile")) self.SetEditorValidator(TargetProfileNameValidator) self.mainFrame = gui.mainFrame.MainFrame.getInstance() @@ -116,18 +116,18 @@ class TargetProfileEntityEditor(EntityEditor): class TargetProfileEditor(AuxiliaryFrame): DAMAGE_TYPES = OrderedDict([ - ("em", _("EM resistance")), - ("thermal", _("Thermal resistance")), - ("kinetic", _("Kinetic resistance")), - ("explosive", _("Explosive resistance"))]) + ("em", _t("EM resistance")), + ("thermal", _t("Thermal resistance")), + ("kinetic", _t("Kinetic resistance")), + ("explosive", _t("Explosive resistance"))]) ATTRIBUTES = OrderedDict([ - ('maxVelocity', (_('Maximum speed'), 'm/s')), - ('signatureRadius', (_('Signature radius\nLeave blank for infinitely big value'), 'm')), - ('radius', (_('Radius'), 'm'))]) + ('maxVelocity', (_t('Maximum speed'), 'm/s')), + ('signatureRadius', (_t('Signature radius\nLeave blank for infinitely big value'), 'm')), + ('radius', (_t('Radius'), 'm'))]) def __init__(self, parent): super().__init__( - parent, id=wx.ID_ANY, title=_("Target Profile Editor"), resizeable=True, + parent, id=wx.ID_ANY, title=_t("Target Profile Editor"), resizeable=True, # Dropdown list widget is scaled to its longest content line on GTK, adapt to that size=wx.Size(500, 240) if "wxGTK" in wx.PlatformInfo else wx.Size(350, 240)) @@ -218,8 +218,8 @@ class TargetProfileEditor(AuxiliaryFrame): self.SetSizer(mainSizer) - importExport = (("Import", wx.ART_FILE_OPEN, _("from")), - ("Export", wx.ART_FILE_SAVE_AS, _("to"))) + importExport = (("Import", wx.ART_FILE_OPEN, _t("from")), + ("Export", wx.ART_FILE_SAVE_AS, _t("to"))) for name, art, direction in importExport: bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) @@ -231,7 +231,7 @@ class TargetProfileEditor(AuxiliaryFrame): btn.Layout() setattr(self, name, btn) btn.Enable(True) - btn.SetToolTip(_("{} profiles {} clipboard").format(name, direction)) + btn.SetToolTip(_t("{} profiles {} clipboard").format(name, direction)) footerSizer.Add(btn, 0) btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Patterns".format(name.lower()))) @@ -349,27 +349,27 @@ class TargetProfileEditor(AuxiliaryFrame): sTR = TargetProfile.getInstance() try: sTR.importPatterns(text) - self.stNotice.SetLabel(_("Profiles successfully imported from clipboard")) + self.stNotice.SetLabel(_t("Profiles successfully imported from clipboard")) except ImportError as e: pyfalog.error(e) self.stNotice.SetLabel(str(e)) except (KeyboardInterrupt, SystemExit): raise except Exception as e: - msg = _("Could not import from clipboard:") + msg = _t("Could not import from clipboard:") pyfalog.warning(msg) pyfalog.error(e) self.stNotice.SetLabel(msg) finally: self.entityEditor.refreshEntityList() else: - self.stNotice.SetLabel(_("Could not import from clipboard")) + self.stNotice.SetLabel(_t("Could not import from clipboard")) def exportPatterns(self, event): """Event fired when export to clipboard button is clicked""" sTR = TargetProfile.getInstance() toClipboard(sTR.exportPatterns()) - self.stNotice.SetLabel(_("Profiles exported to clipboard")) + self.stNotice.SetLabel(_t("Profiles exported to clipboard")) def kbEvent(self, event): if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: