Add ability to set eos language separate from pyfa language
This commit is contained in:
@@ -60,7 +60,7 @@ class PyfaApp(wx.App):
|
||||
|
||||
# If an unsupported language is requested default to English.
|
||||
if lang in supLang:
|
||||
selLang = supLang[lang]
|
||||
selLang = supLang[lang].wxLocale
|
||||
else:
|
||||
selLang = wx.LANGUAGE_ENGLISH_US
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ from gui.bitmap_loader import BitmapLoader
|
||||
from gui.preferenceView import PreferenceView
|
||||
from service.fit import Fit
|
||||
from service.settings import SettingsProvider, LocaleSettings
|
||||
import eos.config
|
||||
|
||||
|
||||
_t = wx.GetTranslation
|
||||
|
||||
@@ -91,21 +93,43 @@ class PFGeneralPref(PreferenceView):
|
||||
mainSizer.Add(self.rbAddLabels, 0, wx.EXPAND | wx.TOP | wx.RIGHT | wx.BOTTOM, 10)
|
||||
self.rbAddLabels.Bind(wx.EVT_RADIOBOX, self.OnAddLabelsChange)
|
||||
|
||||
langBox = wx.StaticBoxSizer(wx.VERTICAL, panel, "Language (requires restart)")
|
||||
mainSizer.Add(langBox, 0, wx.EXPAND | wx.TOP | wx.RIGHT | wx.BOTTOM, 10)
|
||||
|
||||
langSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.stLangLabel = wx.StaticText(panel, wx.ID_ANY, _t("Language (restart required):"), wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stLangLabel = wx.StaticText(panel, wx.ID_ANY, _t("pyfa:"), wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stLangLabel.Wrap(-1)
|
||||
langSizer.Add(self.stLangLabel, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
|
||||
|
||||
self.langChoices = self.localeSettings.supported_langauges.keys()
|
||||
self.chLang = wx.Choice(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, [x for x in self.langChoices], 0)
|
||||
self.chLang = wx.Choice(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, sorted([x for x in self.langChoices]), 0)
|
||||
self.chLang.Bind(wx.EVT_CHOICE, self.onLangSelection)
|
||||
|
||||
self.chLang.SetStringSelection(self.localeSettings.get('locale'))
|
||||
|
||||
langSizer.Add(self.chLang, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
|
||||
mainSizer.Add(langSizer)
|
||||
langBox.Add(langSizer)
|
||||
|
||||
eosLangSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.stEosLangLabel = wx.StaticText(panel, wx.ID_ANY, _t("EVE Data:"), wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stEosLangLabel.Wrap(-1)
|
||||
eosLangSizer.Add(self.stEosLangLabel, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
|
||||
|
||||
self.eosLangChoices = eos.config.translation_mapping.keys()
|
||||
self.chEosLang = wx.Choice(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, [LocaleSettings.defaults['eos_locale']]+sorted([x for x in self.eosLangChoices]), 0)
|
||||
self.chEosLang.Bind(wx.EVT_CHOICE, self.onEosLangSelection)
|
||||
|
||||
self.chEosLang.SetStringSelection(self.localeSettings.get('eos_locale'))
|
||||
|
||||
eosLangSizer.Add(self.chEosLang, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
|
||||
|
||||
langBox.Add(eosLangSizer)
|
||||
langBox.Add(wx.StaticText(panel, wx.ID_ANY,
|
||||
_t("(Auto will use the same language pyfa uses if available, otherwise English)"),
|
||||
wx.DefaultPosition,
|
||||
wx.DefaultSize, 0), 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
|
||||
self.sFit = Fit.getInstance()
|
||||
|
||||
self.cbGlobalChar.SetValue(self.sFit.serviceFittingOptions["useGlobalCharacter"])
|
||||
@@ -145,6 +169,9 @@ class PFGeneralPref(PreferenceView):
|
||||
def onLangSelection(self, event):
|
||||
self.localeSettings.set('locale', self.chLang.GetString(self.chLang.GetSelection()))
|
||||
|
||||
def onEosLangSelection(self, event):
|
||||
self.localeSettings.set('eos_locale', self.chEosLang.GetString(self.chEosLang.GetSelection()))
|
||||
|
||||
def onCBGlobalColorBySlot(self, event):
|
||||
# todo: maybe create a SettingChanged event that we can fire, and have other things hook into, instead of having the preference panel itself handle the
|
||||
# updating of things related to settings.
|
||||
|
||||
Reference in New Issue
Block a user