More _t() conversion
This commit is contained in:
@@ -23,7 +23,7 @@ from gui.statsView import StatsView
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount, roundToPrec
|
||||
|
||||
_ = wx.GetTranslation
|
||||
_t = wx.GetTranslation
|
||||
|
||||
|
||||
class CapacitorViewFull(StatsView):
|
||||
@@ -34,7 +34,7 @@ class CapacitorViewFull(StatsView):
|
||||
self.parent = parent
|
||||
|
||||
def getHeaderText(self, fit):
|
||||
return _("Capacitor")
|
||||
return _t("Capacitor")
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent(text)
|
||||
@@ -54,7 +54,7 @@ class CapacitorViewFull(StatsView):
|
||||
|
||||
sizerCapacitor.Add(baseBox, 0, wx.ALIGN_LEFT)
|
||||
bitmap = BitmapLoader.getStaticBitmap("capacitorInfo_big", parent, "gui")
|
||||
tooltip = wx.ToolTip(_("Capacitor stability"))
|
||||
tooltip = wx.ToolTip(_t("Capacitor stability"))
|
||||
bitmap.SetToolTip(tooltip)
|
||||
baseBox.Add(bitmap, 0, wx.ALIGN_CENTER)
|
||||
|
||||
@@ -64,7 +64,7 @@ class CapacitorViewFull(StatsView):
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(hbox, 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox.Add(wx.StaticText(parent, wx.ID_ANY, _("Total: ")), 0, wx.ALIGN_LEFT | wx.LEFT, 3)
|
||||
hbox.Add(wx.StaticText(parent, wx.ID_ANY, _t("Total: ")), 0, wx.ALIGN_LEFT | wx.LEFT, 3)
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
|
||||
setattr(self, "label%sCapacitorCapacity" % panel.capitalize(), lbl)
|
||||
hbox.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
@@ -74,11 +74,11 @@ class CapacitorViewFull(StatsView):
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(hbox, 0, wx.ALIGN_LEFT)
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, _("Lasts "))
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, _t("Lasts "))
|
||||
hbox.Add(lbl, 0, wx.ALIGN_LEFT | wx.LEFT, 3)
|
||||
setattr(self, "label%sCapacitorState" % panel.capitalize(), lbl)
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, _("0s"))
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, _t("0s"))
|
||||
setattr(self, "label%sCapacitorTime" % panel.capitalize(), lbl)
|
||||
hbox.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
@@ -87,7 +87,7 @@ class CapacitorViewFull(StatsView):
|
||||
|
||||
sizerCapacitor.Add(baseBox, 0, wx.ALIGN_CENTER_HORIZONTAL)
|
||||
|
||||
tooltip = wx.ToolTip(_("Extra stats"))
|
||||
tooltip = wx.ToolTip(_t("Extra stats"))
|
||||
bitmap = BitmapLoader.getStaticBitmap("capacitorRecharge_big", parent, "gui")
|
||||
bitmap.SetToolTip(tooltip)
|
||||
baseBox.Add(bitmap, 0, wx.ALIGN_CENTER)
|
||||
@@ -168,7 +168,7 @@ class CapacitorViewFull(StatsView):
|
||||
else:
|
||||
t = "%ds" % capState
|
||||
|
||||
s = _("Stable: ") if capStable else _("Lasts ")
|
||||
s = _t("Stable: ") if capStable else _t("Lasts ")
|
||||
|
||||
getattr(self, lblNameTime % panel).SetLabel(t)
|
||||
getattr(self, lblNameState % panel).SetLabel(s)
|
||||
|
||||
@@ -28,7 +28,7 @@ from gui.statsView import StatsView
|
||||
from gui.utils.numberFormatter import formatAmount, roundToPrec
|
||||
from service.fit import Fit
|
||||
|
||||
_ = wx.GetTranslation
|
||||
_t = wx.GetTranslation
|
||||
|
||||
|
||||
class FirepowerViewFull(StatsView):
|
||||
@@ -40,7 +40,7 @@ class FirepowerViewFull(StatsView):
|
||||
self._cachedValues = []
|
||||
|
||||
def getHeaderText(self, fit):
|
||||
return _("Firepower")
|
||||
return _t("Firepower")
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent(text)
|
||||
@@ -73,7 +73,7 @@ class FirepowerViewFull(StatsView):
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
baseBox.Add(box, 0, wx.ALIGN_CENTER)
|
||||
|
||||
box.Add(wx.StaticText(parent, wx.ID_ANY, _(damageType).capitalize()), 0, wx.ALIGN_LEFT)
|
||||
box.Add(wx.StaticText(parent, wx.ID_ANY, _t(damageType).capitalize()), 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(hbox, 1, wx.ALIGN_CENTER)
|
||||
@@ -97,14 +97,14 @@ class FirepowerViewFull(StatsView):
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
|
||||
setattr(self, "label%sVolleyTotal" % panel.capitalize(), lbl)
|
||||
gridS.Add(wx.StaticText(parent, wx.ID_ANY, _(" Volley: ")), 0, wx.ALL | wx.ALIGN_RIGHT)
|
||||
gridS.Add(wx.StaticText(parent, wx.ID_ANY, _t(" Volley: ")), 0, wx.ALL | wx.ALIGN_RIGHT)
|
||||
gridS.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
self._cachedValues.append(0)
|
||||
|
||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
|
||||
setattr(self, "label%sDpsTotal" % panel.capitalize(), lbl)
|
||||
gridS.Add(wx.StaticText(parent, wx.ID_ANY, _(" DPS: ")), 0, wx.ALL | wx.ALIGN_RIGHT)
|
||||
gridS.Add(wx.StaticText(parent, wx.ID_ANY, _t(" DPS: ")), 0, wx.ALL | wx.ALIGN_RIGHT)
|
||||
|
||||
self._cachedValues.append(0)
|
||||
|
||||
@@ -112,7 +112,7 @@ class FirepowerViewFull(StatsView):
|
||||
|
||||
image = BitmapLoader.getBitmap("mining_small", "gui")
|
||||
self.miningyield = wx.BitmapButton(contentPanel, -1, image)
|
||||
self.miningyield.SetToolTip(wx.ToolTip(_("Click to toggle to Mining Yield ")))
|
||||
self.miningyield.SetToolTip(wx.ToolTip(_t("Click to toggle to Mining Yield ")))
|
||||
self.miningyield.Bind(wx.EVT_BUTTON, self.switchToMiningYieldView)
|
||||
sizerFirepower.Add(self.miningyield, 0, wx.ALIGN_LEFT)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ from gui.bitmap_loader import BitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
from service.fit import Fit
|
||||
|
||||
_ = wx.GetTranslation
|
||||
_t = wx.GetTranslation
|
||||
|
||||
class MiningYieldViewFull(StatsView):
|
||||
name = "miningyieldViewFull"
|
||||
@@ -36,7 +36,7 @@ class MiningYieldViewFull(StatsView):
|
||||
self._cachedValues = []
|
||||
|
||||
def getHeaderText(self, fit):
|
||||
return _("Mining Yield")
|
||||
return _t("Mining Yield")
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent(text)
|
||||
@@ -65,7 +65,7 @@ class MiningYieldViewFull(StatsView):
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
baseBox.Add(box, 0, wx.ALIGN_CENTER)
|
||||
|
||||
box.Add(wx.StaticText(parent, wx.ID_ANY, _(miningType).capitalize()), 0, wx.ALIGN_LEFT)
|
||||
box.Add(wx.StaticText(parent, wx.ID_ANY, _t(miningType).capitalize()), 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(hbox, 1, wx.ALIGN_CENTER)
|
||||
@@ -86,7 +86,7 @@ class MiningYieldViewFull(StatsView):
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
baseBox.Add(box, 0, wx.EXPAND)
|
||||
|
||||
box.Add(wx.StaticText(parent, wx.ID_ANY, _("Total")), 0, wx.ALIGN_LEFT)
|
||||
box.Add(wx.StaticText(parent, wx.ID_ANY, _t("Total")), 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(hbox, 1, wx.EXPAND)
|
||||
@@ -99,7 +99,7 @@ class MiningYieldViewFull(StatsView):
|
||||
|
||||
image = BitmapLoader.getBitmap("turret_small", "gui")
|
||||
firepower = wx.BitmapButton(contentPanel, -1, image)
|
||||
firepower.SetToolTip(wx.ToolTip(_("Click to toggle to Firepower View")))
|
||||
firepower.SetToolTip(wx.ToolTip(_t("Click to toggle to Firepower View")))
|
||||
firepower.Bind(wx.EVT_BUTTON, self.switchToFirepowerView)
|
||||
sizerMiningYield.Add(firepower, 0, wx.ALIGN_LEFT)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ from gui.utils.numberFormatter import formatAmount
|
||||
from service.price import Fit, Price
|
||||
from service.settings import MarketPriceSettings
|
||||
|
||||
_ = wx.GetTranslation
|
||||
_t = wx.GetTranslation
|
||||
|
||||
|
||||
class PriceViewFull(StatsView):
|
||||
@@ -37,7 +37,7 @@ class PriceViewFull(StatsView):
|
||||
self.settings = MarketPriceSettings.getInstance()
|
||||
|
||||
def getHeaderText(self, fit):
|
||||
return _("Price")
|
||||
return _t("Price")
|
||||
|
||||
def populatePanel(self, contentPanel, headerPanel):
|
||||
contentSizer = contentPanel.GetSizer()
|
||||
@@ -69,7 +69,7 @@ class PriceViewFull(StatsView):
|
||||
vbox = wx.BoxSizer(wx.VERTICAL)
|
||||
box.Add(vbox, 1, wx.EXPAND)
|
||||
|
||||
vbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, _(_type).capitalize()), 0, wx.ALIGN_LEFT)
|
||||
vbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, _t(_type).capitalize()), 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
vbox.Add(hbox)
|
||||
|
||||
@@ -25,7 +25,7 @@ from gui.utils.numberFormatter import formatAmount
|
||||
from service.price import Fit, Price
|
||||
from service.settings import MarketPriceSettings
|
||||
|
||||
_ = wx.GetTranslation
|
||||
_t = wx.GetTranslation
|
||||
|
||||
|
||||
class PriceViewMinimal(StatsView):
|
||||
@@ -63,7 +63,7 @@ class PriceViewMinimal(StatsView):
|
||||
vbox = wx.BoxSizer(wx.VERTICAL)
|
||||
box.Add(vbox, 1, wx.EXPAND)
|
||||
|
||||
vbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, _(_type).capitalize()), 0, wx.ALIGN_LEFT)
|
||||
vbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, _t(_type).capitalize()), 0, wx.ALIGN_LEFT)
|
||||
|
||||
hbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
vbox.Add(hbox)
|
||||
|
||||
@@ -27,7 +27,7 @@ from gui.statsView import StatsView
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
from service.fit import Fit
|
||||
|
||||
_ = wx.GetTranslation
|
||||
_t = wx.GetTranslation
|
||||
|
||||
|
||||
class RechargeViewFull(StatsView):
|
||||
@@ -40,7 +40,7 @@ class RechargeViewFull(StatsView):
|
||||
self.mainFrame.Bind(GE.EFFECTIVE_HP_TOGGLED, self.toggleEffective)
|
||||
|
||||
def getHeaderText(self, fit):
|
||||
return _("Recharge rates")
|
||||
return _t("Recharge rates")
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent(text)
|
||||
@@ -72,10 +72,10 @@ class RechargeViewFull(StatsView):
|
||||
# Add an empty label first for correct alignment.
|
||||
sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, ""), 0)
|
||||
toolTipText = {
|
||||
"shieldPassive": _("Passive shield recharge"),
|
||||
"shieldActive": _("Active shield boost"),
|
||||
"armorActive": _("Armor repair amount"),
|
||||
"hullActive": _("Hull repair amount")}
|
||||
"shieldPassive": _t("Passive shield recharge"),
|
||||
"shieldActive": _t("Active shield boost"),
|
||||
"armorActive": _t("Armor repair amount"),
|
||||
"hullActive": _t("Hull repair amount")}
|
||||
for tankType in ("shieldPassive", "shieldActive", "armorActive", "hullActive"):
|
||||
bitmap = BitmapLoader.getStaticBitmap("%s_big" % tankType, contentPanel, "gui")
|
||||
tooltip = wx.ToolTip(toolTipText[tankType])
|
||||
@@ -83,8 +83,8 @@ class RechargeViewFull(StatsView):
|
||||
sizerTankStats.Add(bitmap, 0, wx.ALIGN_CENTER)
|
||||
|
||||
toolTipText = {
|
||||
"reinforced": _("Reinforced"),
|
||||
"sustained": _("Sustained")}
|
||||
"reinforced": _t("Reinforced"),
|
||||
"sustained": _t("Sustained")}
|
||||
for stability in ("reinforced", "sustained"):
|
||||
bitmap = BitmapLoader.getStaticBitmap("regen%s_big" % stability.capitalize(), contentPanel, "gui")
|
||||
tooltip = wx.ToolTip(toolTipText[stability])
|
||||
|
||||
@@ -22,13 +22,13 @@ import wx
|
||||
from gui.preferenceView import PreferenceView
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
|
||||
_ = wx.GetTranslation
|
||||
_t = wx.GetTranslation
|
||||
|
||||
class PreferenceDialog(wx.Dialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent, id=wx.ID_ANY, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE)
|
||||
self.SetTitle("pyfa - " + _("Preferences"))
|
||||
self.SetTitle("pyfa - " + _t("Preferences"))
|
||||
i = wx.Icon(BitmapLoader.getBitmap("preferences_small", "gui"))
|
||||
self.SetIcon(i)
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
@@ -30,7 +30,7 @@ from service.implantSet import ImplantSets
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
_ = wx.GetTranslation
|
||||
_t = wx.GetTranslation
|
||||
class ImplantTextValidor(BaseValidator):
|
||||
def __init__(self):
|
||||
BaseValidator.__init__(self)
|
||||
@@ -45,21 +45,21 @@ class ImplantTextValidor(BaseValidator):
|
||||
|
||||
try:
|
||||
if len(text) == 0:
|
||||
raise ValueError(_("You must supply a name for the Implant Set!"))
|
||||
raise ValueError(_t("You must supply a name for the Implant Set!"))
|
||||
elif text in [x.name for x in entityEditor.choices]:
|
||||
raise ValueError(_("Implant Set name already in use, please choose another."))
|
||||
raise ValueError(_t("Implant Set 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 ImplantSetEntityEditor(EntityEditor):
|
||||
def __init__(self, parent):
|
||||
EntityEditor.__init__(self, parent, _("Implant Set"))
|
||||
EntityEditor.__init__(self, parent, _t("Implant Set"))
|
||||
self.SetEditorValidator(ImplantTextValidor)
|
||||
|
||||
def getEntitiesFromContext(self):
|
||||
@@ -119,7 +119,7 @@ class ImplantSetEditor(AuxiliaryFrame):
|
||||
|
||||
def __init__(self, parent, dataToAdd=None):
|
||||
super().__init__(
|
||||
parent, id=wx.ID_ANY, title=_("Implant Set Editor"), resizeable=True,
|
||||
parent, id=wx.ID_ANY, title=_t("Implant Set Editor"), resizeable=True,
|
||||
size=wx.Size(950, 500) if "wxGTK" in wx.PlatformInfo else wx.Size(850, 420))
|
||||
|
||||
self.block = False
|
||||
@@ -145,8 +145,8 @@ class ImplantSetEditor(AuxiliaryFrame):
|
||||
self.stNotice.Wrap(-1)
|
||||
footerSizer.Add(self.stNotice, 1, wx.BOTTOM | wx.TOP | wx.LEFT, 5)
|
||||
|
||||
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)
|
||||
@@ -158,7 +158,7 @@ class ImplantSetEditor(AuxiliaryFrame):
|
||||
btn.Layout()
|
||||
setattr(self, name, btn)
|
||||
btn.Enable(True)
|
||||
btn.SetToolTip(_("{} implant sets {} clipboard").format(name, direction))
|
||||
btn.SetToolTip(_t("{} implant sets {} clipboard").format(name, direction))
|
||||
footerSizer.Add(btn, 0)
|
||||
|
||||
mainSizer.Add(footerSizer, 0, wx.ALL | wx.EXPAND, 5)
|
||||
@@ -207,7 +207,7 @@ class ImplantSetEditor(AuxiliaryFrame):
|
||||
sIS = ImplantSets.getInstance()
|
||||
try:
|
||||
sIS.importSets(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))
|
||||
@@ -215,15 +215,15 @@ class ImplantSetEditor(AuxiliaryFrame):
|
||||
raise
|
||||
except Exception as e:
|
||||
pyfalog.error(e)
|
||||
self.stNotice.SetLabel(_("Could not import from clipboard: unknown errors"))
|
||||
self.stNotice.SetLabel(_t("Could not import from clipboard: unknown errors"))
|
||||
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"""
|
||||
|
||||
sIS = ImplantSets.getInstance()
|
||||
toClipboard(sIS.exportSets())
|
||||
self.stNotice.SetLabel(_("Sets exported to clipboard"))
|
||||
self.stNotice.SetLabel(_t("Sets exported to clipboard"))
|
||||
|
||||
@@ -27,7 +27,7 @@ import webbrowser
|
||||
import re
|
||||
import markdown2
|
||||
|
||||
_ = wx.GetTranslation
|
||||
_t = wx.GetTranslation
|
||||
|
||||
# HTML template. We link to a bootstrap cdn for quick and easy css, and include some additional teaks.
|
||||
html_tmpl = """
|
||||
@@ -51,7 +51,7 @@ class UpdateDialog(wx.Dialog):
|
||||
|
||||
def __init__(self, parent, release, version):
|
||||
super().__init__(
|
||||
parent, id=wx.ID_ANY, title="pyfa {}" + _("Update Available"), pos=wx.DefaultPosition,
|
||||
parent, id=wx.ID_ANY, title="pyfa {}" + _t("Update Available"), pos=wx.DefaultPosition,
|
||||
size=wx.Size(550, 450), style=wx.DEFAULT_DIALOG_STYLE)
|
||||
|
||||
self.UpdateSettings = svc_UpdateSettings.getInstance()
|
||||
@@ -99,7 +99,7 @@ class UpdateDialog(wx.Dialog):
|
||||
notesSizer.Add(self.browser, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
|
||||
mainSizer.Add(notesSizer, 1, wx.EXPAND, 5)
|
||||
|
||||
self.supressCheckbox = wx.CheckBox(self, wx.ID_ANY, _("Don't remind me again for this release"),
|
||||
self.supressCheckbox = wx.CheckBox(self, wx.ID_ANY, _t("Don't remind me again for this release"),
|
||||
wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.supressCheckbox.Bind(wx.EVT_CHECKBOX, self.SuppressChange)
|
||||
|
||||
@@ -110,7 +110,7 @@ class UpdateDialog(wx.Dialog):
|
||||
actionSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
goSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.downloadButton = wx.Button(self, wx.ID_ANY, _("Download"), wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.downloadButton = wx.Button(self, wx.ID_ANY, _t("Download"), wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.downloadButton.Bind(wx.EVT_BUTTON, self.OnDownload)
|
||||
goSizer.Add(self.downloadButton, 0, wx.ALL, 5)
|
||||
actionSizer.Add(goSizer, 1, wx.EXPAND, 5)
|
||||
|
||||
Reference in New Issue
Block a user