[orca] Apply voice when generating current line of text
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Apply voice when generating current line of text
- Date: Sun, 6 Dec 2015 17:02:47 +0000 (UTC)
commit 137994ad6778b830e13c60f03f4e7d1d84e97190
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sun Dec 6 18:01:46 2015 +0100
Apply voice when generating current line of text
src/orca/scripts/apps/soffice/speech_generator.py | 8 +++++-
src/orca/scripts/default.py | 26 ++++++++-------------
src/orca/speech_generator.py | 8 +++++-
3 files changed, 23 insertions(+), 19 deletions(-)
---
diff --git a/src/orca/scripts/apps/soffice/speech_generator.py
b/src/orca/scripts/apps/soffice/speech_generator.py
index e176ef8..677548b 100644
--- a/src/orca/scripts/apps/soffice/speech_generator.py
+++ b/src/orca/scripts/apps/soffice/speech_generator.py
@@ -218,12 +218,16 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
# together in the scripts. In addition, the voice crap needs to go
# here. Then it needs to be removed from the scripts.
[text, caretOffset, startOffset] = self._script.getTextLineAtCaret(obj)
+ voice = self.voice(string=text)
text = self._script.utilities.adjustForLinks(obj, text, startOffset)
text = self._script.utilities.adjustForRepeats(text)
if not text:
- text = [messages.BLANK]
+ result = [messages.BLANK]
+ else:
+ result = [text]
+ result.extend(voice)
- return [text]
+ return result
def _generateToggleState(self, obj, **args):
"""Treat toggle buttons in the toolbar specially. This is so we can
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index e354852..446fa39 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -3366,22 +3366,18 @@ class Script(script.Script):
interface
"""
- # Get the AccessibleText interface of the provided object
- #
[line, caretOffset, startOffset] = self.getTextLineAtCaret(obj)
if len(line) and line != "\n":
- if line.isupper():
- voice = self.voices[settings.UPPERCASE_VOICE]
- else:
- voice = self.voices[settings.DEFAULT_VOICE]
-
- result = \
- self.speechGenerator.generateTextIndentation(obj, line=line)
+ result = self.speechGenerator.generateTextIndentation(obj, line=line)
if result:
self.speakMessage(result[0])
+
+ voice = self.speechGenerator.voice(string=line)
line = self.utilities.adjustForLinks(obj, line, startOffset)
line = self.utilities.adjustForRepeats(line)
- speech.speak(line, voice)
+ utterance = [line]
+ utterance.extend(voice)
+ speech.speak(utterance)
else:
# Speak blank line if appropriate.
#
@@ -3403,13 +3399,11 @@ class Script(script.Script):
return
if len(phrase) > 1 or phrase.isalnum():
- if phrase.isupper():
- voice = self.voices[settings.UPPERCASE_VOICE]
- else:
- voice = self.voices[settings.DEFAULT_VOICE]
-
+ voice = self.speechGenerator.voice(string=phrase)
phrase = self.utilities.adjustForRepeats(phrase)
- speech.speak(phrase, voice)
+ utterance = [phrase]
+ utterance.extend(voice)
+ speech.speak(utterance)
else:
self.sayCharacter(obj)
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 66b450d..5e5e630 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -2328,4 +2328,10 @@ class SpeechGenerator(generator.Generator):
if not rv or rv.get('established') == False:
rv = voices.get(voiceType.get(DEFAULT))
- return [acss.ACSS(rv)]
+ voice = acss.ACSS(rv)
+ if key in [None, DEFAULT]:
+ string = args.get('string', '')
+ if string.isupper():
+ voice.update(voices.get(voiceType.get(UPPERCASE)))
+
+ return [voice]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]