[orca] Handle exception when using AtspiTableCell



commit b3738c4112f3568826cf7f0c43150835cda6bab1
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Sep 5 13:10:13 2022 +0200

    Handle exception when using AtspiTableCell
    
    Commit cb105d4d21c added the use of the TableCell interface as the
    preferred means to get the table cell's coordinates. It returns the
    value only if successful, and checks that the interface is available,
    but did not handle exceptions, such as the to-be-debugged one seen when
    attempting to call Atspi.TableCell.get_position on the first row in
    Caja. This commit adds exception handling so that we fail gracefully.

 src/orca/script_utilities.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 927be2d80..df4e52146 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4563,9 +4563,14 @@ class Utilities:
 
         if 'TableCell' in pyatspi.listInterfaces(obj):
             tableCell = obj.queryTableCell()
-            successful, row, col = tableCell.position
-            if successful:
-                return row, col
+            try:
+                successful, row, col = tableCell.position
+            except:
+                msg = "INFO: Exception getting table cell position of %s" % obj
+                debug.println(debug.LEVEL_INFO, msg, True)
+            else:
+                if successful:
+                    return row, col
 
         isTable = lambda x: x and 'Table' in pyatspi.listInterfaces(x)
         parent = pyatspi.findAncestor(obj, isTable)


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