[orca] Add handling for ROLE_LIST_BOX to the generators



commit 8bb028bb540dd6b1ffe431f7d67d8795022b08aa
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Aug 5 11:12:57 2014 -0400

    Add handling for ROLE_LIST_BOX to the generators

 src/orca/braille_generator.py                      |    2 +-
 src/orca/formatting.py                             |   11 +++++++++++
 .../scripts/toolkits/Gecko/script_utilities.py     |    1 +
 src/orca/speech_generator.py                       |    2 +-
 4 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 145f159..4e1333c 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -303,7 +303,7 @@ class BrailleGenerator(generator.Generator):
     def _generateFocusedItem(self, obj, **args):
         result = []
         role = args.get('role', obj.getRole())
-        if role != pyatspi.ROLE_LIST:
+        if role not in [pyatspi.ROLE_LIST, pyatspi.ROLE_LIST_BOX]:
             return result
 
         try:
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 85a6500..82b126a 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -192,6 +192,10 @@ formatting = {
             'focused': 'labelOrName + multiselectableState + numberOfChildren',
             'unfocused': 'labelOrName + focusedItem + multiselectableState + numberOfChildren'
             },
+        pyatspi.ROLE_LIST_BOX: {
+            'focused': 'labelOrName + multiselectableState + numberOfChildren',
+            'unfocused': 'labelOrName + focusedItem + multiselectableState + numberOfChildren'
+            },
         pyatspi.ROLE_LIST_ITEM: {
             'focused': 'expandableState + availability',
             'unfocused': 'labelAndName + allTextSelection + expandableState + availability + positionInList 
+ childWidget',
@@ -460,6 +464,11 @@ formatting = {
                                      asString(label + focusedItem + roleName),\
                                      asString(label) and (len(asString(label)) + 1) or 0)]'
         },
+        pyatspi.ROLE_LIST_BOX: {
+            'unfocused': '[Component(obj,\
+                                     asString(label + focusedItem + roleName),\
+                                     asString(label) and (len(asString(label)) + 1) or 0)]'
+        },
         pyatspi.ROLE_LIST_ITEM: {
             'focused':   '[Component(obj,\
                                      asString(label + displayedText + expandableState + roleName + 
availability) + asString(accelerator))]\
@@ -612,6 +621,8 @@ if settings.useExperimentalSpeechProsody:
         'linkInfo + pause + siteDescription + pause + fileSize + pause + ' + MNEMONIC
     formatting['speech'][pyatspi.ROLE_LIST]['unfocused'] = \
         'labelOrName + pause + focusedItem + pause + multiselectableState + numberOfChildren + pause'
+    formatting['speech'][pyatspi.ROLE_LIST_BOX]['unfocused'] = \
+        'labelOrName + pause + focusedItem + pause + multiselectableState + numberOfChildren + pause'
     formatting['speech'][pyatspi.ROLE_LIST_ITEM]['unfocused'] = \
         'labelAndName + allTextSelection + pause + expandableState + pause + availability + positionInList + 
pause + childWidget'
     formatting['speech'][pyatspi.ROLE_LIST_ITEM]['basicWhereAmI'] = \
diff --git a/src/orca/scripts/toolkits/Gecko/script_utilities.py 
b/src/orca/scripts/toolkits/Gecko/script_utilities.py
index 6c61050..4ad5528 100644
--- a/src/orca/scripts/toolkits/Gecko/script_utilities.py
+++ b/src/orca/scripts/toolkits/Gecko/script_utilities.py
@@ -136,6 +136,7 @@ class Utilities(script_utilities.Utilities):
             bogus = False
             if self._script.inDocumentContent() \
                and obj.getRole() in [pyatspi.ROLE_COMBO_BOX,
+                                     pyatspi.ROLE_LIST_BOX,
                                      pyatspi.ROLE_LIST]:
                 # Bogus case #1:
                 # <label></label> surrounding the entire combo box/list which
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index a72c314..179590d 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1372,7 +1372,7 @@ class SpeechGenerator(generator.Generator):
     def _generateFocusedItem(self, obj, **args):
         result = []
         role = args.get('role', obj.getRole())
-        if role != pyatspi.ROLE_LIST:
+        if role not in [pyatspi.ROLE_LIST, pyatspi.ROLE_LIST_BOX]:
             return result
 
         try:


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