Added proxy setting to preferences dialog

This commit is contained in:
Manuel Cortez 2019-01-29 16:23:02 -06:00
parent ac268c0672
commit a6565aae53
5 changed files with 30 additions and 3 deletions

View File

@ -22,6 +22,7 @@
* Now it is possible to create and delete audio albums again.
* Fixed errors when moving songs to albums. Now everything works as expected.
* Added documents to the list of supported files when adding attachments to a wall post or private message.
* It is possible to enable or disable proxy from the preferences dialog. The application must be restarted for this change to take effect.
## Changes in version 0.18 (21.01.2019)

View File

@ -2,6 +2,7 @@
from __future__ import unicode_literals
import widgetUtils
from pubsub import pub
from wxUI.commonMessages import restart_program as restart_program_dialog
from . import base
class configurationInteractor(base.baseInteractor):
@ -12,15 +13,22 @@ class configurationInteractor(base.baseInteractor):
def set_setting(self, tab, setting, value):
self.view.set_value(tab, setting, value)
def restart(self):
dlg = restart_program_dialog()
if dlg == widgetUtils.YES:
self.presenter.restart_application()
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")
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")
def start(self):
self.view.realize()
@ -53,3 +61,4 @@ class configurationInteractor(base.baseInteractor):
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.save_settings_file()
self.presenter.update_proxy(self.view.get_value("general", "use_proxy"))

View File

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import config
from mysc import restart
from . import base
class configurationPresenter(base.basePresenter):
@ -43,6 +45,7 @@ class configurationPresenter(base.basePresenter):
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"])
self.send_message("set", tab="general", setting="use_proxy", value=config.app["app-settings"]["use_proxy"])
self.send_message("set", tab="general", setting="update_channel", value=self.get_update_channel_label(self.session.settings["general"]["update_channel"]))
self.send_message("create_tab", tab="chat")
self.send_message("set", tab="chat", setting="notify_online", value=self.session.settings["chat"]["notify_online"])
@ -64,3 +67,12 @@ class configurationPresenter(base.basePresenter):
def save_settings_file(self):
self.session.settings.write()
def update_proxy(self, proxy_value):
if proxy_value != config.app["app-settings"]["use_proxy"]:
config.app["app-settings"]["use_proxy"] = proxy_value
config.app.write()
self.send_message("restart_program")
def restart_application(self):
restart.restart_program()

View File

@ -23,6 +23,8 @@ class general(wx.Panel, widgetUtils.BaseDialog):
sizer.Add(box3, 0, wx.ALL, 5)
self.load_images = wx.CheckBox(self, wx.NewId(), _("Load images in posts"))
sizer.Add(self.load_images, 0, wx.ALL, 5)
self.use_proxy = wx.CheckBox(self, wx.NewId(), _("Use proxy"))
sizer.Add(self.use_proxy, 0, wx.ALL, 5)
lbl4 = wx.StaticText(self, wx.NewId(), _("Update channel"))
self.update_channel = wx.ComboBox(self, wx.NewId(), choices=[_("Stable"), _("Alpha")], value=_("Native"), style=wx.CB_READONLY)
box4 = wx.BoxSizer(wx.HORIZONTAL)

View File

@ -55,3 +55,6 @@ def remove_friend(user):
def post_deleted():
return wx.MessageDialog(None, _("This post has been removed."), _("Error"), wx.ICON_ERROR).ShowModal()
def restart_program():
return wx.MessageDialog(None, _("In order to apply the changes you requested, you must restart the program. Do you want to restart Socializer now?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()