orca r4578 - in trunk: . src/orca



Author: joanied
Date: Wed Feb 18 17:43:33 2009
New Revision: 4578
URL: http://svn.gnome.org/viewvc/orca?rev=4578&view=rev

Log:
* src/orca/default.py:
  Fix for bug #572294 - Need a sanity check in the default script's
  locusOfFocusChanged.


Modified:
   trunk/ChangeLog
   trunk/src/orca/default.py

Modified: trunk/src/orca/default.py
==============================================================================
--- trunk/src/orca/default.py	(original)
+++ trunk/src/orca/default.py	Wed Feb 18 17:43:33 2009
@@ -2899,7 +2899,8 @@
             # in a context, with the label for the group being the
             # name of the context.
             #
-            if newLocusOfFocus.getRole() == pyatspi.ROLE_RADIO_BUTTON:
+            if newLocusOfFocus \
+               and newLocusOfFocus.getRole() == pyatspi.ROLE_RADIO_BUTTON:
                 radioGroupLabel = None
                 inSameGroup = False
                 relations = newLocusOfFocus.getRelationSet()
@@ -2959,12 +2960,12 @@
             # selected, let the user know. See bug #486908 for more details.
             #
             checkIfSelected = False
-            objRole = newLocusOfFocus.getRole()
-            if newLocusOfFocus.parent:
-                parentRole = newLocusOfFocus.parent.getRole()
-            else:
-                parentRole = None
-            state = newLocusOfFocus.getState()
+            objRole, parentRole, state = None, None, None
+            if newLocusOfFocus:
+                objRole = newLocusOfFocus.getRole()
+                state = newLocusOfFocus.getState()
+                if newLocusOfFocus.parent:
+                    parentRole = newLocusOfFocus.parent.getRole()
 
             if objRole == pyatspi.ROLE_TABLE_CELL and \
                (parentRole == pyatspi.ROLE_TREE_TABLE or \
@@ -2985,7 +2986,8 @@
                 parentRole == pyatspi.ROLE_LAYERED_PANE:
                 checkIfSelected = True
 
-            if checkIfSelected and not state.contains(pyatspi.STATE_SELECTED):
+            if checkIfSelected and state \
+               and not state.contains(pyatspi.STATE_SELECTED):
                 # Translators: this is in reference to a table cell being
                 # selected or not.
                 #
@@ -3001,7 +3003,7 @@
                 and self.windowActivateTime \
                 and ((time.time() - self.windowActivateTime) < 1.0)
 
-            if newLocusOfFocus.getRole() == pyatspi.ROLE_LINK:
+            if objRole == pyatspi.ROLE_LINK:
                 voice = self.voices[settings.HYPERLINK_VOICE]
             else:
                 voice = self.voices[settings.DEFAULT_VOICE]
@@ -3012,7 +3014,7 @@
             # information in the table cell's table, so that we can use
             # it the next time.
             #
-            if newLocusOfFocus.getRole() == pyatspi.ROLE_TABLE_CELL:
+            if objRole == pyatspi.ROLE_TABLE_CELL:
                 try:
                     table = newParent.queryTable()
                 except:



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