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



commit d6ac41964f713ccaf419887cc87e0a1311a151c1
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Jun 30 15:28:36 2022 +0200

    Announce row and column headers for interactable cell descendants
    
    This commit causes us to present the row and/or column header 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                   | 1 +
 src/orca/generator.py                    | 3 ++-
 src/orca/scripts/web/speech_generator.py | 3 ++-
 src/orca/speech_generator.py             | 9 ++++++---
 4 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 428d61d6a..23569dd93 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -489,6 +489,7 @@ formatting = {
             'basicWhereAmI': 'labelAndName + pause + table'
             },
         pyatspi.ROLE_TABLE_CELL: {
+            'ancestor': 'newRowHeader + newColumnHeader',
             '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/generator.py b/src/orca/generator.py
index 8289885ac..e6fce5016 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -239,7 +239,8 @@ class Generator:
             else:
                 firstTimeCalled = False
 
-            msg = '%s GENERATOR: Starting generation for %s' % (self._mode.upper(), obj)
+            msg = '%s GENERATOR: Starting %s generation for %s (%s)' % \
+                (self._mode.upper(), args.get('formatType'), obj, args.get('role'))
             debug.println(debug.LEVEL_INFO, msg, True)
 
             # Reset 'usedDescriptionFor*' if a previous generator used it.
diff --git a/src/orca/scripts/web/speech_generator.py b/src/orca/scripts/web/speech_generator.py
index 23b0f769e..0eb41b606 100644
--- a/src/orca/scripts/web/speech_generator.py
+++ b/src/orca/scripts/web/speech_generator.py
@@ -857,7 +857,8 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
 
         if not result:
             if self._script.inSayAll(treatInterruptedAsIn=False) \
-               or not _settingsManager.getSetting('speakBlankLines'):
+               or not _settingsManager.getSetting('speakBlankLines') \
+               or args.get('formatType') == 'ancestor':
                 string = ""
             else:
                 string = messages.BLANK
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 2eeeac999..99ab79cd9 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1037,7 +1037,8 @@ class SpeechGenerator(generator.Generator):
         self._restoreRole(oldRole, args)
         if not (result and result[0]) \
            and _settingsManager.getSetting('speakBlankLines') \
-           and not args.get('readingRow', False):
+           and not args.get('readingRow', False) \
+           and args.get('formatType') != 'ancestor':
             result.append(messages.BLANK)
             if result:
                 result.extend(self.voice(DEFAULT, obj=obj, **args))
@@ -1235,7 +1236,8 @@ class SpeechGenerator(generator.Generator):
 
         [text, caretOffset, startOffset] = self._script.getTextLineAtCaret(obj)
         if text == '\n' and _settingsManager.getSetting('speakBlankLines') \
-           and not self._script.inSayAll() and args.get('total', 1) == 1:
+           and not self._script.inSayAll() and args.get('total', 1) == 1 \
+           and args.get('formatType') != 'ancestor':
             result = [messages.BLANK]
             result.extend(self.voice(string=text, obj=obj, **args))
             return result
@@ -1512,7 +1514,8 @@ class SpeechGenerator(generator.Generator):
 
         result.extend(self.voice(DEFAULT, obj=obj, **args))
         if result[0] in ['\n', ''] and _settingsManager.getSetting('speakBlankLines') \
-           and not self._script.inSayAll() and args.get('total', 1) == 1:
+           and not self._script.inSayAll() and args.get('total', 1) == 1 \
+           and args.get('formatType') != 'ancestor':
             result[0] = messages.BLANK
 
         if self._script.utilities.shouldVerbalizeAllPunctuation(obj):


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