orca r3983 - in trunk: . src/orca/scripts/apps/soffice



Author: richb
Date: Tue Jun 17 16:19:20 2008
New Revision: 3983
URL: http://svn.gnome.org/viewvc/orca?rev=3983&view=rev

Log:
        * src/orca/scripts/apps/soffice/braille_generator.py:
          src/orca/scripts/apps/soffice/script.py:
          Fixed bug #538056 - Orca should announce the "view" as part of 
          the scroll pane context in Impress.


Modified:
   trunk/ChangeLog
   trunk/src/orca/scripts/apps/soffice/braille_generator.py
   trunk/src/orca/scripts/apps/soffice/script.py

Modified: trunk/src/orca/scripts/apps/soffice/braille_generator.py
==============================================================================
--- trunk/src/orca/scripts/apps/soffice/braille_generator.py	(original)
+++ trunk/src/orca/scripts/apps/soffice/braille_generator.py	Tue Jun 17 16:19:20 2008
@@ -233,3 +233,40 @@
                 return [regions, focusRegion]
 
         return regions
+
+    def _getBrailleRegionsForScrollPane(self, obj):
+        """Get the braille for a scroll pane.
+
+        Arguments:
+        - obj: the scroll pane
+
+        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.
+        """
+
+        self._debugGenerator("soffice: _getBrailleRegionsForScrollPane", obj)
+
+        scrollRegions = braillegenerator.BrailleGenerator.\
+                               _getBrailleRegionsForScrollPane(self, obj)
+
+        # If we are in the slide presentation scroll pane, also announce
+        # the current page tab. See bug #538056 for more details.
+        #
+        rolesList = [pyatspi.ROLE_SCROLL_PANE, \
+                     pyatspi.ROLE_PANEL, \
+                     pyatspi.ROLE_PANEL, \
+                     pyatspi.ROLE_ROOT_PANE, \
+                     pyatspi.ROLE_FRAME, \
+                     pyatspi.ROLE_APPLICATION]
+        if self._script.isDesiredFocusedItem(obj, rolesList):
+            for child in obj.parent:
+                if child.getRole() == pyatspi.ROLE_PAGE_TAB_LIST:
+                    for tab in child:
+                        eventState = tab.getState()
+                        if eventState.contains(pyatspi.STATE_SELECTED):
+                            tabRegions = self.getBrailleRegions(tab)
+                            tabRegions[0].append(braille.Region(" ")) 
+                            tabRegions[0].extend(scrollRegions[0])
+                            return tabRegions
+
+        return scrollRegions

Modified: trunk/src/orca/scripts/apps/soffice/script.py
==============================================================================
--- trunk/src/orca/scripts/apps/soffice/script.py	(original)
+++ trunk/src/orca/scripts/apps/soffice/script.py	Tue Jun 17 16:19:20 2008
@@ -1165,6 +1165,7 @@
     # 4) Calc: cell editor.
     # 5) Calc: name box.
     # 6) Calc: spreadsheet cell.
+    # 7) Impress: scroll pane.
 
     def locusOfFocusChanged(self, event, oldLocusOfFocus, newLocusOfFocus):
         """Called when the visual object with focus changes.
@@ -1444,6 +1445,32 @@
                     self.pointOfReference['lastRow'] = row
                 return
 
+        # 7) Impress: scroll pane.
+        #
+        # If we are in the slide presentation scroll pane, also announce
+        # the current page tab. See bug #538056 for more details.
+        #
+        rolesList = [pyatspi.ROLE_SCROLL_PANE, \
+                     pyatspi.ROLE_PANEL, \
+                     pyatspi.ROLE_PANEL, \
+                     pyatspi.ROLE_ROOT_PANE, \
+                     pyatspi.ROLE_FRAME, \
+                     pyatspi.ROLE_APPLICATION]
+
+        if self.isDesiredFocusedItem(event.source, rolesList):
+            debug.println(self.debugLevel, "soffice.locusOfFocusChanged - " \
+                          + "Impress: scroll pane.")
+
+            for child in event.source.parent:
+                if child.getRole() == pyatspi.ROLE_PAGE_TAB_LIST:
+                    for tab in child:
+                        eventState = tab.getState()
+                        if eventState.contains(pyatspi.STATE_SELECTED):
+                            utterances = self.speechGenerator.getSpeech(tab,
+                                                                        False)
+                            speech.speakUtterances(utterances)
+            # Fall-thru to process the event with the default handler.
+
         # Pass the event onto the parent class to be handled in the default way.
 
         default.Script.locusOfFocusChanged(self, event,



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