[orca] Update the Rhythmbox script for the focus: event deprecation; remove obsolete hacks



commit 3086d806feaf85dfce6bcb2cedefa0b1591ed132
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Nov 2 19:19:23 2013 -0400

    Update the Rhythmbox script for the focus: event deprecation; remove obsolete hacks

 src/orca/scripts/apps/rhythmbox/Makefile.am        |    4 +-
 .../scripts/apps/rhythmbox/braille_generator.py    |   42 -----------
 src/orca/scripts/apps/rhythmbox/script.py          |   75 +++-----------------
 .../scripts/apps/rhythmbox/speech_generator.py     |   42 -----------
 4 files changed, 10 insertions(+), 153 deletions(-)
---
diff --git a/src/orca/scripts/apps/rhythmbox/Makefile.am b/src/orca/scripts/apps/rhythmbox/Makefile.am
index 5196692..45e038f 100644
--- a/src/orca/scripts/apps/rhythmbox/Makefile.am
+++ b/src/orca/scripts/apps/rhythmbox/Makefile.am
@@ -1,9 +1,7 @@
 orca_python_PYTHON = \
        __init__.py \
-       braille_generator.py \
        formatting.py \
-       script.py \
-       speech_generator.py
+       script.py
 
 orca_pythondir=$(pkgpythondir)/scripts/apps/rhythmbox
 
diff --git a/src/orca/scripts/apps/rhythmbox/script.py b/src/orca/scripts/apps/rhythmbox/script.py
index ea1668f..bde083e 100644
--- a/src/orca/scripts/apps/rhythmbox/script.py
+++ b/src/orca/scripts/apps/rhythmbox/script.py
@@ -27,14 +27,7 @@ __copyright__ = "Copyright (c) 2005-2009 Sun Microsystems Inc."  \
                 "Copyright (c) 2010 Joanmarie Diggs"
 __license__   = "LGPL"
 
-import pyatspi
-
 import orca.scripts.default as default
-import orca.orca as orca
-import orca.orca_state as orca_state
-
-from .speech_generator import SpeechGenerator
-from .braille_generator import BrailleGenerator
 from .formatting import Formatting
 
 class Script(default.Script):
@@ -47,68 +40,18 @@ class Script(default.Script):
         """
         default.Script.__init__(self, app)
 
-    def getBrailleGenerator(self):
-        """Returns the braille generator for this script.
-        """
-        return BrailleGenerator(self)
-
-    def getSpeechGenerator(self):
-        """Returns the speech generator for this script.
-        """
-        return SpeechGenerator(self)
-
     def getFormatting(self):
         """Returns the formatting strings for this script."""
         return Formatting(self)
 
-    def adjustTableCell(self, obj):
-        # Check to see if this is a table cell from the Library table.
-        # If so, it'll have five children and we are interested in the
-        # penultimate one. See bug #512639 for more details.
-        #
-        if obj.childCount == 5:
-            return obj[3]
-        else:
-            return obj
-
-    def onActiveDescendantChanged(self, event):
-        """Called when an object who manages its own descendants detects a
-        change in one of its children. Overridden here because the table
-        on the left-hand side lacks STATE_FOCUSED which causes the default
-        script to reject this event.
-
-        Arguments:
-        - event: the Event
-        """
-
-        child = event.any_data
-        if child:
-            orca.setLocusOfFocus(event, child)
-        else:
-            orca.setLocusOfFocus(event, event.source)
-
-        # We'll tuck away the activeDescendant information for future
-        # reference since the AT-SPI gives us little help in finding
-        # this.
-        #
-        if orca_state.locusOfFocus \
-           and (orca_state.locusOfFocus != event.source):
-            self.pointOfReference['activeDescendantInfo'] = \
-                [orca_state.locusOfFocus.parent,
-                 orca_state.locusOfFocus.getIndexInParent()]
-
-    def onFocus(self, event):
-        """Called whenever an object gets focus. Overridden here because a
-        page tab keeps making bogus focus claims when the user is in the
-        tree on the left-hand side.
-
-        Arguments:
-        - event: the Event
-        """
+    def skipObjectEvent(self, event):
+        # NOTE: This is here temporarily as part of the preparation for the
+        # deprecation/removal of accessible "focus:" events. Once the change
+        # has been complete, this method should be removed from this script.
+        if event.type == "focus:":
+            return True
 
-        if event.source.getRole() == pyatspi.ROLE_PAGE_TAB \
-           and not event.source.name and orca_state.locusOfFocus \
-           and orca_state.locusOfFocus.getRole() == pyatspi.ROLE_TABLE_CELL:
-            return
+        if event.type == "object:state-changed:focused":
+            return False
 
-        default.Script.onFocus(self, event)
+        return default.Script.skipObjectEvent(self, event)


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