More localization
This commit is contained in:
@@ -31,7 +31,7 @@ from logbook import Logger
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
_ = 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, _("&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, _("&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.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, _("&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.AppendSeparator()
|
||||
fileMenu.Append(wx.ID_EXIT)
|
||||
|
||||
# Fit menu
|
||||
fitMenu = wx.Menu()
|
||||
self.Append(fitMenu, "Fi&t")
|
||||
self.Append(fitMenu, _("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, _("&Undo")+"\tCTRL+Z", _("Undo the most recent action"))
|
||||
fitMenu.Append(wx.ID_REDO, _("&Redo")+"\tCTRL+Y", _("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, _("&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.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, _("&Import Fittings")+"\tCTRL+O", _("Import fittings into pyfa"))
|
||||
fitMenu.Append(wx.ID_SAVEAS, _("&Export Fitting")+"\tCTRL+S", _("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, _("&Optimize Fit Price")+"\tCTRL+D")
|
||||
graphFrameItem = wx.MenuItem(fitMenu, self.graphFrameId, _("&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, _("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, _("&Browse ESI Fittings")+"\tCTRL+B")
|
||||
fitMenu.Append(self.exportToEveId, _("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, _("&Character"))
|
||||
|
||||
characterMenu.Append(self.saveCharId, "&Save Character")
|
||||
characterMenu.Append(self.saveCharAsId, "Save Character &As...")
|
||||
characterMenu.Append(self.revertCharId, "&Revert Character")
|
||||
characterMenu.Append(self.saveCharId, _("&Save Character"))
|
||||
characterMenu.Append(self.saveCharAsId, _("Save Character &As..."))
|
||||
characterMenu.Append(self.revertCharId, _("&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, _("&Import Character File"), _("Import characters into pyfa from file"))
|
||||
characterMenu.Append(self.exportSkillsNeededId, _("&Export Skills Needed"), _("Export skills needed for this fitting"))
|
||||
|
||||
characterMenu.AppendSeparator()
|
||||
characterMenu.Append(self.ssoLoginId, "&Manage ESI Characters")
|
||||
characterMenu.Append(self.ssoLoginId, _("&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, _("Attribute &Overrides"))
|
||||
attrItem.SetBitmap(BitmapLoader.getBitmap("fit_rename_small", "gui"))
|
||||
globalMenu.Append(attrItem)
|
||||
globalMenu.Append(self.toggleOverridesId, "&Turn Overrides On")
|
||||
globalMenu.Append(self.toggleOverridesId, _("&Turn Overrides On"))
|
||||
globalMenu.AppendSeparator()
|
||||
|
||||
|
||||
self.Append(globalMenu, "&Global")
|
||||
self.Append(globalMenu, _("&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, _("&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, _("&Editors"))
|
||||
charEditItem = wx.MenuItem(editorsMenu, self.characterEditorId, _("&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, _("&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, _("&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, _("&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, _("&Help"))
|
||||
helpMenu.Append(self.wikiId, _("&Wiki"), _("Go to wiki on GitHub"))
|
||||
helpMenu.Append(self.forumId, _("&Forums"), _("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, _("Open Wid&gets Inspect tool"), _("Open Widgets Inspect tool"))
|
||||
helpMenu.Append(self.devToolsId, _("Open &Dev Tools"), _("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(_("Enable Fitting Re&strictions"))
|
||||
else:
|
||||
self.ignoreRestrictionItem.SetItemLabel("Disable Fitting Re&strictions")
|
||||
self.ignoreRestrictionItem.SetItemLabel(_("Disable Fitting Re&strictions"))
|
||||
|
||||
def fitRenamed(self, event):
|
||||
self.refreshUndo()
|
||||
|
||||
@@ -35,7 +35,7 @@ class MultiSwitch(ChromeNotebook):
|
||||
if h:
|
||||
h(type, info)
|
||||
|
||||
def AddPage(self, tabWnd=None, tabTitle="Empty Tab", tabImage=None):
|
||||
def AddPage(self, tabWnd=None, tabTitle=_("Empty Tab"), tabImage=None):
|
||||
if tabWnd is None:
|
||||
tabWnd = gui.builtinViews.emptyView.BlankPage(self)
|
||||
tabWnd.handleDrag = lambda type, info: self.handleDrag(type, info)
|
||||
|
||||
@@ -32,6 +32,7 @@ from service.fit import Fit
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
_ = wx.GetTranslation
|
||||
|
||||
class DmgPatternNameValidator(BaseValidator):
|
||||
def __init__(self):
|
||||
@@ -47,21 +48,21 @@ class DmgPatternNameValidator(BaseValidator):
|
||||
|
||||
try:
|
||||
if len(text) == 0:
|
||||
raise ValueError("You must supply a name for your Damage Profile!")
|
||||
raise ValueError(_("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(_("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), _("Error"))
|
||||
textCtrl.SetFocus()
|
||||
return False
|
||||
|
||||
|
||||
class DmgPatternEntityEditor(EntityEditor):
|
||||
def __init__(self, parent):
|
||||
EntityEditor.__init__(self, parent, "Damage Profile")
|
||||
EntityEditor.__init__(self, parent, _("Damage Profile"))
|
||||
self.SetEditorValidator(DmgPatternNameValidator)
|
||||
|
||||
def getEntitiesFromContext(self):
|
||||
@@ -95,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=_("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))
|
||||
|
||||
@@ -167,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, _("from")),
|
||||
("Export", wx.ART_FILE_SAVE_AS, _("to")))
|
||||
|
||||
for name, art, direction in importExport:
|
||||
bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON)
|
||||
@@ -180,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(_("%s patterns %s clipboard") % (name, direction))
|
||||
footerSizer.Add(btn, 0)
|
||||
btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Patterns".format(name.lower())))
|
||||
|
||||
@@ -247,6 +248,7 @@ class DmgPatternEditor(AuxiliaryFrame):
|
||||
if p is None:
|
||||
return
|
||||
|
||||
# localization todo: unsure if these names are internal only or also displayed somewhere...
|
||||
if p.rawName == "Uniform" or p.rawName == "Selected Ammo":
|
||||
self.restrict()
|
||||
else:
|
||||
@@ -271,26 +273,26 @@ class DmgPatternEditor(AuxiliaryFrame):
|
||||
sDP = DamagePattern.getInstance()
|
||||
try:
|
||||
sDP.importPatterns(text)
|
||||
self.stNotice.SetLabel("Patterns successfully imported from clipboard")
|
||||
self.stNotice.SetLabel(_("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 = _("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(_("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(_("Patterns exported to clipboard"))
|
||||
|
||||
def kbEvent(self, event):
|
||||
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
|
||||
|
||||
@@ -22,12 +22,13 @@ import wx
|
||||
from gui.preferenceView import PreferenceView
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
|
||||
_ = 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 - " + _("Preferences"))
|
||||
i = wx.Icon(BitmapLoader.getBitmap("preferences_small", "gui"))
|
||||
self.SetIcon(i)
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
@@ -48,6 +49,7 @@ class PreferenceDialog(wx.Dialog):
|
||||
|
||||
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnSizer.AddStretchSpacer()
|
||||
# localization todo: "OK" button shoudl be a built in thing that is already localized...
|
||||
self.btnOK = wx.Button(self, wx.ID_ANY, "OK", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
btnSizer.Add(self.btnOK, 0, wx.ALL, 5)
|
||||
mainSizer.Add(btnSizer, 0, wx.EXPAND, 5)
|
||||
|
||||
@@ -19,12 +19,12 @@ from service.market import Market
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
_ = wx.GetTranslation
|
||||
class AttributeEditor(AuxiliaryFrame):
|
||||
|
||||
def __init__(self, parent):
|
||||
super().__init__(
|
||||
parent, wx.ID_ANY, title="Attribute Editor", pos=wx.DefaultPosition,
|
||||
parent, wx.ID_ANY, title=_("Attribute Editor"), pos=wx.DefaultPosition,
|
||||
size=wx.Size(650, 600), resizeable=True)
|
||||
|
||||
i = wx.Icon(BitmapLoader.getBitmap("fit_rename_small", "gui"))
|
||||
@@ -34,9 +34,9 @@ class AttributeEditor(AuxiliaryFrame):
|
||||
|
||||
menubar = wx.MenuBar()
|
||||
fileMenu = wx.Menu()
|
||||
fileImport = fileMenu.Append(wx.ID_ANY, 'Import', 'Import overrides')
|
||||
fileExport = fileMenu.Append(wx.ID_ANY, 'Export', 'Import overrides')
|
||||
fileClear = fileMenu.Append(wx.ID_ANY, 'Clear All', 'Clear all overrides')
|
||||
fileImport = fileMenu.Append(wx.ID_ANY, _('Import'), _('Import overrides'))
|
||||
fileExport = fileMenu.Append(wx.ID_ANY, _('Export'), _('Import overrides'))
|
||||
fileClear = fileMenu.Append(wx.ID_ANY, _('Clear All'), _('Clear all overrides'))
|
||||
|
||||
menubar.Append(fileMenu, '&File')
|
||||
self.SetMenuBar(menubar)
|
||||
@@ -67,7 +67,7 @@ class AttributeEditor(AuxiliaryFrame):
|
||||
mainSizer.Add(leftPanel, 1, wx.ALL | wx.EXPAND, 5)
|
||||
|
||||
rightSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.btnRemoveOverrides = wx.Button(panel, wx.ID_ANY, "Remove Overides for Item", wx.DefaultPosition,
|
||||
self.btnRemoveOverrides = wx.Button(panel, wx.ID_ANY, _("Remove Overides for Item"), wx.DefaultPosition,
|
||||
wx.DefaultSize, 0)
|
||||
self.pg = AttributeGrid(panel)
|
||||
rightSizer.Add(self.pg, 1, wx.ALL | wx.EXPAND, 5)
|
||||
@@ -103,7 +103,7 @@ class AttributeEditor(AuxiliaryFrame):
|
||||
|
||||
def OnImport(self, event):
|
||||
with wx.FileDialog(
|
||||
self, "Import pyfa override file",
|
||||
self, _("Import pyfa override file"),
|
||||
wildcard="pyfa override file (*.csv)|*.csv",
|
||||
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST
|
||||
) as dlg:
|
||||
@@ -126,7 +126,7 @@ class AttributeEditor(AuxiliaryFrame):
|
||||
defaultFile = "pyfa_overrides.csv"
|
||||
|
||||
with wx.FileDialog(
|
||||
self, "Save Overrides As...",
|
||||
self, _("Save Overrides As..."),
|
||||
wildcard="pyfa overrides (*.csv)|*.csv",
|
||||
style=wx.FD_SAVE,
|
||||
defaultFile=defaultFile
|
||||
@@ -142,8 +142,8 @@ class AttributeEditor(AuxiliaryFrame):
|
||||
def OnClear(self, event):
|
||||
with wx.MessageDialog(
|
||||
self,
|
||||
"Are you sure you want to delete all overrides?",
|
||||
"Confirm Delete",
|
||||
_("Are you sure you want to delete all overrides?"),
|
||||
_("Confirm Delete"),
|
||||
wx.YES | wx.NO | wx.ICON_EXCLAMATION
|
||||
) as dlg:
|
||||
if dlg.ShowModal() == wx.ID_YES:
|
||||
@@ -279,7 +279,7 @@ class AttributeGrid(wxpg.PropertyGrid):
|
||||
prop = wxpg.FloatProperty(key, value=default)
|
||||
|
||||
prop.SetClientData(item.attributes[key]) # set this so that we may access it later
|
||||
prop.SetHelpString("%s\n%s" % (item.attributes[key].displayName or key, "Default Value: %0.3f" % default))
|
||||
prop.SetHelpString("%s\n%s" % (item.attributes[key].displayName or key, _("Default Value: %0.3f") % default))
|
||||
self.Append(prop)
|
||||
|
||||
def removeOverrides(self, event):
|
||||
|
||||
@@ -30,7 +30,7 @@ from service.implantSet import ImplantSets
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
_ = 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(_("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(_("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), _("Error"))
|
||||
textCtrl.SetFocus()
|
||||
return False
|
||||
|
||||
|
||||
class ImplantSetEntityEditor(EntityEditor):
|
||||
def __init__(self, parent):
|
||||
EntityEditor.__init__(self, parent, "Implant Set")
|
||||
EntityEditor.__init__(self, parent, _("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=_("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, _("from")),
|
||||
("Export", wx.ART_FILE_SAVE_AS, _("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("%s implant sets %s clipboard" % (name, direction))
|
||||
btn.SetToolTip(_("{} 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(_("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(_("Could not import from clipboard: unknown errors"))
|
||||
finally:
|
||||
self.entityEditor.refreshEntityList()
|
||||
else:
|
||||
self.stNotice.SetLabel("Could not import from clipboard")
|
||||
self.stNotice.SetLabel(_("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(_("Sets exported to clipboard"))
|
||||
|
||||
@@ -10,12 +10,12 @@ class SsoLogin(wx.Dialog):
|
||||
mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
super().__init__(
|
||||
mainFrame, id=wx.ID_ANY, title="SSO Login", style=wx.DEFAULT_DIALOG_STYLE,
|
||||
mainFrame, id=wx.ID_ANY, title=_("SSO Login"), style=wx.DEFAULT_DIALOG_STYLE,
|
||||
size=wx.Size(450, 240) if "wxGTK" in wx.PlatformInfo else wx.Size(400, 240))
|
||||
|
||||
bSizer1 = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
text = wx.StaticText(self, wx.ID_ANY, "Copy and paste the block of text provided by pyfa.io")
|
||||
text = wx.StaticText(self, wx.ID_ANY, _("Copy and paste the block of text provided by pyfa.io"))
|
||||
bSizer1.Add(text, 0, wx.ALL | wx.EXPAND, 10)
|
||||
|
||||
self.ssoInfoCtrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, (-1, -1), style=wx.TE_MULTILINE)
|
||||
@@ -44,7 +44,7 @@ class SsoLoginServer(wx.Dialog):
|
||||
|
||||
def __init__(self, port):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
super().__init__(self.mainFrame, id=wx.ID_ANY, title="SSO Login", size=(-1, -1), style=wx.DEFAULT_DIALOG_STYLE)
|
||||
super().__init__(self.mainFrame, id=wx.ID_ANY, title=_("SSO Login"), size=(-1, -1), style=wx.DEFAULT_DIALOG_STYLE)
|
||||
|
||||
from service.esi import Esi
|
||||
|
||||
@@ -57,7 +57,7 @@ class SsoLoginServer(wx.Dialog):
|
||||
self.mainFrame.Bind(GE.EVT_SSO_LOGIN, self.OnLogin)
|
||||
self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
|
||||
|
||||
text = wx.StaticText(self, wx.ID_ANY, "Waiting for character login through EVE Single Sign-On.")
|
||||
text = wx.StaticText(self, wx.ID_ANY, _("Waiting for character login through EVE Single Sign-On."))
|
||||
bSizer1.Add(text, 0, wx.ALL | wx.EXPAND, 10)
|
||||
|
||||
bSizer3 = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
@@ -38,6 +38,7 @@ from service.targetProfile import TargetProfile
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
_ = wx.GetTranslation
|
||||
|
||||
class ResistValidator(InputValidator):
|
||||
|
||||
@@ -46,9 +47,9 @@ class ResistValidator(InputValidator):
|
||||
return True, ''
|
||||
value = strToFloat(value)
|
||||
if value is None:
|
||||
return False, 'Incorrect formatting (decimals only)'
|
||||
return False, _('Incorrect formatting (decimals only)')
|
||||
if value < 0 or value > 100:
|
||||
return False, 'Incorrect range (must be 0-100)'
|
||||
return False, _('Incorrect range (must be 0-100)')
|
||||
return True, ''
|
||||
|
||||
|
||||
@@ -67,14 +68,14 @@ class TargetProfileNameValidator(BaseValidator):
|
||||
|
||||
try:
|
||||
if len(text) == 0:
|
||||
raise ValueError("You must supply a name for your Target Profile!")
|
||||
raise ValueError(_("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(_("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), _("Error"))
|
||||
textCtrl.SetFocus()
|
||||
return False
|
||||
|
||||
@@ -82,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=_("Target Profile"))
|
||||
self.SetEditorValidator(TargetProfileNameValidator)
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
@@ -115,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", _("EM resistance")),
|
||||
("thermal", _("Thermal resistance")),
|
||||
("kinetic", _("Kinetic resistance")),
|
||||
("explosive", _("Explosive resistance"))])
|
||||
ATTRIBUTES = OrderedDict([
|
||||
('maxVelocity', ('Maximum speed', 'm/s')),
|
||||
('signatureRadius', ('Signature radius\nLeave blank for infinitely big value', 'm')),
|
||||
('radius', ('Radius', 'm'))])
|
||||
('maxVelocity', (_('Maximum speed'), 'm/s')),
|
||||
('signatureRadius', (_('Signature radius\nLeave blank for infinitely big value'), 'm')),
|
||||
('radius', (_('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=_("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))
|
||||
|
||||
@@ -217,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, _("from")),
|
||||
("Export", wx.ART_FILE_SAVE_AS, _("to")))
|
||||
|
||||
for name, art, direction in importExport:
|
||||
bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON)
|
||||
@@ -230,7 +231,7 @@ class TargetProfileEditor(AuxiliaryFrame):
|
||||
btn.Layout()
|
||||
setattr(self, name, btn)
|
||||
btn.Enable(True)
|
||||
btn.SetToolTip("%s profiles %s clipboard" % (name, direction))
|
||||
btn.SetToolTip(_("{} profiles {} clipboard").format(name, direction))
|
||||
footerSizer.Add(btn, 0)
|
||||
btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Patterns".format(name.lower())))
|
||||
|
||||
@@ -348,27 +349,27 @@ class TargetProfileEditor(AuxiliaryFrame):
|
||||
sTR = TargetProfile.getInstance()
|
||||
try:
|
||||
sTR.importPatterns(text)
|
||||
self.stNotice.SetLabel("Profiles successfully imported from clipboard")
|
||||
self.stNotice.SetLabel(_("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 = _("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(_("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(_("Profiles exported to clipboard"))
|
||||
|
||||
def kbEvent(self, event):
|
||||
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
|
||||
|
||||
@@ -49,7 +49,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 "+_("Update Available"), pos=wx.DefaultPosition,
|
||||
size=wx.Size(550, 450), style=wx.DEFAULT_DIALOG_STYLE)
|
||||
|
||||
self.UpdateSettings = svc_UpdateSettings.getInstance()
|
||||
@@ -97,7 +97,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, _("Don't remind me again for this release"),
|
||||
wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.supressCheckbox.Bind(wx.EVT_CHECKBOX, self.SuppressChange)
|
||||
|
||||
@@ -108,7 +108,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, _("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