[orca] Minor tweaks to test the new Java ATK Wrapper



commit 28bac8a920e677731579f644ff054c477b06934c
Author: Willie Walker <william walker sun com>
Date:   Thu Jun 11 16:35:48 2009 -0400

    Minor tweaks to test the new Java ATK Wrapper

 src/orca/default.py                                |    5 ++-
 .../scripts/toolkits/J2SE-access-bridge/script.py  |   25 +++++++++++++++----
 2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/src/orca/default.py b/src/orca/default.py
index cc79631..a557a42 100644
--- a/src/orca/default.py
+++ b/src/orca/default.py
@@ -3075,7 +3075,8 @@ class Script(script.Script):
         #
         if obj.getRole() == pyatspi.ROLE_RADIO_BUTTON:
             if orca_state.lastNonModifierKeyEvent \
-               and orca_state.lastNonModifierKeyEvent.event_string == "space":
+               and orca_state.lastNonModifierKeyEvent.event_string \
+                   in [" ", "space"]:
                 pass
             else:
                 return
@@ -4061,7 +4062,7 @@ class Script(script.Script):
         # containing object.
         #
         elif (event.source != orca_state.locusOfFocus) and \
-            event.source.getState().contains(pyatspi.STATE_FOCUSED):
+              event.source.getState().contains(pyatspi.STATE_FOCUSED):
             newFocus = event.source
             if event.source.childCount:
                 selection = event.source.querySelection()
diff --git a/src/orca/scripts/toolkits/J2SE-access-bridge/script.py b/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
index e41d374..59d6c21 100644
--- a/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
+++ b/src/orca/scripts/toolkits/J2SE-access-bridge/script.py
@@ -210,13 +210,26 @@ class Script(default.Script):
         - event: the Event
         """
 
-        # Ignore selection in TREE and TABLE objects since they send us
-        # an active descendant changed event.
+        # We treat selected children as the locus of focus. When the
+        # selection changes in a list we want to update the locus of
+        # focus. If there is no selection, we default the locus of
+        # focus to the containing object.
         #
-        if event.source.getRole() in [pyatspi.ROLE_TREE, pyatspi.ROLE_TABLE]:
-            return
-
-        default.Script.onSelectionChanged(self, event)
+        if (event.source.getRole() in [pyatspi.ROLE_LIST,
+                                       pyatspi.ROLE_PAGE_TAB_LIST,
+                                       pyatspi.ROLE_TREE]) \
+            and event.source.getState().contains(pyatspi.STATE_FOCUSED):
+            newFocus = event.source
+            print "MONKEY", event.source.childCount
+            if event.source.childCount:
+                selection = event.source.querySelection()
+                print "MONKEY2", selection.nSelectedChildren
+                if selection.nSelectedChildren > 0:
+                    newFocus = selection.getSelectedChild(0)
+            orca.setLocusOfFocus(event, newFocus)
+            print "FAH", newFocus
+        else:
+            default.Script.onSelectionChanged(self, event)
 
     def onStateChanged(self, event):
         """Called whenever an object's state changes.



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