[orca] Handle cases of Calc becoming non-responsive



commit a2982eeb064cfe6c1d880c37470e87cef9a0dd63
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Mar 2 11:36:43 2016 -0500

    Handle cases of Calc becoming non-responsive

 src/orca/scripts/apps/soffice/script_utilities.py |   14 ++++++++++----
 src/orca/scripts/default.py                       |   11 +++++------
 2 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/src/orca/scripts/apps/soffice/script_utilities.py 
b/src/orca/scripts/apps/soffice/script_utilities.py
index 238c42d..534e593 100644
--- a/src/orca/scripts/apps/soffice/script_utilities.py
+++ b/src/orca/scripts/apps/soffice/script_utilities.py
@@ -349,9 +349,15 @@ class Utilities(script_utilities.Utilities):
         """
 
         if self._script.inputLineForCell:
-            topLevel = self.topLevelObject(self._script.inputLineForCell)
-            if self.isSameObject(orca_state.activeWindow, topLevel):
-                return self._script.inputLineForCell
+            try:
+                topLevel = self.topLevelObject(self._script.inputLineForCell)
+            except:
+                msg = "ERROR: Exception getting topLevelObject for inputline"
+                debug.println(debug.LEVEL_INFO, msg, True)
+                self._script.inputLineForCell = None
+            else:
+                if self.isSameObject(orca_state.activeWindow, topLevel):
+                    return self._script.inputLineForCell
 
         isScrollPane = lambda x: x and x.getRole() == pyatspi.ROLE_SCROLL_PANE
         scrollPane = pyatspi.findAncestor(obj, isScrollPane)
@@ -367,7 +373,7 @@ class Utilities(script_utilities.Utilities):
         if not toolbar:
             msg = "ERROR: Calc inputline toolbar not found."
             debug.println(debug.LEVEL_INFO, msg, True)
-            return
+            return None
 
         isParagraph = lambda x: x and x.getRole() == pyatspi.ROLE_PARAGRAPH
         allParagraphs = pyatspi.findAllDescendants(toolbar, isParagraph)
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 3f4d50c..28f338e 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -767,20 +767,19 @@ class Script(script.Script):
         # We want to save the current row and column of a newly focused
         # or selected table cell so that on subsequent cell focus/selection
         # we only present the changed location.
+        self.pointOfReference['lastColumn'] = -1
+        self.pointOfReference['lastRow'] = -1
         if role == pyatspi.ROLE_TABLE_CELL:
             try:
                 table = obj.parent.queryTable()
-            except:
-                pass
-            else:
                 index = self.utilities.cellIndex(obj)
                 column = table.getColumnAtIndex(index)
                 row = table.getRowAtIndex(index)
+            except:
+                pass
+            else:
                 self.pointOfReference['lastColumn'] = column
                 self.pointOfReference['lastRow'] = row
-        else:
-            self.pointOfReference['lastColumn'] = -1
-            self.pointOfReference['lastRow'] = -1
 
         self.pointOfReference['checkedChange'] = \
             hash(obj), state.contains(pyatspi.STATE_CHECKED)


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