[orca] Ensure we speak all generated utterances during SayAll
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Ensure we speak all generated utterances during SayAll
- Date: Wed, 25 Jan 2017 10:54:44 +0000 (UTC)
commit 37aa9995e3eb5bc2266d888146d1d6a494b7fcce
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Jan 25 11:53:42 2017 +0100
Ensure we speak all generated utterances during SayAll
src/orca/scripts/web/script.py | 33 ++++++++++++++++++---------------
1 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 65f3689..c8ca248 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -543,6 +543,23 @@ class Script(default.Script):
characterOffset = offset
priorObj, priorOffset = self.utilities.getPriorContext()
+ # TODO - JD: This is sad, but it's better than the old, broken
+ # clumpUtterances(). We really need to fix the speechservers'
+ # SayAll support. In the meantime, the generators should be
+ # providing one ACSS per string.
+ def _parseUtterances(utterances):
+ elements, voices = [], []
+ for u in utterances:
+ if isinstance(u, list):
+ e, v = _parseUtterances(u)
+ elements.extend(e)
+ voices.extend(v)
+ elif isinstance(u, str):
+ elements.append(u)
+ elif isinstance(u, ACSS):
+ voices.append(u)
+ return elements, voices
+
self._inSayAll = True
done = False
while not done:
@@ -560,21 +577,7 @@ class Script(default.Script):
[content], eliminatePauses=True, priorObj=priorObj)
priorObj = obj
- # TODO - JD: This is sad, but it's better than the old, broken
- # clumpUtterances(). We really need to fix the speechservers'
- # SayAll support. In the meantime, the generators should be
- # providing one ACSS per string.
- utterance = utterances[0]
- elements, voices = [], []
- for u in utterance:
- if isinstance(u, list):
- elements.extend(filter(lambda x: isinstance(x, str), u))
- voices.extend(filter(lambda x: isinstance(x, ACSS), u))
- elif isinstance(u, str):
- elements.append(u)
- elif isinstance(u, ACSS):
- voices.append(u)
-
+ elements, voices = _parseUtterances(utterances)
if len(elements) != len(voices):
continue
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]