[orca/570658] associating funcs with acss
- From: Mesar Hameed <mhameed src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca/570658] associating funcs with acss
- Date: Tue, 12 May 2009 14:56:43 -0400 (EDT)
commit c78f7695f27c574a8caf23188adb4ed0eef533ae
Author: Mesar Hameed <mhameed src gnome org>
Date: Tue May 12 19:54:12 2009 +0100
associating funcs with acss
---
src/orca/formatting.py | 12 ++++++++++++
src/orca/speech.py | 28 ++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 15e42b4..ddc76f8 100755
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -30,6 +30,10 @@ import pyatspi
# pylint: disable-msg=C0301
defaultFormatting = {
+ 'voices': {
+ 'default': ACSS({}),
+ 'name' : ACSS({ACSS.AVERAGE_PITCH : 5.6}),
+ },
'speech': {
'default': {
'focused': '',
@@ -187,3 +191,11 @@ class Formatting(dict):
else:
format = roleDict['unfocused']
return format
+
+ def getVoice(self, **args):
+ role = args.get('role',None)
+ if self['voices'].has_key(role):
+ voice = self['voice'][role]
+ else:
+ voice = self['voice']['default']
+ return voice
diff --git a/src/orca/speech.py b/src/orca/speech.py
old mode 100644
new mode 100755
index 53ffd92..5d84981
--- a/src/orca/speech.py
+++ b/src/orca/speech.py
@@ -137,6 +137,34 @@ def sayAll(utteranceIterator, progressCallback):
debug.println(debug.LEVEL_INFO, logLine)
log.info(logLine)
+def altspeak(textArray, interrupt=True):
+ """Speaks all queued text immediately. If text is not None,
+ it is added to the queue before speaking.
+
+ Arguments:
+ - textArray: optional text to add to the queue before speaking
+ - interrupt: if True, stops any speech in progress before
+ speaking the text
+ """
+
+ # We will not interrupt a key echo in progress.
+ #
+ if orca_state.lastKeyEchoTime:
+ interrupt = interrupt \
+ and ((time.time() - orca_state.lastKeyEchoTime) > 0.5)
+
+ if settings.silenceSpeech:
+ return
+
+ acss = textArray[0]
+ for (i=1; i<len(textArray); i++):
+ element = textArray[i]
+ if isinstance(element,basestring):
+ if _speechserver:
+ _speechserver.speak(element, __resolveACSS(acss), interrupt)
+ else:
+ altspeak(element, interrupt=True):
+
def speak(text, acss=None, interrupt=True):
"""Speaks all queued text immediately. If text is not None,
it is added to the queue before speaking.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]