[orca] Create a dedicated object:state-changed callback for the "active" state



commit 06873a33bdb679d6c12c0b2308fe6d840ac272c6
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Nov 4 15:39:27 2013 -0500

    Create a dedicated object:state-changed callback for the "active" state

 src/orca/scripts/apps/soffice/script.py |   17 ++++++++++-------
 src/orca/scripts/default.py             |   17 ++++++++---------
 2 files changed, 18 insertions(+), 16 deletions(-)
---
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index 1a5f642..0a73e35 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -824,6 +824,16 @@ class Script(default.Script):
 
         default.Script.onNameChanged(self, event)
 
+    def onActiveChanged(self, event):
+        """Callback for object:state-changed:active accessibility events."""
+
+        # Prevent this events from activating the find operation.
+        # See comment #18 of bug #354463.
+        if self.findCommandRun:
+            return
+ 
+        default.Script.onActiveChanged(self, event)
+
     def onActiveDescendantChanged(self, event):
         """Called when an object who manages its own descendants detects a
         change in one of its children.
@@ -902,13 +912,6 @@ class Script(default.Script):
             if parent.getRoleName() == 'text frame':
                 return
 
-        # Prevent  "object:state-changed:active" events from activating
-        # the find operation. See comment #18 of bug #354463.
-        #
-        if event.type.startswith("object:state-changed:active"):
-            if self.findCommandRun:
-                return
-
         # Announce when the toolbar buttons are toggled if we just toggled
         # them; not if we navigated to some text.
         #
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 4ba5aac..f284580 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -528,7 +528,7 @@ class Script(script.Script):
         listeners["object:children-changed"]                = \
             self.onChildrenChanged
         listeners["object:state-changed:active"]            = \
-            self.onStateChanged
+            self.onActiveChanged
         listeners["object:state-changed:busy"]              = \
             self.onBusyChanged
         listeners["object:state-changed:focused"]           = \
@@ -2230,6 +2230,13 @@ class Script(script.Script):
         """
         pass
 
+    def onActiveChanged(self, event):
+        """Callback for object:state-changed:active accessibility events."""
+
+        if self.findCommandRun:
+            self.findCommandRun = False
+            self.find()
+
     def onActiveDescendantChanged(self, event):
         """Called when an object who manages its own descendants detects a
         change in one of its children.
@@ -2533,14 +2540,6 @@ class Script(script.Script):
         - event: the Event
         """
 
-        # Do we care?
-        #
-        if event.type.startswith("object:state-changed:active"):
-            if self.findCommandRun:
-                self.findCommandRun = False
-                self.find()
-                return
-
         if event.type.startswith("object:state-changed:selected") \
            and not _settingsManager.getSetting('onlySpeakDisplayedText') \
            and orca_state.locusOfFocus:


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