[orca] Add default callbacks for document: events



commit fc2d98c63d3beb7ea4df3fb0daf889025cac35b3
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Nov 9 19:10:30 2013 -0500

    Add default callbacks for document: events

 src/orca/scripts/default.py                   |   21 +++++++++++++++++++++
 src/orca/scripts/toolkits/Gecko/script.py     |   23 ++++++-----------------
 src/orca/scripts/toolkits/WebKitGtk/script.py |   20 +++-----------------
 3 files changed, 30 insertions(+), 34 deletions(-)
---
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index b90ba5b..fe72b0c 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -511,6 +511,12 @@ class Script(script.Script):
             self.onFocus
         #listeners["keyboard:modifiers"]                     = \
         #    self.noOp
+        listeners["document:reload"]                        = \
+            self.onDocumentReload
+        listeners["document:load-complete"]                 = \
+            self.onDocumentLoadComplete
+        listeners["document:load-stopped"]                  = \
+            self.onDocumentLoadStopped
         listeners["mouse:button"]                           = \
             self.onMouseButton
         listeners["object:property-change:accessible-name"] = \
@@ -2177,6 +2183,21 @@ class Script(script.Script):
 
         self._presentTextAtNewCaretPosition(event)
 
+    def onDocumentReload(self, event):
+        """Callback for document:reload accessibility events."""
+
+        pass
+
+    def onDocumentLoadComplete(self, event):
+        """Callback for document:load-complete accessibility events."""
+
+        pass
+
+    def onDocumentLoadStopped(self, event):
+        """Callback for document:load-stopped accessibility events."""
+
+        pass
+
     def onExpandedChanged(self, event):
         """Callback for object:state-changed:expanded accessibility events."""
 
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 82298cf..afe85e7 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -430,20 +430,6 @@ class Script(default.Script):
                 Script.moveToMouseOver,
                 cmdnames.MOUSE_OVER_MOVE)
 
-    def getListeners(self):
-        """Sets up the AT-SPI event listeners for this script.
-        """
-        listeners = default.Script.getListeners(self)
-
-        listeners["document:reload"]                        = \
-            self.onDocumentReload
-        listeners["document:load-complete"]                 = \
-            self.onDocumentLoadComplete
-        listeners["document:load-stopped"]                  = \
-            self.onDocumentLoadStopped
-
-        return listeners
-
     def __getArrowBindings(self):
         """Returns an instance of keybindings.KeyBindings that use the
         arrow keys for navigating HTML content.
@@ -1257,7 +1243,8 @@ class Script(default.Script):
             speech.speak(utterances)
 
     def onDocumentReload(self, event):
-        """Called when the reload button is hit for a web page."""
+        """Callback for document:reload accessibility events."""
+
         # We care about the main document and we'll ignore document
         # events from HTML iframes.
         #
@@ -1265,7 +1252,8 @@ class Script(default.Script):
             self._loadingDocumentContent = True
 
     def onDocumentLoadComplete(self, event):
-        """Called when a web page load is completed."""
+        """Callback for document:load-complete accessibility events."""
+
         # We care about the main document and we'll ignore document
         # events from HTML iframes.
         #
@@ -1276,7 +1264,8 @@ class Script(default.Script):
             self._loadingDocumentTime = time.time()
 
     def onDocumentLoadStopped(self, event):
-        """Called when a web page load is interrupted."""
+        """Callback for document:load-stopped accessibility events."""
+
         # We care about the main document and we'll ignore document
         # events from HTML iframes.
         #
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index 3f87003..fae72ce 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -74,20 +74,6 @@ class Script(default.Script):
 
         self.sayAllOnLoadCheckButton = None
 
-    def getListeners(self):
-        """Sets up the AT-SPI event listeners for this script."""
-
-        listeners = default.Script.getListeners(self)
-
-        listeners["document:reload"]                        = \
-            self.onDocumentReload
-        listeners["document:load-complete"]                 = \
-            self.onDocumentLoadComplete
-        listeners["document:load-stopped"]                  = \
-            self.onDocumentLoadStopped
-
-        return listeners
-
     def setupInputEventHandlers(self):
         """Defines InputEventHandler fields for this script that can be
         called by the key and braille bindings."""
@@ -225,13 +211,13 @@ class Script(default.Script):
         default.Script.onCaretMoved(self, event)
 
     def onDocumentReload(self, event):
-        """Called when the reload button is hit for a web page."""
+        """Callback for document:reload accessibility events."""
 
         if event.source.getRole() == pyatspi.ROLE_DOCUMENT_FRAME:
             self._loadingDocumentContent = True
 
     def onDocumentLoadComplete(self, event):
-        """Called when a web page load is completed."""
+        """Callback for document:load-complete accessibility events."""
 
         if event.source.getRole() != pyatspi.ROLE_DOCUMENT_FRAME:
             return
@@ -252,7 +238,7 @@ class Script(default.Script):
             self.sayAll(None)
 
     def onDocumentLoadStopped(self, event):
-        """Called when a web page load is interrupted."""
+        """Callback for document:load-stopped accessibility events."""
 
         if event.source.getRole() == pyatspi.ROLE_DOCUMENT_FRAME:
             self._loadingDocumentContent = False


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