Removed proxy from application

This commit is contained in:
Manuel Cortez 2022-03-22 10:12:00 -06:00
parent ea653f6c64
commit 826631ba1b
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
4 changed files with 16 additions and 15 deletions

View File

@ -54,7 +54,7 @@ class configurationInteractor(base.baseInteractor):
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="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="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="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")) # self.presenter.update_app_setting(section="app-settings", setting="use_proxy", value=self.view.get_value("general", "use_proxy"))
self.presenter.update_app_setting(section="app-settings", setting="debug_logging", value=self.view.get_value("general", "debug_logging")) self.presenter.update_app_setting(section="app-settings", setting="debug_logging", value=self.view.get_value("general", "debug_logging"))
self.presenter.save_app_settings_file() self.presenter.save_app_settings_file()
self.presenter.save_settings_file() self.presenter.save_settings_file()

View File

@ -36,7 +36,7 @@ class configurationPresenter(base.basePresenter):
self.send_message("create_tab", tab="general", arglist=dict(languages=langs)) self.send_message("create_tab", tab="general", arglist=dict(languages=langs))
self.send_message("set_language", language=id) self.send_message("set_language", language=id)
self.send_message("set", tab="general", setting="load_images", value=self.session.settings["general"]["load_images"]) 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="use_proxy", value=config.app["app-settings"]["use_proxy"])
self.send_message("set", tab="general", setting="debug_logging", value=config.app["app-settings"]["debug_logging"]) self.send_message("set", tab="general", setting="debug_logging", value=config.app["app-settings"]["debug_logging"])
self.send_message("create_tab", tab="buffers") self.send_message("create_tab", tab="buffers")
self.send_message("set", tab="buffers", setting="wall_buffer_count", value=self.session.settings["buffers"]["count_for_wall_buffers"]) self.send_message("set", tab="buffers", setting="wall_buffer_count", value=self.session.settings["buffers"]["count_for_wall_buffers"])
@ -73,7 +73,7 @@ class configurationPresenter(base.basePresenter):
raise AttributeError("The setting you specified is not present in the config file.") 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. # check if certain settings have been changed so we'd restart the client.
# List of app settings that require a restart after being changed. # List of app settings that require a restart after being changed.
settings_needing_restart = ["language", "use_proxy", "input_device", "output_device", "debug_logging"] settings_needing_restart = ["language", "input_device", "output_device", "debug_logging"]
if value != config.app[section][setting] and setting in settings_needing_restart: if value != config.app[section][setting] and setting in settings_needing_restart:
self.needs_restart = True self.needs_restart = True
config.app[section][setting] = value config.app[section][setting] = value

View File

@ -37,18 +37,18 @@ def setup():
app = widgetUtils.mainLoopObject() app = widgetUtils.mainLoopObject()
if config.app["app-settings"]["first_start"]: if config.app["app-settings"]["first_start"]:
log.debug("Detected first time execution.") log.debug("Detected first time execution.")
proxy_option = commonMessages.proxy_question() # proxy_option = commonMessages.proxy_question()
if proxy_option == widgetUtils.YES: # if proxy_option == widgetUtils.YES:
config.app["app-settings"]["use_proxy"] = True # config.app["app-settings"]["use_proxy"] = True
log.debug("User has requested to use proxy for connecting to VK.") # log.debug("User has requested to use proxy for connecting to VK.")
config.app["app-settings"]["first_start"] = False config.app["app-settings"]["first_start"] = False
config.app.write() config.app.write()
if config.app["app-settings"]["use_proxy"]: # if config.app["app-settings"]["use_proxy"]:
log.debug("Enabling proxy support... ") # log.debug("Enabling proxy support... ")
import requests # import requests
orig_session_init=requests.sessions.Session.__init__ # orig_session_init=requests.sessions.Session.__init__
requests.sessions.Session.__init__=patched_session_init # requests.sessions.Session.__init__=patched_session_init
requests.Session.__init__=patched_session_init # requests.Session.__init__=patched_session_init
from controller import mainController from controller import mainController
from sessionmanager import sessionManager from sessionmanager import sessionManager
@ -60,6 +60,7 @@ def setup():
call_threaded(r.login) call_threaded(r.login)
app.run() app.run()
### ToDo: Use this when proxy is available again.
def patched_session_init(self): def patched_session_init(self):
global orig_session_init global orig_session_init
orig_session_init(self) orig_session_init(self)

View File

@ -13,8 +13,8 @@ class general(wx.Panel, widgetUtils.BaseDialog):
sizer.Add(langBox, 0, wx.ALL, 5) sizer.Add(langBox, 0, wx.ALL, 5)
self.load_images = wx.CheckBox(self, wx.NewId(), _("Load images in posts")) self.load_images = wx.CheckBox(self, wx.NewId(), _("Load images in posts"))
sizer.Add(self.load_images, 0, wx.ALL, 5) sizer.Add(self.load_images, 0, wx.ALL, 5)
self.use_proxy = wx.CheckBox(self, wx.NewId(), _("Use proxy")) # self.use_proxy = wx.CheckBox(self, wx.NewId(), _("Use proxy"))
sizer.Add(self.use_proxy, 0, wx.ALL, 5) # sizer.Add(self.use_proxy, 0, wx.ALL, 5)
self.debug_logging = wx.CheckBox(self, wx.NewId(), _("Enable debug logging (useful for reporting errors)")) self.debug_logging = wx.CheckBox(self, wx.NewId(), _("Enable debug logging (useful for reporting errors)"))
sizer.Add(self.debug_logging, 0, wx.ALL, 5) sizer.Add(self.debug_logging, 0, wx.ALL, 5)
self.SetSizer(sizer) self.SetSizer(sizer)