[orca] Apply cell/row preferences to mouse review



commit 539bd98ae0f3ef05fc72f5b6bcf0c4e30a275e76
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jul 8 11:52:08 2019 -0400

    Apply cell/row preferences to mouse review

 src/orca/mouse_review.py     |  5 +++++
 src/orca/script_utilities.py | 21 +++++++++------------
 2 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/src/orca/mouse_review.py b/src/orca/mouse_review.py
index 01f600050..ef246562a 100644
--- a/src/orca/mouse_review.py
+++ b/src/orca/mouse_review.py
@@ -422,6 +422,11 @@ class MouseReviewer:
                 debug.println(debug.LEVEL_INFO, msg, True)
                 return
 
+        if obj and obj.getRole() in script.utilities.getCellRoles() \
+           and script.utilities.shouldReadFullRow(obj):
+            isRow = lambda x: x and x.getRole() == pyatspi.ROLE_TABLE_ROW
+            obj = pyatspi.findAncestor(obj, isRow) or obj
+
         new = _ItemContext(pX, pY, obj, window, script)
         new.present(self._currentMouseOver)
         self._currentMouseOver = new
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 112c69baa..03f6cb602 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1255,6 +1255,13 @@ class Utilities:
 
         return False
 
+    def getCellRoles(self):
+        return [pyatspi.ROLE_TABLE_CELL,
+                pyatspi.ROLE_TABLE_COLUMN_HEADER,
+                pyatspi.ROLE_TABLE_ROW_HEADER,
+                pyatspi.ROLE_COLUMN_HEADER,
+                pyatspi.ROLE_ROW_HEADER]
+
     def isTextDocumentCell(self, obj):
         if not obj:
             return False
@@ -1266,12 +1273,7 @@ class Utilities:
             debug.println(debug.LEVEL_INFO, msg, True)
             return False
 
-        cellRoles = [pyatspi.ROLE_TABLE_CELL,
-                     pyatspi.ROLE_TABLE_COLUMN_HEADER,
-                     pyatspi.ROLE_TABLE_ROW_HEADER,
-                     pyatspi.ROLE_COLUMN_HEADER,
-                     pyatspi.ROLE_ROW_HEADER]
-        if not role in cellRoles:
+        if not role in self.getCellRoles():
             return False
 
         return pyatspi.findAncestor(obj, self.isTextDocumentTable)
@@ -1287,12 +1289,7 @@ class Utilities:
             debug.println(debug.LEVEL_INFO, msg, True)
             return False
 
-        cellRoles = [pyatspi.ROLE_TABLE_CELL,
-                     pyatspi.ROLE_TABLE_COLUMN_HEADER,
-                     pyatspi.ROLE_TABLE_ROW_HEADER,
-                     pyatspi.ROLE_COLUMN_HEADER,
-                     pyatspi.ROLE_ROW_HEADER]
-        if not role in cellRoles:
+        if not role in self.getCellRoles():
             return False
 
         return pyatspi.findAncestor(obj, self.isSpreadSheetTable)


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