[orca] Add the ability to skip ancestor generation by role on a per-script basis



commit 4ea7feb89b055c4e9890f528febba70f7f7bcb77
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Jan 16 11:46:35 2014 -0500

    Add the ability to skip ancestor generation by role on a per-script basis

 .../scripts/toolkits/Gecko/speech_generator.py     |    2 ++
 .../scripts/toolkits/WebKitGtk/speech_generator.py |    2 ++
 src/orca/speech_generator.py                       |    4 +++-
 3 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/speech_generator.py 
b/src/orca/scripts/toolkits/Gecko/speech_generator.py
index ab5fda5..b055415 100644
--- a/src/orca/scripts/toolkits/Gecko/speech_generator.py
+++ b/src/orca/scripts/toolkits/Gecko/speech_generator.py
@@ -302,6 +302,8 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
                                pyatspi.ROLE_FORM,
                                pyatspi.ROLE_MENU_BAR,
                                pyatspi.ROLE_TOOL_BAR]
+        args['skipRoles'] = [pyatspi.ROLE_PARAGRAPH,
+                             pyatspi.ROLE_TEXT]
 
         return speech_generator.SpeechGenerator._generateAncestors(
             self, obj, **args)
diff --git a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py 
b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
index 17d681a..02dea0e 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
@@ -159,6 +159,8 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
                                pyatspi.ROLE_FORM,
                                pyatspi.ROLE_MENU_BAR,
                                pyatspi.ROLE_TOOL_BAR]
+        args['skipRoles'] = [pyatspi.ROLE_PARAGRAPH,
+                             pyatspi.ROLE_TEXT]
 
         return speech_generator.SpeechGenerator._generateAncestors(
             self, obj, **args)
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 8fbd0bd..871a241 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1485,6 +1485,7 @@ class SpeechGenerator(generator.Generator):
             if role == pyatspi.ROLE_COMBO_BOX:
                 return []
 
+        skipRoles = args.get('skipRoles', [])
         stopAtRoles = args.get('stopAtRoles', [])
         stopAtRoles.append(pyatspi.ROLE_APPLICATION)
         if obj != commonAncestor:
@@ -1493,7 +1494,8 @@ class SpeechGenerator(generator.Generator):
                 parentRole = parent.getRole()
                 if parentRole in stopAtRoles:
                     break
-                if not self._script.utilities.isLayoutOnly(parent):
+                if parentRole not in skipRoles \
+                   and not self._script.utilities.isLayoutOnly(parent):
                     result.append(self.generate(parent))
                 parent = parent.parent
         result.reverse()


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