[orca] Patch for bgo#585870 - Gecko's clumpUtterances method probably can be removed
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca] Patch for bgo#585870 - Gecko's clumpUtterances method probably can be removed
- Date: Wed, 17 Jun 2009 09:30:27 -0400 (EDT)
commit 2377c318f8271e5559299cd19e4e1d00cb091cef
Author: Willie Walker <william walker sun com>
Date: Wed Jun 17 09:24:34 2009 -0400
Patch for bgo#585870 - Gecko's clumpUtterances method probably can be removed
This is a patch to allow Orca to continue working until we decide what to do
with clumpUtterances (and speech in general in Gecko).
src/orca/scripts/toolkits/Gecko/script.py | 30 ++++++++++++++++------------
src/orca/speech.py | 7 ++++-
2 files changed, 22 insertions(+), 15 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index f08c202..8d7ec2c 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1144,9 +1144,10 @@ class Script(default.Script):
for i in xrange(len(clumped)):
[obj, startOffset, endOffset, text] = \
contents[min(i, len(contents)-1)]
- [string, voice] = clumped[i]
- string = self.adjustForRepeats(string)
- yield [speechserver.SayAllContext(obj, string,
+ [element, voice] = clumped[i]
+ if isinstance(element, basestring):
+ element = self.adjustForRepeats(element)
+ yield [speechserver.SayAllContext(obj, element,
startOffset, endOffset),
voice]
@@ -5577,14 +5578,16 @@ class Script(default.Script):
clumped = []
- for [string, acss] in utterances:
+ for [element, acss] in utterances:
if len(clumped) == 0:
- clumped = [[string, acss]]
- elif acss == clumped[-1][1]:
+ clumped = [[element, acss]]
+ elif acss == clumped[-1][1] \
+ and isinstance(element, basestring) \
+ and isinstance(clumped[-1][0], basestring):
clumped [-1][0] = clumped[-1][0].rstrip(" ")
- clumped[-1][0] += " " + string
+ clumped[-1][0] += " " + element
else:
- clumped.append([string, acss])
+ clumped.append([element, acss])
if (len(clumped) == 1) and (clumped[0][0] == "\n"):
if settings.speakBlankLines:
@@ -5593,8 +5596,8 @@ class Script(default.Script):
#
return [[_("blank"), clumped[0][1]]]
- if len(clumped):
- clumped [-1][0] = clumped[-1][0].rstrip(" ")
+ if len(clumped) and isinstance(clumped[-1][0], basestring):
+ clumped[-1][0] = clumped[-1][0].rstrip(" ")
return clumped
@@ -5602,9 +5605,10 @@ class Script(default.Script):
"""Speaks each string in contents using the associated voice/acss"""
utterances = self.getUtterancesFromContents(contents, speakRole)
clumped = self.clumpUtterances(utterances)
- for [string, acss] in clumped:
- string = self.adjustForRepeats(string)
- speech.speak(string, acss, False)
+ for [element, acss] in clumped:
+ if isinstance(element, basestring):
+ element = self.adjustForRepeats(element)
+ speech.speak(element, acss, False)
def speakCharacterAtOffset(self, obj, characterOffset):
"""Speaks the character at the given characterOffset in the
diff --git a/src/orca/speech.py b/src/orca/speech.py
index 00f8131..4a84542 100644
--- a/src/orca/speech.py
+++ b/src/orca/speech.py
@@ -177,10 +177,10 @@ def speak(content, acss=None, interrupt=True):
if settings.silenceSpeech:
return
+ subString = None
if isinstance(content, basestring):
subString = content
elif isinstance(content, list):
- subString = None
for element in content:
if isinstance(element, basestring):
if subString:
@@ -209,10 +209,13 @@ def speak(content, acss=None, interrupt=True):
else:
debug.println(debug.LEVEL_WARNING,
"UNKNOWN speech element: '%s'" % element)
+ elif isinstance(content, (speech_generator.Pause,
+ speech_generator.LineBreak)):
+ pass
else:
debug.printStack(debug.LEVEL_WARNING)
debug.println(debug.LEVEL_WARNING,
- "bad content send to speech.speak: '%s'", repr(content))
+ "bad content sent to speech.speak: '%s'" % repr(content))
if subString:
_speak(subString, acss, interrupt)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]