orca r4003 - in trunk: . src/orca/scripts/apps/Thunderbird src/orca/scripts/toolkits/Gecko



Author: richb
Date: Wed Jun 25 21:10:41 2008
New Revision: 4003
URL: http://svn.gnome.org/viewvc/orca?rev=4003&view=rev

Log:
        * src/orca/scripts/apps/Thunderbird/script.py:
          src/orca/scripts/toolkits/Gecko/script.py:
          With help from Joanie (thanks!)
          Fixed bug #540039 - Newly focused message not spoken after
          message deletion in Thunderbird if a message is open.


Modified:
   trunk/ChangeLog
   trunk/src/orca/scripts/apps/Thunderbird/script.py
   trunk/src/orca/scripts/toolkits/Gecko/script.py

Modified: trunk/src/orca/scripts/apps/Thunderbird/script.py
==============================================================================
--- trunk/src/orca/scripts/apps/Thunderbird/script.py	(original)
+++ trunk/src/orca/scripts/apps/Thunderbird/script.py	Wed Jun 25 21:10:41 2008
@@ -234,6 +234,23 @@
                 if string == "Delete":
                     oldLocusOfFocus = None
 
+        # If the user has just deleted an open mail message, then we want to
+        # try to speak the new name of the open mail message frame.
+        # See bug #540039 for more details.
+        #
+        rolesList = [pyatspi.ROLE_DOCUMENT_FRAME, \
+                     pyatspi.ROLE_INTERNAL_FRAME, \
+                     pyatspi.ROLE_FRAME, \
+                     pyatspi.ROLE_APPLICATION]
+        if self.isDesiredFocusedItem(event.source, rolesList):
+            if isinstance(orca_state.lastInputEvent, input_event.KeyboardEvent):
+                string = orca_state.lastNonModifierKeyEvent.event_string
+                if string == "Delete":
+                    oldLocusOfFocus = None
+                    state = newLocusOfFocus.getState()
+                    if state.contains(pyatspi.STATE_DEFUNCT):
+                        newLocusOfFocus = event.source
+
         # Pass the event onto the parent class to be handled in the default way.
 
         Gecko.Script.locusOfFocusChanged(self, event,
@@ -319,6 +336,26 @@
 
         obj = event.source
 
+        # If the user has just deleted an open mail message, then we want to
+        # try to speak the new name of the open mail message frame and also
+        # present the first line of that message to be consistent with what
+        # we do when a new message window is opened. See bug #540039 for more
+        # details.
+        #
+        rolesList = [pyatspi.ROLE_DOCUMENT_FRAME, \
+                     pyatspi.ROLE_INTERNAL_FRAME, \
+                     pyatspi.ROLE_FRAME, \
+                     pyatspi.ROLE_APPLICATION]
+        if self.isDesiredFocusedItem(event.source, rolesList):
+            if isinstance(orca_state.lastInputEvent, input_event.KeyboardEvent):
+                string = orca_state.lastNonModifierKeyEvent.event_string
+                if string == "Delete":
+                    speech.speak(obj.name)
+                    [obj, offset] = self.findFirstCaretContext(obj, 0)
+                    self.setCaretPosition(obj, offset)
+                    self.presentLine(obj, offset)
+                    return
+
         # If we get a "object:property-change:accessible-name" event for 
         # the first item in the Suggestions lists for the spell checking
         # dialog, then speak the first two labels in that dialog. These

Modified: trunk/src/orca/scripts/toolkits/Gecko/script.py
==============================================================================
--- trunk/src/orca/scripts/toolkits/Gecko/script.py	(original)
+++ trunk/src/orca/scripts/toolkits/Gecko/script.py	Wed Jun 25 21:10:41 2008
@@ -2680,10 +2680,14 @@
         """Returns the URI of the document frame that is active."""
         documentFrame = self.getDocumentFrame()
         if documentFrame:
-            attrs = documentFrame.queryDocument().getAttributes()
-            for attr in attrs:
-                if attr.startswith('DocURL'):
-                    return attr[7:]
+            # If the document frame belongs to a Thunderbird message which
+            # has just been deleted, getAttributes() will crash Thunderbird.
+            #
+            if not documentFrame.getState().contains(pyatspi.STATE_DEFUNCT):
+                attrs = documentFrame.queryDocument().getAttributes()
+                for attr in attrs:
+                    if attr.startswith('DocURL'):
+                        return attr[7:]
         return None
 
     def getUnicodeText(self, obj):



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