[orca] Add a default callback for window:create events



commit 21ccb5e307da6fadad850b4942e758ec435b989e
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Nov 9 18:54:13 2013 -0500

    Add a default callback for window:create events

 .../scripts/apps/notification-daemon/script.py     |   17 ++---------------
 src/orca/scripts/default.py                        |    7 ++++++-
 2 files changed, 8 insertions(+), 16 deletions(-)
---
diff --git a/src/orca/scripts/apps/notification-daemon/script.py 
b/src/orca/scripts/apps/notification-daemon/script.py
index 102385d..5c229e0 100644
--- a/src/orca/scripts/apps/notification-daemon/script.py
+++ b/src/orca/scripts/apps/notification-daemon/script.py
@@ -39,23 +39,10 @@ import orca.speech as speech
 ########################################################################
 
 class Script(default.Script):
-    def getListeners(self):
-        """Sets up the AT-SPI event listeners for this script.
-        """
-        listeners = default.Script.getListeners(self)
 
-        listeners["window:create"] = \
-            self.onWindowCreate
+    def onWindowCreated(self, event):
+        """Callback for window:create accessibility events."""
 
-        return listeners
-
-    def onWindowCreate(self, event):
-        """Called whenever a window is created in the notification-daemon
-        application.
-
-        Arguments:
-        - event: the Event.
-        """
         a = self.utilities.descendantsWithRole(event.source, pyatspi.ROLE_LABEL)
         texts = [self.utilities.displayedText(acc) for acc in a]
         text = '%s %s' % (messages.NOTIFICATION, ' '.join(texts))
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index e21eae3..b90ba5b 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -562,7 +562,7 @@ class Script(script.Script):
         listeners["window:deactivate"]                      = \
             self.onWindowDeactivated
         listeners["window:create"]                          = \
-            self.noOp
+            self.onWindowCreated
 
         return listeners
 
@@ -2837,6 +2837,11 @@ class Script(script.Script):
         #
         orca_state.activeWindow = event.source
 
+    def onWindowCreated(self, event):
+        """Callback for window:create accessibility events."""
+
+        pass
+
     def onWindowDeactivated(self, event):
         """Called whenever a toplevel window is deactivated.
 


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