Added settings to turn off automatic speech or Braille feedback. #203

This commit is contained in:
Manuel Cortez 2018-05-18 13:38:58 -05:00
parent 4a15fe1602
commit 7099875bc7
7 changed files with 35 additions and 10 deletions

View File

@ -2,6 +2,8 @@
## changes in this version
* 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))
* When you quote a Tweet, if the original tweet was posted with Twishort, TWBlue should display properly the quoted tweet. Before it was displaying the original tweet only. ([#206](https://github.com/manuelcortez/TWBlue/issues/206))
* It is possible to filter by retweets, quotes and replies when creating a new filter.

View File

@ -44,4 +44,8 @@ save_followers_in_autocompletion_db = boolean(default=False)
save_friends_in_autocompletion_db = boolean(default=False)
ocr_language = string(default="")
[reporting]
braille_reporting = boolean(default=True)
speech_reporting = boolean(default=True)
[filters]

View File

@ -422,7 +422,7 @@ class baseBufferController(bufferController):
else:
self.buffer.list.insert_item(True, *tweet)
if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and self.session.settings["sound"]["session_mute"] == False:
output.speak(" ".join(tweet[:2]))
output.speak(" ".join(tweet[:2]), speech=self.session.settings["reporting"]["speech_reporting"], braille=self.session.settings["reporting"]["braille_reporting"])
#Improve performance on Windows
# if platform.system() == "Windows":
# call_threaded(utils.is_audio,item)
@ -774,7 +774,7 @@ class eventsBufferController(bufferController):
else:
self.buffer.list.insert_item(True, *tweet)
if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and self.session.settings["sound"]["session_mute"] == False:
output.speak(" ".join(tweet))
output.speak(" ".join(tweet), speech=self.session.settings["reporting"]["speech_reporting"], braille=self.session.settings["reporting"]["braille_reporting"])
if self.buffer.list.get_count() == 1:
self.buffer.list.select_item(0)

View File

@ -1252,7 +1252,7 @@ class Controller(object):
if play_sound != None:
session.sound.play(play_sound)
if message != None:
output.speak(message)
output.speak(message, speech=session.settings["reporting"]["speech_reporting"], braille=session.settings["reporting"]["braille_reporting"])
def manage_home_timelines(self, data, user):
buffer = self.search_buffer("home_timeline", user)
@ -1354,8 +1354,7 @@ class Controller(object):
if buffer == None: return
play_sound = "tweet_timeline.ogg"
if "%s-timeline" % (who,) not in buffer.session.settings["other_buffers"]["muted_buffers"] and buffer.session.settings["sound"]["session_mute"] == False:
self.notify(buffer.session, play_sound=play_sound)
output.speak(_(u"One tweet from %s") % (data["user"]["name"]))
self.notify(buffer.session, play_sound=play_sound, message=_(u"One tweet from %s") % (data["user"]["name"]))
buffer.add_new_item(data)
def manage_item_in_list(self, data, user, where):
@ -1363,8 +1362,7 @@ class Controller(object):
if buffer == None: return
play_sound = "list_tweet.ogg"
if "%s" % (where,) not in buffer.session.settings["other_buffers"]["muted_buffers"] and buffer.session.settings["sound"]["session_mute"] == False:
self.notify(buffer.session, play_sound=play_sound)
output.speak(_(u"One tweet from %s") % (data["user"]["name"]))
self.notify(buffer.session, play_sound=play_sound, message=_(u"One tweet from %s") % (data["user"]["name"]))
buffer.add_new_item(data)
def start_buffers(self, session):

View File

@ -141,6 +141,9 @@ class accountSettingsController(globalSettingsController):
else:
self.dialog.set_value("general", "retweet_mode", _(u"Retweet with comments"))
self.dialog.set_value("general", "persist_size", str(self.config["general"]["persist_size"]))
self.dialog.create_reporting()
self.dialog.set_value("reporting", "speech_reporting", self.config["reporting"]["speech_reporting"])
self.dialog.set_value("reporting", "braille_reporting", self.config["reporting"]["braille_reporting"])
self.dialog.create_other_buffers()
buffer_values = self.get_buffers_list()
self.dialog.buffers.insert_buffers(buffer_values)
@ -205,6 +208,8 @@ class accountSettingsController(globalSettingsController):
if set(self.config["general"]["buffer_order"]) != set(buffers_list) or buffers_list != self.config["general"]["buffer_order"]:
self.needs_restart = True
self.config["general"]["buffer_order"] = buffers_list
self.config["reporting"]["speech_reporting"] = self.dialog.get_value("reporting", "speech_reporting")
self.config["reporting"]["braille_reporting"] = self.dialog.get_value("reporting", "braille_reporting")
self.config["mysc"]["ocr_language"] = OCRSpace.OcrLangs[self.dialog.extras.ocr_lang.GetSelection()]
# if self.config["other_buffers"]["show_followers"] != self.dialog.get_value("buffers", "followers"):
# self.config["other_buffers"]["show_followers"] = self.dialog.get_value("buffers", "followers")

View File

@ -7,11 +7,13 @@ import sys
speaker = None
def speak(text, interrupt=0):
def speak(text, interrupt=0, speech=True, braille=True):
global speaker
if not speaker:
setup()
if speech:
speaker.speak(text, interrupt)
if braille:
speaker.braille(text)
def setup ():

View File

@ -123,6 +123,16 @@ class generalAccount(wx.Panel, baseDialog.BaseWXDialog):
sizer.Add(self.persist_size, 0, wx.ALL, 5)
self.SetSizer(sizer)
class reporting(wx.Panel, baseDialog.BaseWXDialog):
def __init__(self, parent):
super(reporting, self).__init__(parent)
sizer = wx.BoxSizer(wx.VERTICAL)
self.speech_reporting = wx.CheckBox(self, wx.NewId(), _(U"Enable automatic speech feedback"))
sizer.Add(self.speech_reporting, 0, wx.ALL, 5)
self.braille_reporting = wx.CheckBox(self, wx.NewId(), _(U"Enable automatic Braille feedback"))
sizer.Add(self.braille_reporting, 0, wx.ALL, 5)
self.SetSizer(sizer)
class other_buffers(wx.Panel):
def __init__(self, parent):
super(other_buffers, self).__init__(parent)
@ -339,6 +349,10 @@ class configurationDialog(baseDialog.BaseWXDialog):
self.notebook.AddPage(self.general, _(u"General"))
self.general.SetFocus()
def create_reporting(self):
self.reporting = reporting(self.notebook)
self.notebook.AddPage(self.reporting, _(u"Feedback"))
def create_other_buffers(self):
self.buffers = other_buffers(self.notebook)
self.notebook.AddPage(self.buffers, _(u"Buffers"))