orca r4284 - in trunk: . src/orca/scripts/apps/rhythmbox



Author: joanied
Date: Thu Oct  9 20:44:50 2008
New Revision: 4284
URL: http://svn.gnome.org/viewvc/orca?rev=4284&view=rev

Log:
* src/orca/scripts/apps/rhythmbox/speech_generator.py:
  Fix for bug #554111 - Orca doesn't speak the Rhythmbox rating
  widget. 


Modified:
   trunk/ChangeLog
   trunk/src/orca/scripts/apps/rhythmbox/speech_generator.py

Modified: trunk/src/orca/scripts/apps/rhythmbox/speech_generator.py
==============================================================================
--- trunk/src/orca/scripts/apps/rhythmbox/speech_generator.py	(original)
+++ trunk/src/orca/scripts/apps/rhythmbox/speech_generator.py	Thu Oct  9 20:44:50 2008
@@ -25,6 +25,7 @@
 __copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
 __license__   = "LGPL"
 
+import pyatspi
 import orca.speechgenerator as speechgenerator
 
 class SpeechGenerator(speechgenerator.SpeechGenerator):
@@ -53,3 +54,40 @@
             obj = obj[3]
         return speechgenerator.SpeechGenerator.\
                     _getSpeechForTableCell(self, obj, already_focused)
+
+    def _getDefaultSpeech(self, obj, already_focused, role=None):
+        """Gets a list of utterances to be spoken for the current
+        object's name, role, and any accelerators.  This is usually the
+        fallback speech generator should no other specialized speech
+        generator exist for this object.
+
+        The default speech will be of the following form:
+
+        label name role availability
+
+        Arguments:
+        - obj: an Accessible
+        - already_focused: False if object just received focus
+        - role: A role that should be used instead of the Accessible's 
+          possible role.
+
+        Returns a list of utterances to be spoken for the object.
+        """
+
+        # When the rating widget changes values, it emits an accessible
+        # name changed event. Because it is of ROLE_UNKNOWN, the default
+        # speechgenerator's _getDefaultSpeech handles it. And because
+        # the widget is already focused, it doesn't speak anything. We
+        # want to speak the widget's name as it contains the number of
+        # stars being displayed.
+        #
+        if obj.getRole() == pyatspi.ROLE_UNKNOWN and already_focused:
+            utterances = self._getSpeechForObjectName(obj)
+            self._debugGenerator("rhythmbox _getDefaultSpeech",
+                                 obj,
+                                 already_focused,
+                                 utterances)
+            return utterances
+
+        return speechgenerator.SpeechGenerator.\
+                        _getDefaultSpeech(self, obj, already_focused, role)



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