Commit 1edd8174 authored by Joanmarie Diggs's avatar Joanmarie Diggs

Check for pauses-only results when generating speech

For most accessible objects, we attempt to generate lots of things
(e.g. role, relevant states, displayed text, selection, etc.) and
by default we separate these pieces of information by pauses. In
some cases (e.g. an empty paragraph) it is possible to generate
results consisting solely of pauses. We don't want to treat that as
actual results because it can cause other logic (e.g. saying "blank")
to not kick in and lead to our speaking nothing.
parent a3be0c09
......@@ -114,7 +114,13 @@ class SpeechGenerator(generator.Generator):
globalsDict['voice'] = self.voice
def generateSpeech(self, obj, **args):
return self.generate(obj, **args)
rv = self.generate(obj, **args)
if rv and not list(filter(lambda x: not isinstance(x, Pause), rv)):
msg = 'SPEECH GENERATOR: Results for %s are pauses only' % obj
debug.println(debug.LEVEL_INFO, msg, True)
rv = []
return rv
def _resultElementToString(self, element, includeAll=True):
if debug.LEVEL_ALL < debug.debugLevel:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment