[orca] Provisional work on bgo#585417 - Allow pauses to be inserted in speech output



commit 3b29c7b7ba00e2733d20dd9490d30feabc88a9cd
Author: Willie Walker <william walker sun com>
Date:   Fri Jul 10 15:26:23 2009 -0400

    Provisional work on bgo#585417 - Allow pauses to be inserted in speech output
    
    This provides code that will modify the speech formatting strings if
    orca.settings.useExperimentalSpeechProsody is True (the default value is
    False).  This allows our users to experiment with the prosody work
    Hammer Attila has done before we finally commit to it.

 src/orca/formatting.py                        |   61 +++++++++++++++++++++++++
 src/orca/scripts/apps/soffice/formatting.py   |   14 ++++++
 src/orca/scripts/toolkits/Gecko/formatting.py |    8 +++-
 src/orca/settings.py                          |    6 +++
 4 files changed, 88 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 9b6791e..40f633e 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -512,6 +512,67 @@ formatting = {
     }
 }
 
+if settings.useExperimentalSpeechProsody:
+    print "Adding pauses to default speech formatting strings."
+    formatting['speech'][pyatspi.ROLE_CHECK_MENU_ITEM]['basicWhereAmI'] = \
+        'ancestors + pause + labelAndName + roleName + checkedState + pause + accelerator + pause + positionInList + ' + MNEMONIC
+    formatting['speech'][pyatspi.ROLE_COMBO_BOX]['basicWhereAmI'] = \
+        'label + roleName + pause + name + positionInList + ' + MNEMONIC + ' + accelerator'
+    formatting['speech'][pyatspi.ROLE_HEADING]['basicWhereAmI'] = \
+        'label + readOnly + textRole + pause + textContent + anyTextSelection + ' + MNEMONIC
+    formatting['speech'][pyatspi.ROLE_HEADING]['detailedWhereAmI'] = \
+        'label + readOnly + textRole + pause +textContentWithAttributes + anyTextSelection + ' + MNEMONIC + ' + ' + TUTORIAL
+    formatting['speech'][pyatspi.ROLE_ICON]['basicWhereAmI'] = \
+        'parentRoleName + pause + labelAndName + pause + selectedItemCount + pause'
+    formatting['speech'][pyatspi.ROLE_ICON]['detailedWhereAmI'] = \
+        'parentRoleName + pause + labelAndName + pause + selectedItemCount + pause + selectedItems + pause'
+    formatting['speech'][pyatspi.ROLE_LAYERED_PANE]['basicWhereAmI'] = \
+        'labelAndName + pause+ roleName + pause + selectedItemCount + pause'
+    formatting['speech'][pyatspi.ROLE_LAYERED_PANE]['detailedWhereAmI'] = \
+        'labelAndName + pause + roleName + pause + selectedItemCount + pause+ selectedItems + pause'
+    formatting['speech'][pyatspi.ROLE_LINK]['basicWhereAmI'] = \
+        'linkInfo + pause + siteDescription + pause + fileSize'
+    formatting['speech'][pyatspi.ROLE_LIST_ITEM]['unfocused'] = \
+        'labelAndName + allTextSelection + pause + expandableState + pause + availability'
+    formatting['speech'][pyatspi.ROLE_LIST_ITEM]['basicWhereAmI'] = \
+        'label + roleName + pause + name + pause + positionInList + pause + expandableState + (nodeLevel or nestingLevel) + pause'
+    formatting['speech'][pyatspi.ROLE_MENU]['basicWhereAmI'] = \
+        '(ancestors or parentRoleName) + pause + labelAndName + roleName + pause +  positionInList + ' + MNEMONIC
+    formatting['speech'][pyatspi.ROLE_MENU_ITEM]['basicWhereAmI'] = \
+        'ancestors + pause + labelAndName + pause + accelerator + pause + positionInList + ' + MNEMONIC
+    formatting['speech'][pyatspi.ROLE_PAGE_TAB]['basicWhereAmI'] = \
+        'parentRoleName + pause + labelAndName + roleName + pause + positionInList + ' + MNEMONIC + ' + accelerator'
+    formatting['speech'][pyatspi.ROLE_RADIO_BUTTON]['unfocused'] = \
+        'labelAndName + pause + radioState + roleName + availability + lineBreak + ' + MNEMONIC + ' + accelerator + pause'
+    formatting['speech'][pyatspi.ROLE_RADIO_BUTTON]['basicWhereAmI'] = \
+        'radioButtonGroup + pause + labelAndName + roleName + pause + radioState + pause + positionInGroup + ' + MNEMONIC + ' + accelerator'
+    formatting['speech'][pyatspi.ROLE_TABLE]['focused'] = \
+        'labelAndName + pause + allTextSelection + roleName + availability + noChildren'
+    formatting['speech'][pyatspi.ROLE_TABLE]['unfocused'] = \
+        'labelAndName + pause + allTextSelection + roleName + availability + noChildren'
+    formatting['speech'][pyatspi.ROLE_TABLE]['basicWhereAmI'] = \
+        'labelAndName + pause + allTextSelection + roleName + availability + noChildren'
+    formatting['speech'][pyatspi.ROLE_TABLE_CELL]['focused'] = \
+        '((tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState) + pause + (expandableState and (expandableState + pause + numberOfChildren + pause))'
+    formatting['speech'][pyatspi.ROLE_TABLE_CELL]['unfocused'] = \
+        'tableCellRow + pause'
+    formatting['speech'][pyatspi.ROLE_TABLE_CELL]['basicWhereAmI'] = \
+        'parentRoleName + pause + columnHeader + pause + rowHeader + pause + roleName + pause + cellCheckedState + pause + (realActiveDescendantDisplayedText or imageDescription + image) + pause + columnAndRow + pause + expandableState + pause + nodeLevel + pause'
+    formatting['speech'][pyatspi.ROLE_TABLE_CELL]['detailedWhereAmI'] = \
+        'parentRoleName + pause + columnHeader + pause + rowHeader + pause + roleName + pause + cellCheckedState + pause + (realActiveDescendantDisplayedText or imageDescription + image) + pause + columnAndRow + pause + tableCellRow + pause + expandableState + pause + nodeLevel + pause'
+    formatting['speech'][pyatspi.ROLE_TERMINAL]['basicWhereAmI'] = \
+        'label + readOnly + pause + textRole + pause + textContent + anyTextSelection + ' + MNEMONIC
+    formatting['speech'][pyatspi.ROLE_TERMINAL]['detailedWhereAmI'] = \
+        'label + readOnly + pause + textRole + pause + textContentWithAttributes + anyTextSelection + ' + MNEMONIC + ' + ' + TUTORIAL
+    formatting['speech'][pyatspi.ROLE_TEXT]['focused'] = \
+        'labelOrName + readOnly + textRole + pause + currentLineText + allTextSelection',
+    formatting['speech'][pyatspi.ROLE_TEXT]['unfocused'] = \
+        'labelOrName + readOnly + textRole + pause + currentLineText + allTextSelection + ' + MNEMONIC
+    formatting['speech'][pyatspi.ROLE_TEXT]['basicWhereAmI'] = \
+        'label + readOnly + textRole + pause + textContent + anyTextSelection + pause + ' + MNEMONIC
+    formatting['speech'][pyatspi.ROLE_TEXT]['detailedWhereAmI'] = \
+        'label + readOnly + textRole + pause + textContentWithAttributes + anyTextSelection + pause + ' + MNEMONIC + ' + ' + TUTORIAL
+
 class Formatting(dict):
 
     def __init__(self, script):
diff --git a/src/orca/scripts/apps/soffice/formatting.py b/src/orca/scripts/apps/soffice/formatting.py
index 4fffc2c..da4e32a 100644
--- a/src/orca/scripts/apps/soffice/formatting.py
+++ b/src/orca/scripts/apps/soffice/formatting.py
@@ -32,6 +32,7 @@ import copy
 import pyatspi
 
 import orca.formatting
+import orca.settings
 
 formatting = {
     'speech': {
@@ -81,6 +82,19 @@ formatting = {
     }
 }
 
+if orca.settings.useExperimentalSpeechProsody:
+    print "Adding pauses to soffice speech formatting strings."
+    formatting['speech']['ROLE_SPREADSHEET_CELL']['basicWhereAmI'] = \
+        'roleName + pause + column + pause + columnHeader + pause + row + pause + rowHeader + pause + (textContent or spreadSheetCell) + pause + anyTextSelection + pause'
+    formatting['speech'][pyatspi.ROLE_TABLE_CELL]['focused'] = \
+        '((tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState) + pause + (expandableState and (expandableState + pause + numberOfChildren + pause))'
+    formatting['speech'][pyatspi.ROLE_TABLE_CELL]['unfocused'] = \
+        'endOfTableIndicator + pause + tableCellRow + pause'
+    formatting['speech'][pyatspi.ROLE_TABLE_CELL]['basicWhereAmI'] = \
+        'parentRoleName + pause + columnHeader + pause + rowHeader + pause + roleName + pause + cellCheckedState + pause + (realActiveDescendantDisplayedText or imageDescription + image) + pause + columnAndRow + pause + expandableState + pause + nodeLevel + pause'
+    formatting['speech'][pyatspi.ROLE_TABLE_CELL]['detailedWhereAmI'] = \
+        'parentRoleName + pause + columnHeader + pause + rowHeader + pause + roleName + pause + cellCheckedState + pause + (realActiveDescendantDisplayedText or imageDescription + image) + pause + columnAndRow + pause + tableCellRow + pause + expandableState + pause + nodeLevel + pause'
+
 class Formatting(orca.formatting.Formatting):
     def __init__(self, script):
         orca.formatting.Formatting.__init__(self, script)
diff --git a/src/orca/scripts/toolkits/Gecko/formatting.py b/src/orca/scripts/toolkits/Gecko/formatting.py
index a043bc4..bb0d6ff 100644
--- a/src/orca/scripts/toolkits/Gecko/formatting.py
+++ b/src/orca/scripts/toolkits/Gecko/formatting.py
@@ -1,6 +1,6 @@
 # Orca
 #
-# Copyright 2006-2009 Sun Microsystems Inc.
+# Copyright 2005-2009 Sun Microsystems Inc.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -30,6 +30,7 @@ import copy
 import pyatspi
 
 import orca.formatting
+import orca.settings
 
 # pylint: disable-msg=C0301
 
@@ -136,6 +137,11 @@ formatting = {
     }
 }
 
+if orca.settings.useExperimentalSpeechProsody:
+    print "Adding pauses to Gecko speech formatting strings."
+    formatting['speech'][pyatspi.ROLE_LIST]['unfocused'] = \
+        'labelOrName + pause + focusedItem + pause + multiselectableState + numberOfChildren + pause'
+
 class Formatting(orca.formatting.Formatting):
 
     # pylint: disable-msg=W0142
diff --git a/src/orca/settings.py b/src/orca/settings.py
index f930902..6d7be4d 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -1335,3 +1335,9 @@ brailleNestingLevelString = _("LEVEL %d")
 # String for delimiters between table cells
 #
 brailleTableCellDelimiter = " "
+
+# This is for bug #585417 - Allow pauses to be inserted into speech
+# output. We're keeping it separate for now until we get the pauses
+# sorted out just right.
+#
+useExperimentalSpeechProsody = False



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]