[orca] Improve presentation of locations in file chooser dialog



commit e8ccee6116ea7d90fbaf446f1640ca4c5eaed6ee
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Jan 11 09:28:37 2018 -0500

    Improve presentation of locations in file chooser dialog

 src/orca/script_utilities.py                      |   16 +++++-----------
 src/orca/scripts/apps/soffice/script_utilities.py |    6 ------
 src/orca/scripts/toolkits/gtk/script_utilities.py |   15 ---------------
 src/orca/speech_generator.py                      |    3 ++-
 4 files changed, 7 insertions(+), 33 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 8155ad5..694b5ea 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -456,17 +456,11 @@ class Utilities:
             except (LookupError, RuntimeError):
                 pass
 
-        # [[[WDW - HACK because push buttons can have labels as their
-        # children.  An example of this is the Font: button on the General
-        # tab in the Editing Profile dialog in gnome-terminal.
-        #
-        if not displayedText and role == pyatspi.ROLE_PUSH_BUTTON:
-            for child in obj:
-                if child.getRole() == pyatspi.ROLE_LABEL:
-                    childText = self.displayedText(child)
-                    if childText and len(childText):
-                        displayedText = \
-                            self.appendString(displayedText, childText)
+        if not displayedText and role in [pyatspi.ROLE_PUSH_BUTTON, pyatspi.ROLE_LIST_ITEM]:
+            labels = self.unrelatedLabels(obj)
+            if not labels:
+                labels = self.unrelatedLabels(obj, onlyShowing=False)
+            displayedText = " ".join(map(self.displayedText, labels))
 
         if self.DISPLAYED_TEXT not in self._script.generatorCache:
             self._script.generatorCache[self.DISPLAYED_TEXT] = {}
diff --git a/src/orca/scripts/apps/soffice/script_utilities.py 
b/src/orca/scripts/apps/soffice/script_utilities.py
index 83d689a..efc83ef 100644
--- a/src/orca/scripts/apps/soffice/script_utilities.py
+++ b/src/orca/scripts/apps/soffice/script_utilities.py
@@ -101,12 +101,6 @@ class Utilities(script_utilities.Utilities):
         if self.isDocument(obj) and text == obj.name and obj.name.startswith("file:///"):
             return ""
 
-        # TODO - JD: Once the VCL script is completed and subclasses the
-        # appropriate toolkit scripts, this should not be needed.
-        if obj.parent and obj.parent.getRole() == pyatspi.ROLE_LIST_BOX:
-            labels = self.unrelatedLabels(obj, onlyShowing=False)
-            text = " ".join(map(self.displayedText, labels))
-
         return text
 
     def isCellBeingEdited(self, obj):
diff --git a/src/orca/scripts/toolkits/gtk/script_utilities.py 
b/src/orca/scripts/toolkits/gtk/script_utilities.py
index a38531b..a46a7be 100644
--- a/src/orca/scripts/toolkits/gtk/script_utilities.py
+++ b/src/orca/scripts/toolkits/gtk/script_utilities.py
@@ -47,21 +47,6 @@ class Utilities(script_utilities.Utilities):
         self._isTypeahead = {}
         self._isUselessPanel = {}
 
-    def displayedText(self, obj):
-        displayedText = script_utilities.Utilities.displayedText(self, obj)
-        if displayedText:
-            return displayedText
-
-        # Present GtkLabel children inside a GtkListBox row.
-        if obj.parent and obj.parent.getRole() == pyatspi.ROLE_LIST_BOX:
-            labels = self.unrelatedLabels(obj)
-            if not labels:
-                labels = self.unrelatedLabels(obj, onlyShowing=False)
-            displayedText = " ".join(map(self.displayedText, labels))
-
-        self._script.generatorCache[self.DISPLAYED_TEXT][obj] = displayedText
-        return displayedText
-
     def infoBar(self, root):
         isInfoBar = lambda x: x and x.getRole() == pyatspi.ROLE_INFO_BAR
         return pyatspi.findDescendant(root, isInfoBar)
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index e341649..fef7c4c 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -2046,7 +2046,8 @@ class SpeechGenerator(generator.Generator):
         if obj.parent and obj.parent.getRole() == pyatspi.ROLE_LIST_BOX:
             widgets = pyatspi.findAllDescendants(obj, isWidget)
             for widget in widgets:
-                result.append(self.generate(widget, includeContext=False))
+                if self._script.utilities.isShowingAndVisible(widget):
+                    result.append(self.generate(widget, includeContext=False))
 
         return result
 


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