mirror of
				https://github.com/MCV-Software/TWBlue.git
				synced 2025-10-30 20:02:01 +00:00 
			
		
		
		
	post-abandonment: add ability to use a custom Twitter API key/secret.
This commit is contained in:
		| @@ -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="") | ||||||
|   | |||||||
| @@ -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): | ||||||
|   | |||||||
| @@ -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): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Bill Dengler
					Bill Dengler