[orca] Fix several issues related to LibreOffice dialog presentation



commit 0a50d25b97c49f0948257d13d147ac94ac8fa4ad
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Aug 4 14:12:10 2015 -0400

    Fix several issues related to LibreOffice dialog presentation

 src/orca/formatting.py                            |    2 +-
 src/orca/script_utilities.py                      |    2 ++
 src/orca/scripts/apps/soffice/script.py           |   15 +++++++++------
 src/orca/scripts/apps/soffice/script_utilities.py |    4 ++--
 src/orca/scripts/apps/soffice/speech_generator.py |   11 +++++++++++
 5 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 997ca27..ec00bd1 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -141,7 +141,7 @@ formatting = {
             },
         pyatspi.ROLE_COMBO_BOX: {
             'focused': 'expandableState',
-            'unfocused': 'label + name + roleName + pause + positionInList + ' + MNEMONIC + ' + accelerator',
+            'unfocused': 'labelAndName + roleName + pause + positionInList + ' + MNEMONIC + ' + accelerator',
             'basicWhereAmI': 'label + roleName + pause + name + positionInList + ' + MNEMONIC + ' + 
accelerator'
             },
         pyatspi.ROLE_DIAL: {
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 87bdc54..a6181c7 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2872,6 +2872,8 @@ class Utilities:
             return True
 
         topLevelRoles = [pyatspi.ROLE_APPLICATION,
+                         pyatspi.ROLE_ALERT,
+                         pyatspi.ROLE_DIALOG,
                          pyatspi.ROLE_WINDOW,
                          pyatspi.ROLE_FRAME]
         if obj.getIndexInParent() == -1 and role not in topLevelRoles:
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index f317a84..a04b97f 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -829,6 +829,9 @@ class Script(default.Script):
         # This callback remains just to handle bugs in applications and toolkits
         # during the remainder of the unstable (3.11) development cycle.
 
+        if self.utilities.isSameObject(orca_state.locusOfFocus, event.source):
+            return
+
         role = event.source.getRole()
 
         # This seems to be something we inherit from Gtk+
@@ -883,16 +886,16 @@ class Script(default.Script):
         if role == pyatspi.ROLE_MENU:
             return
 
-        obj, offset = self.pointOfReference.get("lastCursorPosition", (None, -1))
-        textSelections = self.pointOfReference.get('textSelections', {})
-        start, end = textSelections.get(hash(obj), (0, 0))
-        if start != end:
-            return
-
         if self.utilities._flowsFromOrToSelection(event.source):
             return
 
         if role == pyatspi.ROLE_PARAGRAPH:
+            obj, offset = self.pointOfReference.get("lastCursorPosition", (None, -1))
+            textSelections = self.pointOfReference.get('textSelections', {})
+            start, end = textSelections.get(hash(obj), (0, 0))
+            if start != end:
+                return
+
             keyString, mods = self.utilities.lastKeyAndModifiers()
             if keyString in ["Left", "Right"]:
                 orca.setLocusOfFocus(event, event.source, False)
diff --git a/src/orca/scripts/apps/soffice/script_utilities.py 
b/src/orca/scripts/apps/soffice/script_utilities.py
index 2ba0546..22ed99a 100644
--- a/src/orca/scripts/apps/soffice/script_utilities.py
+++ b/src/orca/scripts/apps/soffice/script_utilities.py
@@ -299,8 +299,8 @@ class Utilities(script_utilities.Utilities):
 
         return rowHeader, colHeader
 
-    def isSameObject(self, obj1, obj2):
-        same = script_utilities.Utilities.isSameObject(self, obj1, obj2)
+    def isSameObject(self, obj1, obj2, comparePaths=False, ignoreNames=False):
+        same = super().isSameObject(obj1, obj2, comparePaths, ignoreNames)
         if not same or obj1 == obj2:
             return same
 
diff --git a/src/orca/scripts/apps/soffice/speech_generator.py 
b/src/orca/scripts/apps/soffice/speech_generator.py
index b315cc8..915e48c 100644
--- a/src/orca/scripts/apps/soffice/speech_generator.py
+++ b/src/orca/scripts/apps/soffice/speech_generator.py
@@ -77,6 +77,9 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
     def _generateTextRole(self, obj, **args):
         result = []
         role = args.get('role', obj.getRole())
+        if role == pyatspi.ROLE_TEXT and obj.parent.getRole() == pyatspi.ROLE_COMBO_BOX:
+            return []
+
         if role != pyatspi.ROLE_PARAGRAPH \
            or self.__overrideParagraph(obj, **args):
             result.extend(self._generateRoleName(obj, **args))
@@ -109,6 +112,9 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
         if nothing can be found.
         """
         role = args.get('role', obj.getRole())
+        if role == pyatspi.ROLE_TEXT and obj.parent.getRole() == pyatspi.ROLE_COMBO_BOX:
+            return []
+
         if role in [pyatspi.ROLE_PUSH_BUTTON, pyatspi.ROLE_TOGGLE_BUTTON] \
            and self._script.utilities.ancestorWithRole(
                 obj, [pyatspi.ROLE_TOOL_BAR], [pyatspi.ROLE_FRAME]):
@@ -123,6 +129,11 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
 
     def _generateLabelOrName(self, obj, **args):
         """Gets the label or the name if the label is not preset."""
+
+        role = args.get('role', obj.getRole())
+        if role == pyatspi.ROLE_TEXT and obj.parent.getRole() == pyatspi.ROLE_COMBO_BOX:
+            return []
+
         result = []
         acss = self.voice(speech_generator.DEFAULT)
         override = self.__overrideParagraph(obj, **args)



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