[orca/gnome-42] Create 'ancestor' formatType for presentation of objects



commit b59cdfbdb177426a6250e91e6a68407017b8f99a
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Jun 30 13:40:58 2022 +0200

    Create 'ancestor' formatType for presentation of objects
    
    The 'focused' formatType has been serving dual purposes, specifying
    what to present when the object is already focused and something
    changed and what to present about an ancestor of a newly focused
    object. This approach was likely done because the information in
    both cases is expected to be minimal, and the set of roles for
    which we might want distinct already-focused info and as-ancestor
    info small to non-existent.
    
    It turns out that small may be true; non-existent isn't. Consider focus
    changing among items (e.g. links) descending from ARIA gridcells. If the
    column changes, we want to include some of the new cell/column info. And
    that info will be different from what we present when some state
    changes in the currently-focused Gtk table cell.
    
    This commit merely adds the capability of an ancestor formatType
    because having it makes sense in general. It falls back on the focused
    formatType, so no end-user-observable behavior should result from this
    commit. A subsequent commit will use this new formatType to solve the
    aforementioned table cell problem. And as other such instances become
    noticed, we can start decoupling "focused" from "ancestor."
    
    See issue #253.

 src/orca/formatting.py       | 9 +++++++++
 src/orca/speech_generator.py | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index c25224c5d..a269e97b9 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -111,18 +111,21 @@ formatting = {
 
     'speech': {
         'prefix': {
+            'ancestor': '[]',
             'focused': 'detailsFor',
             'unfocused': 'oldAncestors + newAncestors',
             'basicWhereAmI': 'toolbar',
             'detailedWhereAmI' : '[]'
             },
         'suffix': {
+            'ancestor': '[]',
             'focused': '[]',
             'unfocused': 'newNodeLevel + unselectedCell + clickable + pause + hasLongDesc + hasDetails + 
detailsFor +' + TUTORIAL + ' + description + pause + hasPopup',
             'basicWhereAmI': TUTORIAL + ' + clickable + hasLongDesc + description + pause + hasPopup + pause 
+ detailsFor + pause + allDetails',
             'detailedWhereAmI': TUTORIAL + ' + clickable + hasLongDesc + description + pause + hasPopup + 
detailsFor + pause + allDetails'
             },
         'default': {
+            'ancestor': '[]',
             'focused': '[]',
             'unfocused': 'labelOrName + roleName + availability + ' + MNEMONIC + ' + accelerator + 
childWidget',
             'basicWhereAmI': 'labelOrName + roleName',
@@ -1057,6 +1060,12 @@ class Formatting(dict):
         except:
             pass
 
+        if args.get('formatType') == 'ancestor':
+            try:
+                return self[args['mode']][args['role']]['focused']
+            except:
+                pass
+
         if args.get('formatType') == 'detailedWhereAmI':
             try:
                 return self[args['mode']][args['role']]['basicWhereAmI']
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 0c274be82..9622e131a 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -2093,7 +2093,7 @@ class SpeechGenerator(generator.Generator):
             presentedRoles.append(altRole)
             count = ancestorRoles.count(altRole)
             self._overrideRole(altRole, args)
-            result.append(self.generate(x, formatType='focused', role=altRole, leaving=leaving, count=count,
+            result.append(self.generate(x, formatType='ancestor', role=altRole, leaving=leaving, count=count,
                                         ancestorOf=obj, priorObj=priorObj))
             self._restoreRole(altRole, args)
 


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