[orca] Announce row and column indices for interactable cell descendants



commit b803ac16749f8d7d69057f50eac153b3a92c4992
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Jun 30 17:32:46 2022 +0200

    Announce row and column indices for interactable cell descendants
    
    This commit causes us to present the row and/or column index when
    the user moves focus to a descendant of a cell in a different row
    and/or column.
    
    See issue #253.

 src/orca/formatting.py       |  2 +-
 src/orca/speech_generator.py | 24 +++++++++++++++++++++---
 2 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 23569dd93..4cc6fb580 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -489,7 +489,7 @@ formatting = {
             'basicWhereAmI': 'labelAndName + pause + table'
             },
         pyatspi.ROLE_TABLE_CELL: {
-            'ancestor': 'newRowHeader + newColumnHeader',
+            'ancestor': 'newRowHeader + newColumnHeader + pause + newRow + pause + newColumn',
             'focused': '((tableCell2ChildLabel + tableCell2ChildToggle) or cellCheckedState) + pause + 
(expandableState and (expandableState + pause + numberOfChildren + pause))',
             'unfocused': 'tableCellRow + pause',
             'basicWhereAmI': 'parentRoleName + pause + columnHeader + pause + rowHeader + pause + roleName + 
pause + cellCheckedState + pause + (realActiveDescendantDisplayedText or imageDescription + image) + pause + 
columnAndRow + pause + expandableState + pause + nodeLevel + pause',
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 99ab79cd9..0b228169b 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1112,6 +1112,15 @@ class SpeechGenerator(generator.Generator):
 
         return result
 
+    def _generateNewColumn(self, obj, **args):
+        if not self._script.utilities.cellColumnChanged(obj):
+            return []
+
+        if args.get('readingRow'):
+            return []
+
+        return self._generateColumn(obj, **args)
+
     def _generateColumn(self, obj, **args):
         """Returns an array of strings (and possibly voice and audio
         specifications) reflecting the column number of a cell.
@@ -1123,7 +1132,7 @@ class SpeechGenerator(generator.Generator):
         col = -1
         if obj.parent.getRole() == pyatspi.ROLE_TABLE_CELL:
             obj = obj.parent
-        parent = obj.parent
+        parent = self._script.utilities.getTable(obj)
         try:
             table = parent.queryTable()
         except:
@@ -1138,6 +1147,15 @@ class SpeechGenerator(generator.Generator):
             result.extend(self.voice(SYSTEM, obj=obj, **args))
         return result
 
+    def _generateNewRow(self, obj, **args):
+        if not self._script.utilities.cellRowChanged(obj):
+            return []
+
+        if args.get('readingRow'):
+            return []
+
+        return self._generateRow(obj, **args)
+
     def _generateRow(self, obj, **args):
         """Returns an array of strings (and possibly voice and audio
         specifications) reflecting the row number of a cell.
@@ -1149,7 +1167,7 @@ class SpeechGenerator(generator.Generator):
         row = -1
         if obj.parent.getRole() == pyatspi.ROLE_TABLE_CELL:
             obj = obj.parent
-        parent = obj.parent
+        parent = self._script.utilities.getTable(obj)
         try:
             table = parent.queryTable()
         except:
@@ -1176,7 +1194,7 @@ class SpeechGenerator(generator.Generator):
         result = []
         if obj.parent.getRole() == pyatspi.ROLE_TABLE_CELL:
             obj = obj.parent
-        parent = obj.parent
+        parent = self._script.utilities.getTable(obj)
         try:
             table = parent.queryTable()
         except:


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