[orca/orca-xdesktop] Fix for bug 658133 - Firefox lines which begin with bullets are not always presented by Orca
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/orca-xdesktop] Fix for bug 658133 - Firefox lines which begin with bullets are not always presented by Orca
- Date: Sat, 3 Sep 2011 16:35:25 +0000 (UTC)
commit 9c49efaa4609703d05f8eacba4c2575944e9264e
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Sat Sep 3 12:29:01 2011 -0400
Fix for bug 658133 - Firefox lines which begin with bullets are not always presented by Orca
src/orca/braille.py | 7 ++++++-
src/orca/debug.py | 12 ++++++++++--
src/orca/script_utilities.py | 12 ++++++++++--
src/orca/scripts/toolkits/Gecko/script.py | 16 +++++++++++++---
src/orca/speechdispatcherfactory.py | 5 ++++-
5 files changed, 43 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index fc4b1c4..6bf9cb6 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -351,9 +351,14 @@ class Region:
self.expandOnCursor = expandOnCursor
+ try:
+ string = string.decode("UTF-8")
+ except UnicodeEncodeError:
+ debug.printException(debug.LEVEL_SEVERE)
+
# The uncontracted string for the line.
#
- self.rawLine = string.decode("UTF-8").strip("\n")
+ self.rawLine = string.strip("\n")
if self.contracted:
self.contractionTable = settings.brailleContractionTable or \
diff --git a/src/orca/debug.py b/src/orca/debug.py
index d11004f..ea825b7 100644
--- a/src/orca/debug.py
+++ b/src/orca/debug.py
@@ -150,9 +150,17 @@ def println(level, text = ""):
if level >= debugLevel:
if debugFile:
- debugFile.writelines([text, "\n"])
+ try:
+ debugFile.writelines([text, "\n"])
+ except TypeError:
+ text = "TypeError when trying to write text"
+ debugFile.writelines([text, "\n"])
else:
- sys.stderr.writelines([text, "\n"])
+ try:
+ sys.stderr.writelines([text, "\n"])
+ except TypeError:
+ text = "TypeError when trying to write text"
+ sys.stderr.writelines([text, "\n"])
def printObjectEvent(level, event, sourceInfo=None):
"""Prints out an Python Event object. The given level may be
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 194cfec..f985455 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2447,7 +2447,12 @@ class Utilities:
"""
newLine = ""
- words = self.WORDS_RE.split(line.decode("UTF-8"))
+ try:
+ line = line.decode("UTF-8")
+ except UnicodeEncodeError:
+ pass
+
+ words = self.WORDS_RE.split(line)
for word in words:
if word.isalnum():
word = self._pronunciationForSegment(word)
@@ -2480,7 +2485,10 @@ class Utilities:
Returns: a new line adjusted for repeat character counts (if enabled).
"""
- line = line.decode("UTF-8")
+ try:
+ line = line.decode("UTF-8")
+ except UnicodeEncodeError:
+ pass
if (len(line) < 4) or (settings.repeatCharacterLimit < 4):
return line.encode("UTF-8")
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index dd705a5..3f8445a 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -5027,7 +5027,11 @@ class Script(default.Script):
# So far so good. If the line doesn't begin with an EOC, we
# have our first character for this object.
#
- if not line.startswith(self.EMBEDDED_OBJECT_CHARACTER):
+ try:
+ isEOC = line.startswith(self.EMBEDDED_OBJECT_CHARACTER)
+ except:
+ isEOC = False
+ if not isEOC:
offset = start
else:
# The line may begin with a link, or it may begin with
@@ -5202,11 +5206,17 @@ class Script(default.Script):
#
def getACSS(self, obj, string):
"""Returns the ACSS to speak anything for the given obj."""
+
+ try:
+ string = string.decode("UTF-8")
+ except UnicodeEncodeError:
+ pass
+
if obj.getRole() == pyatspi.ROLE_LINK:
acss = self.voices[settings.HYPERLINK_VOICE]
elif string and isinstance(string, basestring) \
- and string.decode("UTF-8").isupper() \
- and string.decode("UTF-8").strip().isalpha():
+ and string.isupper() \
+ and string.strip().isalpha():
acss = self.voices[settings.UPPERCASE_VOICE]
else:
acss = self.voices[settings.DEFAULT_VOICE]
diff --git a/src/orca/speechdispatcherfactory.py b/src/orca/speechdispatcherfactory.py
index 8bc1b0d..7362f4b 100644
--- a/src/orca/speechdispatcherfactory.py
+++ b/src/orca/speechdispatcherfactory.py
@@ -286,7 +286,10 @@ class SpeechServer(speechserver.SpeechServer):
#
spokenEllipsis = _(" dot dot dot")
newText = re.sub(ELLIPSIS, spokenEllipsis, oldText)
- newText = newText.decode("UTF-8")
+ try:
+ newText = newText.decode("UTF-8")
+ except UnicodeEncodeError:
+ pass
symbols = set(re.findall(PUNCTUATION, newText))
for symbol in symbols:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]