[orca/570658] Port rhythmbox script to the new braille generator



commit 6c3d3d58011b6ee313e71e78e235a28250c67fea
Author: Willie Walker <william walker sun com>
Date:   Mon Jun 29 16:52:11 2009 -0400

    Port rhythmbox script to the new braille generator

 .../scripts/apps/rhythmbox/braille_generator.py    |   40 ++++++-------------
 src/orca/scripts/apps/rhythmbox/script.py          |   10 +++++
 .../scripts/apps/rhythmbox/speech_generator.py     |    8 +---
 3 files changed, 24 insertions(+), 34 deletions(-)
---
diff --git a/src/orca/scripts/apps/rhythmbox/braille_generator.py b/src/orca/scripts/apps/rhythmbox/braille_generator.py
index 755245c..e9fcbbc 100644
--- a/src/orca/scripts/apps/rhythmbox/braille_generator.py
+++ b/src/orca/scripts/apps/rhythmbox/braille_generator.py
@@ -1,6 +1,6 @@
 # Orca
 #
-# Copyright 2005-2008 Sun Microsystems Inc.
+# Copyright 2005-2009 Sun Microsystems Inc.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -22,35 +22,21 @@
 __id__ = "$Id$"
 __version__   = "$Revision$"
 __date__      = "$Date$"
-__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
+__copyright__ = "Copyright (c) 2005-2009 Sun Microsystems Inc."
 __license__   = "LGPL"
 
-import orca.braillegenerator as braillegenerator
+import orca.braille_generator as braille_generator
 
-class BrailleGenerator(braillegenerator.BrailleGenerator):
-    """Overrides _getBrailleRegionsForTableCell to correctly handle 
-    the table cells in the Library table.
-    """
-
-    def __init__(self, script):
-        braillegenerator.BrailleGenerator.__init__(self, script)
-
-    def _getBrailleRegionsForTableCell(self, obj):
-        """Get the braille for a single table cell
+class BrailleGenerator(braille_generator.BrailleGenerator):
 
-        Arguments:
-        - obj: the table
+    # pylint: disable-msg=W0142
 
-        Returns a list where the first element is a list of Regions to 
-        display and the second element is the Region which should get focus.
-        """
-
-        # 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:
-            obj = obj[3]
+    """Overrides _generateRealTableCell to correctly handle the table
+    cells in the Library table.
+    """
+    def __init__(self, script):
+        braille_generator.BrailleGenerator.__init__(self, script)
 
-        return braillegenerator.BrailleGenerator.\
-                    _getBrailleRegionsForTableCell(self, obj)
+    def _generateRealTableCell(self, obj, **args):
+        return braille_generator.BrailleGenerator._generateRealTableCell(
+            self, self._script.adjustTableCell(obj), **args)
diff --git a/src/orca/scripts/apps/rhythmbox/script.py b/src/orca/scripts/apps/rhythmbox/script.py
index a965800..0568290 100644
--- a/src/orca/scripts/apps/rhythmbox/script.py
+++ b/src/orca/scripts/apps/rhythmbox/script.py
@@ -54,3 +54,13 @@ class Script(default.Script):
     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
diff --git a/src/orca/scripts/apps/rhythmbox/speech_generator.py b/src/orca/scripts/apps/rhythmbox/speech_generator.py
index aaf3104..ee4dcea 100644
--- a/src/orca/scripts/apps/rhythmbox/speech_generator.py
+++ b/src/orca/scripts/apps/rhythmbox/speech_generator.py
@@ -38,11 +38,5 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
         speech_generator.SpeechGenerator.__init__(self, script)
 
     def _generateRealTableCell(self, obj, **args):
-        # 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:
-            obj = obj[3]
         return speech_generator.SpeechGenerator._generateRealTableCell(
-            self, obj, **args)
+            self, self._script.adjustTableCell(obj), **args)



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