Merge 5c02e4e4b28b88870173c170daeba8bf91c61f36 into 92d803717f5550a26b7de79484e2dd5c59ef09cd

This commit is contained in:
Bill Dengler 2016-04-17 00:57:05 +00:00
commit bdc01532fa
4 changed files with 29 additions and 1 deletions

View File

@ -16,6 +16,8 @@ log_level = string(default="error")
load_keymap = string(default="default.keymap") load_keymap = string(default="default.keymap")
donation_dialog_displayed = boolean(default=False) donation_dialog_displayed = boolean(default=False)
check_for_updates = boolean(default=True) check_for_updates = boolean(default=True)
api_key_override = string(default="")
api_secret_override = string(default="")
[proxy] [proxy]
server = string(default="") server = string(default="")

View File

@ -71,6 +71,8 @@ class globalSettingsController(object):
self.dialog.set_value("proxy", "password", config.app["proxy"]["password"]) self.dialog.set_value("proxy", "password", config.app["proxy"]["password"])
self.dialog.create_postabandonment() self.dialog.create_postabandonment()
self.dialog.set_value("postabandonment", "check_for_updates", config.app["app-settings"]["check_for_updates"]) self.dialog.set_value("postabandonment", "check_for_updates", config.app["app-settings"]["check_for_updates"])
self.dialog.set_value("postabandonment", "api_key_override", config.app["app-settings"]["api_key_override"])
self.dialog.set_value("postabandonment", "api_secret_override", config.app["app-settings"]["api_secret_override"])
self.dialog.realize() self.dialog.realize()
self.response = self.dialog.get_response() self.response = self.dialog.get_response()
@ -102,6 +104,13 @@ class globalSettingsController(object):
config.app["proxy"]["user"] = self.dialog.get_value("proxy", "user") config.app["proxy"]["user"] = self.dialog.get_value("proxy", "user")
config.app["proxy"]["password"] = self.dialog.get_value("proxy", "password") config.app["proxy"]["password"] = self.dialog.get_value("proxy", "password")
config.app["app-settings"]["check_for_updates"] = self.dialog.get_value("postabandonment", "check_for_updates") config.app["app-settings"]["check_for_updates"] = self.dialog.get_value("postabandonment", "check_for_updates")
if config.app["app-settings"]["api_key_override"] != self.dialog.get_value("postabandonment", "api_key_override"):
config.app["app-settings"]["api_key_override"] = self.dialog.get_value("postabandonment", "api_key_override")
self.needs_restart=True
if config.app["app-settings"]["api_secret_override"] != self.dialog.get_value("postabandonment", "api_secret_override"):
config.app["app-settings"]["api_secret_override"] = self.dialog.get_value("postabandonment", "api_secret_override")
self.needs_restart=True
#Todo: delete sessions when API key/secrets are changed.
config.app.write() config.app.write()
class accountSettingsController(globalSettingsController): class accountSettingsController(globalSettingsController):

View File

@ -5,6 +5,7 @@ import exceptions
from ctypes import c_char_p from ctypes import c_char_p
from libloader import load_library from libloader import load_library
import paths import paths
import config
#if application.snapshot == True: #if application.snapshot == True:
# if platform.architecture()[0][:2] == "32": # if platform.architecture()[0][:2] == "32":
# lib = load_library("snapshot_api_keys32", x86_path=paths.app_path("keys/lib")) # lib = load_library("snapshot_api_keys32", x86_path=paths.app_path("keys/lib"))
@ -38,4 +39,9 @@ class Keyring(object):
def get(self, func): def get(self, func):
if hasattr(application,func+"_override"): if hasattr(application,func+"_override"):
return getattr(application,func+'_override') return getattr(application,func+'_override')
try:
if config.app != None and config.app['app-settings'][func+"_override"] != "":
return config.app['app-settings'][func+"_override"]
except KeyError:
pass
return getattr(self, "_call_method")("get_"+func) return getattr(self, "_call_method")("get_"+func)

View File

@ -42,7 +42,6 @@ class general(wx.Panel, baseDialog.BaseWXDialog):
self.SetSizer(sizer) self.SetSizer(sizer)
class proxy(wx.Panel, baseDialog.BaseWXDialog): class proxy(wx.Panel, baseDialog.BaseWXDialog):
def __init__(self, parent): def __init__(self, parent):
super(proxy, self).__init__(parent) super(proxy, self).__init__(parent)
sizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.BoxSizer(wx.VERTICAL)
@ -78,6 +77,18 @@ class postabandonment(wx.Panel, baseDialog.BaseWXDialog):
sizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.BoxSizer(wx.VERTICAL)
self.check_for_updates = wx.CheckBox(self, -1, _(U"Check for updates when {0} launches").format(application.name,)) self.check_for_updates = wx.CheckBox(self, -1, _(U"Check for updates when {0} launches").format(application.name,))
sizer.Add(self.check_for_updates, 0, wx.ALL, 5) sizer.Add(self.check_for_updates, 0, wx.ALL, 5)
lbl = wx.StaticText(self, wx.NewId(), _(u"custom Twitter API key: "))
self.api_key_override = wx.TextCtrl(self, -1)
APIKeyBox = wx.BoxSizer(wx.HORIZONTAL)
APIKeyBox.Add(lbl, 0, wx.ALL, 5)
APIKeyBox.Add(self.api_key_override, 0, wx.ALL, 5)
sizer.Add(APIKeyBox, 0, wx.ALL, 5)
lbl = wx.StaticText(self, wx.NewId(), _(u"custom Twitter API secret: "))
self.api_secret_override = wx.TextCtrl(self, -1)
APISecretBox = wx.BoxSizer(wx.HORIZONTAL)
APISecretBox.Add(lbl, 0, wx.ALL, 5)
APISecretBox.Add(self.api_secret_override, 0, wx.ALL, 5)
sizer.Add(APISecretBox, 0, wx.ALL, 5)
class generalAccount(wx.Panel, baseDialog.BaseWXDialog): class generalAccount(wx.Panel, baseDialog.BaseWXDialog):
def __init__(self, parent): def __init__(self, parent):