Added option to disable streaming from global settings. Closes #219

This commit is contained in:
Manuel Cortez 2018-06-15 08:45:10 -05:00
parent a2cb4ba889
commit ab2667529f
6 changed files with 19 additions and 2 deletions

View File

@ -2,6 +2,8 @@
## changes in this version
* Added an option in the global settings dialog to disable the Streaming features of TWBlue. TWBlue will remove all Streaming features after August 16, so this option will give people an idea about how it will be. ([#219](https://github.com/manuelcortez/TWBlue/issues/219))
* Due to Twitter API changes, Switched authorisation method to Pin-code based authorisation. When you add new accounts to TWBlue, you will be required to paste a code displayed in the Twitter website in order to grant access to TWBlue. ([#216](https://github.com/manuelcortez/TWBlue/issues/216))
* Added a new tab called feedback, in the account settings dialog. This tab allows you to control wether automatic speech or Braille feedbak in certain events (mentions and direct messages received) is enabled. Take into account that this option will take preference over automatic reading of buffers and any kind of automatic output. ([#203](https://github.com/manuelcortez/TWBlue/issues/203))
* The spell checking dialog now has access keys defined for the most important actions. ([#211](https://github.com/manuelcortez/TWBlue/issues/211))
* TWBlue now Uses WXPython 4.0.1. This will allow us to migrate all important components to Python 3 in the future. ([#207](https://github.com/manuelcortez/TWBlue/issues/207))

View File

@ -20,6 +20,7 @@ check_for_updates = boolean(default=True)
remember_mention_and_longtweet = boolean(default=False)
longtweet = boolean(default=false)
mention_all = boolean(default=False)
no_streaming = boolean(default=False)
[proxy]
type = string(default="Direct connection")

View File

@ -23,6 +23,13 @@ supported_languages = []
def streaming_lives():
""" Check if we are in August 16.
ToDo: This method should be removed after deadline==True"""
# Let's import config here so we will avoid breaking things when setup.py is going to be used.
# Check if user has disabled the streaming API things from settings.
import config
if config.app != None:
no_streaming = config.app["app-settings"]["no_streaming"]
if no_streaming == True:
return False
deadline = datetime.date(2018, 8, 16)
now = datetime.datetime.now().date()
return deadline>now

View File

@ -1403,8 +1403,9 @@ class Controller(object):
continue
if change_title:
pub.sendMessage("buffer-title-changed", buffer=i)
log.debug("Starting the streaming endpoint")
session.start_streaming()
if application.streaming_lives():
log.debug("Starting the streaming endpoint")
session.start_streaming()
def set_positions(self):
for i in session_.sessions:

View File

@ -61,6 +61,7 @@ class globalSettingsController(object):
else:
self.dialog.general.autostart.Enable(False)
self.dialog.set_value("general", "ask_at_exit", config.app["app-settings"]["ask_at_exit"])
self.dialog.set_value("general", "no_streaming", config.app["app-settings"]["no_streaming"])
self.dialog.set_value("general", "play_ready_sound", config.app["app-settings"]["play_ready_sound"])
self.dialog.set_value("general", "speak_ready_msg", config.app["app-settings"]["speak_ready_msg"])
self.dialog.set_value("general", "handle_longtweets", config.app["app-settings"]["handle_longtweets"])
@ -99,6 +100,9 @@ class globalSettingsController(object):
if config.app["app-settings"]["use_invisible_keyboard_shorcuts"] != self.dialog.get_value("general", "use_invisible_shorcuts"):
config.app["app-settings"]["use_invisible_keyboard_shorcuts"] = self.dialog.get_value("general", "use_invisible_shorcuts")
pub.sendMessage("invisible-shorcuts-changed", registered=self.dialog.get_value("general", "use_invisible_shorcuts"))
if config.app["app-settings"]["no_streaming"] != self.dialog.get_value("general", "no_streaming"):
config.app["app-settings"]["no_streaming"] = self.dialog.get_value("general", "no_streaming")
self.needs_restart = True
config.app["app-settings"]["voice_enabled"] = self.dialog.get_value("general", "disable_sapi5")
config.app["app-settings"]["hide_gui"] = self.dialog.get_value("general", "hide_gui")
config.app["app-settings"]["ask_at_exit"] = self.dialog.get_value("general", "ask_at_exit")

View File

@ -22,6 +22,8 @@ class general(wx.Panel, baseDialog.BaseWXDialog):
self.ask_at_exit = wx.CheckBox(self, -1, _(U"ask before exiting {0}").format(application.name,))
sizer.Add(self.autostart, 0, wx.ALL, 5)
sizer.Add(self.ask_at_exit, 0, wx.ALL, 5)
self.no_streaming = wx.CheckBox(self, -1, _(U"Disable Streaming functions"))
sizer.Add(self.no_streaming, 0, wx.ALL, 5)
self.play_ready_sound = wx.CheckBox(self, -1, _(U"Play a sound when {0} launches").format(application.name,))
sizer.Add(self.play_ready_sound, 0, wx.ALL, 5)
self.speak_ready_msg = wx.CheckBox(self, -1, _(U"Speak a message when {0} launches").format(application.name,))