[orca] Announce "non selected" when focus does not follow selected in a listbox



commit 6b42da7b7d29c3cb55be75d87bed998f37093e81
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Dec 16 11:06:28 2020 +0100

    Announce "non selected" when focus does not follow selected in a listbox

 src/orca/formatting.py        |  4 ++--
 src/orca/object_properties.py |  4 ++++
 src/orca/speech_generator.py  | 22 ++++++++++++++++++++++
 3 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 883391443..39f21f334 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -305,8 +305,8 @@ formatting = {
             },
         pyatspi.ROLE_LIST_ITEM: {
             'focused': 'expandableState',
-            'unfocused': '(labelOrName or (displayedText + allTextSelection)) + checkedStateIfCheckable + 
pause + expandableState + pause + positionInList + pause + listBoxItemWidgets',
-            'basicWhereAmI': 'label + roleName + pause + (name or displayedText) + checkedStateIfCheckable + 
pause + positionInList + pause + expandableState + (nodeLevel or nestingLevel) + pause'
+            'unfocused': '(labelOrName or (displayedText + allTextSelection)) + checkedStateIfCheckable + 
pause + unselectedStateIfSelectable + pause + expandableState + pause + positionInList + pause + 
listBoxItemWidgets',
+            'basicWhereAmI': 'label + roleName + pause + (name or displayedText) + checkedStateIfCheckable + 
pause + unselectedStateIfSelectable + pause + positionInList + pause + expandableState + (nodeLevel or 
nestingLevel) + pause'
             },
         pyatspi.ROLE_MATH: {
             'unfocused': 'math',
diff --git a/src/orca/object_properties.py b/src/orca/object_properties.py
index 3522952c7..46df70cb1 100644
--- a/src/orca/object_properties.py
+++ b/src/orca/object_properties.py
@@ -527,6 +527,10 @@ STATE_PRESSED = C_("togglebutton", "pressed")
 # Translators: This is a state which applies to a toggle button.
 STATE_NOT_PRESSED = C_("togglebutton", "not pressed")
 
+# Translators: This is a state which applies to an item or option
+# in a selectable list.
+STATE_UNSELECTED_LIST_ITEM = C_("listitem", "not selected")
+
 # Translators: This is a state which applies to a radio button.
 STATE_SELECTED_RADIO_BUTTON = C_("radiobutton", "selected")
 
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index a89ddbcea..6f314bf26 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1058,6 +1058,28 @@ class SpeechGenerator(generator.Generator):
 
         return result
 
+    def _generateUnselectedStateIfSelectable(self, obj, **args):
+        if _settingsManager.getSetting('onlySpeakDisplayedText'):
+            return []
+
+        if args.get('inMouseReview'):
+            return []
+
+        if not obj:
+            return []
+
+        if not (obj.parent and 'Selection' in pyatspi.listInterfaces(obj.parent)):
+            return []
+
+        state = obj.getState()
+        if state.contains(pyatspi.STATE_SELECTED):
+            return []
+
+        result = [object_properties.STATE_UNSELECTED_LIST_ITEM]
+        result.extend(self.voice(STATE))
+
+        return result
+
     def _generateUnselectedCell(self, obj, **args):
         """Returns an array of strings (and possibly voice and audio
         specifications) if this is an icon within an layered pane or a


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