[orca] Add event handler for object:state-changed:active events to web script



commit 7a069ef4e092c4c882143b14ae4a5d77b73e8368
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Aug 28 17:27:59 2015 -0400

    Add event handler for object:state-changed:active events to web script

 src/orca/scripts/toolkits/Gecko/script.py |   13 ++++---------
 src/orca/scripts/web/script.py            |   22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index b50a051..abc7a67 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -68,17 +68,12 @@ class Script(web.Script):
     def onActiveChanged(self, event):
         """Callback for object:state-changed:active accessibility events."""
 
-        if self.findCommandRun:
-            self.findCommandRun = False
-            self.find()
+        if super().onActiveChanged(event):
             return
 
-        if not event.detail1:
-            return
-
-        role = event.source.getRole()
-        if role in [pyatspi.ROLE_DIALOG, pyatspi.ROLE_ALERT]:
-            orca.setLocusOfFocus(event, event.source)
+        msg = "GECKO: Passing along event to default script"
+        debug.println(debug.LEVEL_INFO, msg)
+        default.Script.onActiveChanged(self, event)
 
     def onBusyChanged(self, event):
         """Callback for object:state-changed:busy accessibility events."""
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 9d5e8f0..52569a2 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -988,6 +988,28 @@ class Script(default.Script):
 
         return True
 
+    def onActiveChanged(self, event):
+        """Callback for object:state-changed:active accessibility events."""
+
+        if not self.utilities.inDocumentContent(event.source):
+            msg = "WEB: Event source is not in document content"
+            debug.println(debug.LEVEL_INFO, msg)
+            return False
+
+        if not event.detail1:
+            msg = "WEB: Ignoring because event source is now inactive"
+            debug.println(debug.LEVEL_INFO, msg)
+            return True
+
+        role = event.source.getRole()
+        if role in [pyatspi.ROLE_DIALOG, pyatspi.ROLE_ALERT]:
+            msg = "WEB: Event handled: Setting locusOfFocus to event source"
+            debug.println(debug.LEVEL_INFO, msg)
+            orca.setLocusOfFocus(event, event.source)
+            return True
+
+        return False
+
     def onBusyChanged(self, event):
         """Callback for object:state-changed:busy accessibility events."""
 


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