mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Fixed sintax errors. Added a new option to set the proxy type
This commit is contained in:
parent
8a701c450e
commit
b7dd6d43fe
@ -19,6 +19,7 @@ donation_dialog_displayed = boolean(default=False)
|
||||
check_for_updates = boolean(default=True)
|
||||
|
||||
[proxy]
|
||||
type = string(default="Direct connection")
|
||||
server = string(default="")
|
||||
port = string(default="")
|
||||
user = string(default="")
|
||||
|
@ -67,7 +67,9 @@ class globalSettingsController(object):
|
||||
self.dialog.set_value("general", "disable_sapi5", config.app["app-settings"]["voice_enabled"])
|
||||
self.dialog.set_value("general", "hide_gui", config.app["app-settings"]["hide_gui"])
|
||||
self.dialog.set_value("general", "check_for_updates", config.app["app-settings"]["check_for_updates"])
|
||||
self.dialog.create_proxy()
|
||||
proxyTypes=[_(u"Direct connection"), u"http", u"https", u"socks4", u"socks5"]
|
||||
self.dialog.create_proxy(proxyTypes)
|
||||
self.dialog.proxy.type.SetSelection(proxyTypes.index(config.app["proxy"]["type"]))
|
||||
self.dialog.set_value("proxy", "server", config.app["proxy"]["server"])
|
||||
self.dialog.set_value("proxy", "port", config.app["proxy"]["port"])
|
||||
self.dialog.set_value("proxy", "user", config.app["proxy"]["user"])
|
||||
@ -100,9 +102,10 @@ class globalSettingsController(object):
|
||||
config.app["app-settings"]["play_ready_sound"] = self.dialog.get_value("general", "play_ready_sound")
|
||||
config.app["app-settings"]["speak_ready_msg"] = self.dialog.get_value("general", "speak_ready_msg")
|
||||
config.app["app-settings"]["check_for_updates"] = self.dialog.get_value("general", "check_for_updates")
|
||||
if config.app["proxy"]["server"] != self.dialog.get_value("proxy", "server") or config.app["proxy"]["port"] != self.dialog.get_value("proxy", "port") or config.app["proxy"]["user"] != self.dialog.get_value("proxy", "user") or config.app["proxy"]["password"] != self.dialog.get_value("proxy", "password"):
|
||||
if config.app["proxy"]["type"]!=self.dialog.get_value("proxy", "type") or config.app["proxy"]["server"] != self.dialog.get_value("proxy", "server") or config.app["proxy"]["port"] != self.dialog.get_value("proxy", "port") or config.app["proxy"]["user"] != self.dialog.get_value("proxy", "user") or config.app["proxy"]["password"] != self.dialog.get_value("proxy", "password"):
|
||||
if self.is_started == True:
|
||||
self.needs_restart = True
|
||||
config.app["proxy"]["type"]=self.dialog.get_value("proxy", "type")
|
||||
config.app["proxy"]["server"] = self.dialog.get_value("proxy", "server")
|
||||
config.app["proxy"]["port"] = self.dialog.get_value("proxy", "port")
|
||||
config.app["proxy"]["user"] = self.dialog.get_value("proxy", "user")
|
||||
|
@ -19,12 +19,12 @@ def patched_session_init(self):
|
||||
self.proxies={"http":"http://{0}:{1}/".format(config.app["proxy"]["server"], config.app["proxy"]["port"]),
|
||||
"https": "https://{0}:{1}/".format(config.app["proxy"]["server"], config.app["proxy"]["port"]),
|
||||
"http": "socks5://{0}:{1}/".format(config.app["proxy"]["server"], config.app["proxy"]["port"]),
|
||||
"https": "socks5://{0}:{1}/".format(config.app["proxy"]["server"], config.app["proxy"]["port"])
|
||||
"https": "socks5://{0}:{1}/".format(config.app["proxy"]["server"], config.app["proxy"]["port"]),
|
||||
"http": "socks4://{0}:{1}/".format(config.app["proxy"]["server"], config.app["proxy"]["port"]),
|
||||
"https": "socks4://{0}:{1}/".format(config.app["proxy"]["server"], config.app["proxy"]["port"])}
|
||||
if config.app["proxy"]["user"] != "" and config.app["proxy"]["password"] != "":
|
||||
self.proxies={"http": "http://{0}:{1}@{2}:{3}/".format(config.app["proxy"]["user"], config.app["proxy"]["password"], config.app["proxy"]["server"], config.app["proxy"]["port"]),
|
||||
"https": "https://{0}:{1}@{2}:{3}/".format(config.app["proxy"]["user"], config.app["proxy"]["password"], config.app["proxy"]["server"], config.app["proxy"]["port"])
|
||||
"https": "https://{0}:{1}@{2}:{3}/".format(config.app["proxy"]["user"], config.app["proxy"]["password"], config.app["proxy"]["server"], config.app["proxy"]["port"]),
|
||||
"http": "socks5://{0}:{1}@{2}:{3}/".format(config.app["proxy"]["user"], config.app["proxy"]["password"], config.app["proxy"]["server"], config.app["proxy"]["port"]),
|
||||
"https": "socks5://{0}:{1}@{2}:{3}/".format(config.app["proxy"]["user"], config.app["proxy"]["password"], config.app["proxy"]["server"], config.app["proxy"]["port"]),
|
||||
"http": "socks4://{0}:{1}@{2}:{3}/".format(config.app["proxy"]["user"], config.app["proxy"]["password"], config.app["proxy"]["server"], config.app["proxy"]["port"]),
|
||||
|
@ -47,9 +47,16 @@ class general(wx.Panel, baseDialog.BaseWXDialog):
|
||||
|
||||
class proxy(wx.Panel, baseDialog.BaseWXDialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
def __init__(self, parent, proxyTypes):
|
||||
super(proxy, self).__init__(parent)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
type=wx.StaticText(self, wx.NewId(), _(u"Proxy type: "))
|
||||
self.type=wx.ComboBox(self, -1, choices=proxyTypes, style=wx.CB_READONLY)
|
||||
self.type.SetSize(self.type.GetBestSize())
|
||||
typeBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
typeBox.Add(type, 0, wx.ALL, 5)
|
||||
typeBox.Add(self.type, 0, wx.ALL, 5)
|
||||
sizer.Add(typeBox, 0, wx.ALL, 5)
|
||||
lbl = wx.StaticText(self, wx.NewId(), _(u"Proxy server: "))
|
||||
self.server = wx.TextCtrl(self, -1)
|
||||
serverBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
@ -335,8 +342,8 @@ class configurationDialog(baseDialog.BaseWXDialog):
|
||||
self.notebook.AddPage(self.general, _(u"General"))
|
||||
self.general.SetFocus()
|
||||
|
||||
def create_proxy(self):
|
||||
self.proxy = proxy(self.notebook)
|
||||
def create_proxy(self, proxyTypes):
|
||||
self.proxy = proxy(self.notebook, proxyTypes)
|
||||
self.notebook.AddPage(self.proxy, _(u"Proxy"))
|
||||
|
||||
def create_general_account(self):
|
||||
|
Loading…
Reference in New Issue
Block a user