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



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

Log:
        * src/orca/scripts/apps/soffice/script.py:
          src/orca/default.py:
          Fixed bug #538053 - Word echo is not echoing the word typed 
          when return is pressed while editing an Impress slide.


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

Modified: trunk/src/orca/default.py
==============================================================================
--- trunk/src/orca/default.py	(original)
+++ trunk/src/orca/default.py	Tue Jun 17 20:43:29 2008
@@ -2194,7 +2194,7 @@
         if len(utterance):
             speech.speak(utterance)
 
-    def echoPreviousWord(self, obj):
+    def echoPreviousWord(self, obj, offset=None):
         """Speaks the word prior to the caret, as long as there is
         a word prior to the caret and there is no intervening word
         delimiter between the caret and the end of the word.
@@ -2207,6 +2207,8 @@
         Arguments:
         - obj: an Accessible object that implements the AccessibleText
                interface.
+        - offset: if not None, the offset within the text to use as the
+                  end of the word.
         """
 
         try:
@@ -2214,7 +2216,8 @@
         except NotImplementedError:
             return
 
-        offset = text.caretOffset - 1
+        if not offset:
+            offset = text.caretOffset - 1
         if (offset < 0):
             return
 
@@ -2230,7 +2233,7 @@
         # work our way to the beginning of the word, stopping when
         # we hit another word delimiter.
         #
-        wordEndOffset = text.caretOffset - 2
+        wordEndOffset = offset - 1
         wordStartOffset = wordEndOffset
 
         while wordStartOffset >= 0:

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 20:43:29 2008
@@ -1879,7 +1879,33 @@
         - event: the Event
         """
 
-        # If the object is losing focus, then just ignore this event.
+        # If we are losing focus and we in a paragraph in a slide 
+        # presentation and the last thing the user typed was a Return,
+        # and echo by word is enabled, then echo the previous word 
+        # that the user typed.  See bug #538053 for more details.
+        #
+        if event.detail1 == -1:
+            rolesList = [pyatspi.ROLE_PARAGRAPH,
+                         pyatspi.ROLE_UNKNOWN,
+                         pyatspi.ROLE_UNKNOWN,
+                         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) and \
+               settings.enableEchoByWord:
+                if isinstance(orca_state.lastInputEvent,
+                              input_event.KeyboardEvent):
+                    keyString = orca_state.lastNonModifierKeyEvent.event_string
+                    if keyString == "Return":
+                        result = self.getText(event.source, 0, -1)
+                        line = result.decode("UTF-8")
+                        self.echoPreviousWord(event.source, len(line))
+                        return
+
+        # Otherwise, if the object is losing focus, then just ignore this event.
         #
         if event.detail1 == -1:
             return



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