[orca] Fix for bug 666060 - Orca does not always speak guessed form field labels when structural navigation



commit e6edf9aded1d80e106c63357a5842ea77c4b7633
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Dec 14 13:10:44 2011 -0500

    Fix for bug 666060 - Orca does not always speak guessed form field labels when structural navigation is used.

 src/orca/debug.py                 |    5 ++++-
 src/orca/label_inference.py       |    7 ++++++-
 src/orca/structural_navigation.py |   16 +++-------------
 3 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/src/orca/debug.py b/src/orca/debug.py
index dd75aa8..de33686 100644
--- a/src/orca/debug.py
+++ b/src/orca/debug.py
@@ -281,7 +281,10 @@ def getAccessibleDetails(level, acc, indent="", includeApp=True):
     if includeApp:
         app = acc.getApplication()
         if app:
-            string = indent + "app.name='%s' " % app.name
+            try:
+                string = indent + "app.name='%s' " % app.name
+            except LookupError:
+                string = indent + "app.name='<error getting name>' "
         else:
             string = indent + "app=None "
     else:
diff --git a/src/orca/label_inference.py b/src/orca/label_inference.py
index c32d28b..b89fab8 100644
--- a/src/orca/label_inference.py
+++ b/src/orca/label_inference.py
@@ -131,7 +131,12 @@ class LabelInference:
         if not obj:
             return False
 
-        children = [child for child in obj]
+        try:
+            children = [child for child in obj]
+        except LookupError:
+            debug.println(debug.LEVEL_FINE, 'Dead Accessible in %s' % obj)
+            return False
+
         children = filter(lambda x: x.getRole() != pyatspi.ROLE_LINK, children)
         if len(children) > 1:
             return False
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index f609873..d878f36 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -2581,19 +2581,9 @@ class StructuralNavigation:
         """
 
         if obj:
-            if obj.getRole() in [pyatspi.ROLE_LIST, pyatspi.ROLE_COMBO_BOX]:
-                obj.queryComponent().grabFocus()
-            else:
-                # TODO: I think we should just grab focus on the object
-                # regardless of the object type.  But that's not what we
-                # do now, and it causes an extra newline character to show
-                # up in the regression test output for entries, so for the
-                # purpose of passing the regression tests, I'm not making
-                # that change yet.
-                #
-                [obj, characterOffset] = self._getCaretPosition(obj)
-                self._setCaretPosition(obj, characterOffset)
-                self._presentObject(obj, characterOffset)
+            if obj.getRole() == pyatspi.ROLE_TEXT and obj.childCount:
+                obj = obj[0]
+            obj.queryComponent().grabFocus()
         else:
             # Translators: this is for navigating document content by
             # moving from form field to form filed. This is a detailed



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