[orca] Fix for bgo#589610 - isupper should be used on unicode and not UTF-8 strings
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca] Fix for bgo#589610 - isupper should be used on unicode and not UTF-8 strings
- Date: Tue, 28 Jul 2009 16:47:24 +0000 (UTC)
commit 6f249297fb5c5c19b2bea2bfd7209ac14651fc8c
Author: Willie Walker <william walker sun com>
Date: Tue Jul 28 12:45:01 2009 -0400
Fix for bgo#589610 - isupper should be used on unicode and not UTF-8 strings
src/orca/default.py | 21 +++++++++++----------
src/orca/gnomespeechfactory.py | 2 +-
src/orca/scripts/apps/acroread.py | 2 +-
src/orca/scripts/apps/evolution/script.py | 4 ++--
src/orca/scripts/apps/gedit/script.py | 4 ++--
src/orca/scripts/apps/gnome-terminal.py | 2 +-
src/orca/scripts/apps/pidgin/script.py | 2 +-
src/orca/scripts/apps/soffice/script.py | 4 ++--
src/orca/scripts/toolkits/Gecko/script.py | 3 ++-
9 files changed, 23 insertions(+), 21 deletions(-)
---
diff --git a/src/orca/default.py b/src/orca/default.py
index 34f5a43..c5ac2ce 100644
--- a/src/orca/default.py
+++ b/src/orca/default.py
@@ -2177,7 +2177,7 @@ class Script(script.Script):
phrase = self.getText(obj, startOffset, endOffset)
if len(phrase) and phrase != "\n":
- if phrase.isupper():
+ if phrase.decode("UTF-8").isupper():
voice = self.voices[settings.UPPERCASE_VOICE]
else:
voice = self.voices[settings.DEFAULT_VOICE]
@@ -2209,7 +2209,7 @@ class Script(script.Script):
(caretOffset, settings.speakBlankLines))
if len(line) and line != "\n":
- if line.isupper():
+ if line.decode("UTF-8").isupper():
voice = self.voices[settings.UPPERCASE_VOICE]
else:
voice = self.voices[settings.DEFAULT_VOICE]
@@ -2262,7 +2262,7 @@ class Script(script.Script):
if self.getLinkIndex(obj, offset) >= 0:
voice = self.voices[settings.HYPERLINK_VOICE]
- elif word.isupper():
+ elif word.decode("UTF-8").isupper():
voice = self.voices[settings.UPPERCASE_VOICE]
else:
voice = self.voices[settings.DEFAULT_VOICE]
@@ -2392,7 +2392,7 @@ class Script(script.Script):
if self.getLinkIndex(obj, sentenceStartOffset + 1) >= 0:
voice = self.voices[settings.HYPERLINK_VOICE]
- elif sentence.isupper():
+ elif sentence.decode("UTF-8").isupper():
voice = self.voices[settings.UPPERCASE_VOICE]
else:
voice = self.voices[settings.DEFAULT_VOICE]
@@ -2468,7 +2468,7 @@ class Script(script.Script):
if self.getLinkIndex(obj, wordStartOffset + 1) >= 0:
voice = self.voices[settings.HYPERLINK_VOICE]
- elif word.isupper():
+ elif word.decode("UTF-8").isupper():
voice = self.voices[settings.UPPERCASE_VOICE]
else:
voice = self.voices[settings.DEFAULT_VOICE]
@@ -3629,7 +3629,7 @@ class Script(script.Script):
if self.getLinkIndex(event.source, text.caretOffset) >= 0:
voice = self.voices[settings.HYPERLINK_VOICE]
- elif character.isupper():
+ elif character.decode("UTF-8").isupper():
voice = self.voices[settings.UPPERCASE_VOICE]
else:
voice = self.voices[settings.DEFAULT_VOICE]
@@ -3754,7 +3754,7 @@ class Script(script.Script):
and len(text.decode("UTF-8")) == 1)
if speakThis:
- if text.isupper():
+ if text.decode("UTF-8").isupper():
speech.speak(text, self.voices[settings.UPPERCASE_VOICE])
else:
speech.speak(text)
@@ -5310,7 +5310,8 @@ class Script(script.Script):
# user has navigated to a line with only whitespace on it.
#
speech.speak(_("white space"))
- elif lineString.isupper() and (speechType < 2 or speechType > 3):
+ elif lineString.decode("UTF-8").isupper() \
+ and (speechType < 2 or speechType > 3):
speech.speak(lineString, self.voices[settings.UPPERCASE_VOICE])
elif speechType == 2:
self.spellCurrentItem(lineString)
@@ -5473,7 +5474,7 @@ class Script(script.Script):
# user has navigated to a line with only whitespace on it.
#
speech.speak(_("white space"))
- elif wordString.isupper() and speechType == 1:
+ elif wordString.decode("UTF-8").isupper() and speechType == 1:
speech.speak(wordString,
self.voices[settings.UPPERCASE_VOICE])
elif speechType == 2:
@@ -6619,7 +6620,7 @@ class Script(script.Script):
offset = endOffset
lineString = self.adjustForRepeats(lineString)
- if lineString.isupper():
+ if lineString.decode("UTF-8").isupper():
voice = settings.voices[settings.UPPERCASE_VOICE]
else:
voice = settings.voices[settings.DEFAULT_VOICE]
diff --git a/src/orca/gnomespeechfactory.py b/src/orca/gnomespeechfactory.py
index cfce6d5..6e07753 100644
--- a/src/orca/gnomespeechfactory.py
+++ b/src/orca/gnomespeechfactory.py
@@ -978,7 +978,7 @@ class SpeechServer(speechserver.SpeechServer):
if self.__sayAll:
self.stop()
- if not acss and text and text.isupper():
+ if not acss and text and text.decode("UTF-8").isupper():
try:
acss = \
orca_state.activeScript.voices[settings.UPPERCASE_VOICE]
diff --git a/src/orca/scripts/apps/acroread.py b/src/orca/scripts/apps/acroread.py
index e52faa5..617e852 100644
--- a/src/orca/scripts/apps/acroread.py
+++ b/src/orca/scripts/apps/acroread.py
@@ -687,7 +687,7 @@ class Script(default.Script):
if self.getLinkIndex(obj, offset) >= 0:
voice = self.voices[settings.HYPERLINK_VOICE]
- elif word.isupper():
+ elif word.decode("UTF-8").isupper():
voice = self.voices[settings.UPPERCASE_VOICE]
else:
voice = self.voices[settings.DEFAULT_VOICE]
diff --git a/src/orca/scripts/apps/evolution/script.py b/src/orca/scripts/apps/evolution/script.py
index 625f7d2..22582f1 100644
--- a/src/orca/scripts/apps/evolution/script.py
+++ b/src/orca/scripts/apps/evolution/script.py
@@ -577,7 +577,7 @@ class Script(default.Script):
if mode == pyatspi.TEXT_BOUNDARY_LINE_START or \
len(mystr) == 0 or mystr[len(mystr)-1] in '.?!':
string = self.adjustForRepeats(string)
- if string.isupper():
+ if string.decode("UTF-8").isupper():
voice = settings.voices[settings.UPPERCASE_VOICE]
else:
voice = settings.voices[settings.DEFAULT_VOICE]
@@ -606,7 +606,7 @@ class Script(default.Script):
#
if len(string) != 0:
string = self.adjustForRepeats(string)
- if string.isupper():
+ if string.decode("UTF-8").isupper():
voice = settings.voices[settings.UPPERCASE_VOICE]
else:
voice = settings.voices[settings.DEFAULT_VOICE]
diff --git a/src/orca/scripts/apps/gedit/script.py b/src/orca/scripts/apps/gedit/script.py
index aff35e7..6f21a43 100644
--- a/src/orca/scripts/apps/gedit/script.py
+++ b/src/orca/scripts/apps/gedit/script.py
@@ -150,7 +150,7 @@ class Script(default.Script):
if mode == pyatspi.TEXT_BOUNDARY_LINE_START or \
len(mystr) == 0 or mystr[len(mystr)-1] in '.?!':
string = self.adjustForRepeats(string)
- if string.isupper():
+ if string.decode("UTF-8").isupper():
voice = settings.voices[settings.UPPERCASE_VOICE]
else:
voice = settings.voices[settings.DEFAULT_VOICE]
@@ -188,7 +188,7 @@ class Script(default.Script):
#
if len(string) != 0:
string = self.adjustForRepeats(string)
- if string.isupper():
+ if string.decode("UTF-8").isupper():
voice = settings.voices[settings.UPPERCASE_VOICE]
else:
voice = settings.voices[settings.DEFAULT_VOICE]
diff --git a/src/orca/scripts/apps/gnome-terminal.py b/src/orca/scripts/apps/gnome-terminal.py
index 05d398c..2e09762 100644
--- a/src/orca/scripts/apps/gnome-terminal.py
+++ b/src/orca/scripts/apps/gnome-terminal.py
@@ -273,7 +273,7 @@ class Script(default.Script):
and len(text.decode("UTF-8")) == 1)
if speakThis:
- if text.isupper():
+ if text.decode("UTF-8").isupper():
speech.speak(text, self.voices[settings.UPPERCASE_VOICE])
else:
speech.speak(text)
diff --git a/src/orca/scripts/apps/pidgin/script.py b/src/orca/scripts/apps/pidgin/script.py
index 7ea82dd..6ee7756 100644
--- a/src/orca/scripts/apps/pidgin/script.py
+++ b/src/orca/scripts/apps/pidgin/script.py
@@ -805,7 +805,7 @@ class Script(default.Script):
# it's not selected.
#
text = event.any_data
- if text.isupper():
+ if text.decode("UTF-8").isupper():
speech.speak(text, self.voices[settings.UPPERCASE_VOICE])
else:
speech.speak(text)
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index 96fd9e5..1ab722b 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -1286,7 +1286,7 @@ class Script(default.Script):
if self.getLinkIndex(obj, i) >= 0:
voice = voices[settings.HYPERLINK_VOICE]
break
- elif word.isupper():
+ elif word.decode("UTF-8").isupper():
voice = voices[settings.UPPERCASE_VOICE]
else:
voice = voices[settings.DEFAULT_VOICE]
@@ -2309,7 +2309,7 @@ class Script(default.Script):
if isinstance(orca_state.lastInputEvent,
input_event.MouseButtonEvent) and \
orca_state.lastInputEvent.button == "2":
- if text.isupper():
+ if text.decode("UTF-8").isupper():
speech.speak(text, self.voices[settings.UPPERCASE_VOICE])
else:
speech.speak(text)
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 5f9c7c9..13d5896 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -5632,7 +5632,8 @@ class Script(default.Script):
if obj.getRole() == pyatspi.ROLE_LINK:
acss = self.voices[settings.HYPERLINK_VOICE]
elif string and isinstance(string, basestring) \
- and string.isupper() and string.strip().isalpha():
+ and string.decode("UTF-8").isupper() \
+ and string.decode("UTF-8").strip().isalpha():
acss = self.voices[settings.UPPERCASE_VOICE]
else:
acss = self.voices[settings.DEFAULT_VOICE]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]