Added language settings in preferences dialog
This commit is contained in:
parent
cde18c8d35
commit
7928131112
@ -6,6 +6,7 @@
|
||||
* Improvements in the audio player module:
|
||||
* When modifying volume of the playing audio, it will decrease or increase the volume by 2% instead of 5%.
|
||||
* For users with multiple soundcards, there is a new tab in the preferences dialogue of Socializer, called sound. From there, you can define what soundcard will be used for input and output.
|
||||
* it is possible to select the language used in socializer from the preferences dialog. When changing the language, the application must be restarted for the changes to take effect.
|
||||
|
||||
## Changes in version 0.19 (13.03.2019)
|
||||
|
||||
|
@ -18,17 +18,22 @@ class configurationInteractor(base.baseInteractor):
|
||||
if dlg == widgetUtils.YES:
|
||||
self.presenter.restart_application()
|
||||
|
||||
def set_language(self, language):
|
||||
self.view.general.language.SetSelection(language)
|
||||
|
||||
def install(self, *args, **kwargs):
|
||||
super(configurationInteractor, self).install(*args, **kwargs)
|
||||
pub.subscribe(self.create_tab, self.modulename+"_create_tab")
|
||||
pub.subscribe(self.set_setting, self.modulename+"_set")
|
||||
pub.subscribe(self.restart, self.modulename+"_restart_program")
|
||||
pub.subscribe(self.set_language, self.modulename+"_set_language")
|
||||
|
||||
def uninstall(self):
|
||||
super(configurationInteractor, self).uninstall()
|
||||
pub.unsubscribe(self.create_tab, self.modulename+"_create_tab")
|
||||
pub.unsubscribe(self.set_setting, self.modulename+"_set")
|
||||
pub.unsubscribe(self.restart, self.modulename+"_restart_program")
|
||||
pub.unsubscribe(self.set_language, self.modulename+"_set_language")
|
||||
|
||||
def start(self):
|
||||
self.view.realize()
|
||||
@ -60,6 +65,7 @@ class configurationInteractor(base.baseInteractor):
|
||||
self.presenter.update_setting(section="load_at_startup", setting="audio_albums", value=self.view.get_value("startup", "audio_albums"))
|
||||
self.presenter.update_setting(section="load_at_startup", setting="video_albums", value=self.view.get_value("startup", "video_albums"))
|
||||
self.presenter.update_setting(section="load_at_startup", setting="communities", value=self.view.get_value("startup", "communities"))
|
||||
self.presenter.update_app_setting(section="app-settings", setting="language", value=self.presenter.codes[self.view.general.language.GetSelection()])
|
||||
self.presenter.update_app_setting(section="sound", setting="input_device", value=self.view.get_value("sound", "input"))
|
||||
self.presenter.update_app_setting(section="sound", setting="output_device", value=self.view.get_value("sound", "output"))
|
||||
self.presenter.update_app_setting(section="app-settings", setting="use_proxy", value=self.view.get_value("general", "use_proxy"))
|
||||
|
@ -82,7 +82,7 @@ def getAvailableLanguages():
|
||||
"""
|
||||
#Make a list of all the locales found in NVDA's locale dir
|
||||
l=[x for x in os.listdir(paths.locale_path()) if not x.startswith('.')]
|
||||
l=[x for x in l if os.path.isfile(paths.locale_path('%s/LC_MESSAGES/%s.po' % (x, application.short_name)))]
|
||||
l=[x for x in l if os.path.isfile(os.path.join(paths.locale_path(), '%s/LC_MESSAGES/%s.po' % (x, application.short_name)))]
|
||||
#Make sure that en (english) is in the list as it may not have any locale files, but is default
|
||||
if 'en' not in l:
|
||||
l.append('en')
|
||||
|
@ -2,6 +2,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import sound_lib.input, sound_lib.output
|
||||
import config
|
||||
import languageHandler
|
||||
from mysc import restart
|
||||
from . import base
|
||||
|
||||
@ -44,7 +45,12 @@ class configurationPresenter(base.basePresenter):
|
||||
return "alpha"
|
||||
|
||||
def create_config(self):
|
||||
self.send_message("create_tab", tab="general")
|
||||
self.langs = languageHandler.getAvailableLanguages()
|
||||
langs = [i[1] for i in self.langs]
|
||||
self.codes = [i[0] for i in self.langs]
|
||||
id = self.codes.index(config.app["app-settings"]["language"])
|
||||
self.send_message("create_tab", tab="general", arglist=dict(languages=langs))
|
||||
self.send_message("set_language", language=id)
|
||||
self.send_message("set", tab="general", setting="wall_buffer_count", value=self.session.settings["buffers"]["count_for_wall_buffers"])
|
||||
self.send_message("set", tab="general", setting="video_buffers_count", value=self.session.settings["buffers"]["count_for_video_buffers"])
|
||||
self.send_message("set", tab="general", setting="load_images", value=self.session.settings["general"]["load_images"])
|
||||
@ -83,7 +89,7 @@ class configurationPresenter(base.basePresenter):
|
||||
raise AttributeError("The setting you specified is not present in the config file.")
|
||||
# check if certain settings have been changed so we'd restart the client.
|
||||
# List of app settings that require a restart after being changed.
|
||||
settings_needing_restart = ["use_proxy", "input_device", "output_device"]
|
||||
settings_needing_restart = ["language", "use_proxy", "input_device", "output_device"]
|
||||
if value != config.app[section][setting] and setting in settings_needing_restart:
|
||||
self.needs_restart = True
|
||||
config.app[section][setting] = value
|
||||
|
@ -4,7 +4,7 @@ password = string(default="")
|
||||
token = string(default="")
|
||||
secret = string(default="")
|
||||
device_id = string(default="")
|
||||
use_alternative_tokens = boolean(default=False)
|
||||
use_alternative_tokens = boolean(default=True)
|
||||
invited_to_group = boolean(default=False)
|
||||
|
||||
[general]
|
||||
|
@ -4,9 +4,14 @@ import wx
|
||||
import widgetUtils
|
||||
|
||||
class general(wx.Panel, widgetUtils.BaseDialog):
|
||||
def __init__(self, panel):
|
||||
def __init__(self, panel, languages):
|
||||
super(general, self).__init__(panel)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
langBox = wx.StaticBoxSizer(parent=self, orient=wx.HORIZONTAL, label=_("Language"))
|
||||
self.language = wx.ListBox(langBox.GetStaticBox(), wx.NewId(), choices=languages)
|
||||
self.language.SetSize(self.language.GetBestSize())
|
||||
langBox.Add(self.language, 0, wx.ALL, 5)
|
||||
sizer.Add(langBox, 0, wx.ALL, 5)
|
||||
lbl1 = wx.StaticText(self, wx.NewId(), _("Number of items to load for newsfeed and wall buffers (maximun 100)"))
|
||||
self.wall_buffer_count = wx.SpinCtrl(self, wx.NewId())
|
||||
self.wall_buffer_count.SetRange(1, 100)
|
||||
@ -115,8 +120,8 @@ class configurationDialog(widgetUtils.BaseDialog):
|
||||
self.sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self.notebook = wx.Notebook(self.panel)
|
||||
|
||||
def create_general(self):
|
||||
self.general = general(self.notebook)
|
||||
def create_general(self, languages):
|
||||
self.general = general(self.notebook, languages)
|
||||
self.notebook.AddPage(self.general, _("General"))
|
||||
self.general.SetFocus()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user