[orca] Update the soffice script to work better with setLocusOfFocus and onCaretMoved



commit c4a11f2efac9bf05a47d6a35de7503cb0ba1a5ee
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Nov 24 22:56:15 2015 -0500

    Update the soffice script to work better with setLocusOfFocus and onCaretMoved
    
    The changes to setLocusOfFocus and onCaretMoved made Orca far more tolerant
    regarding what to treat as a valid updates. As a result, Orca is now less
    likely to fail to present something. The soffice script, however, was forcing
    updates to ensure something would be spoken. That needed to be removed.

 src/orca/scripts/apps/soffice/script.py |   46 ++++++++-----------------------
 1 files changed, 12 insertions(+), 34 deletions(-)
---
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index a881d81..32dcc7a 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -792,50 +792,28 @@ class Script(default.Script):
         default.Script.onFocusedChanged(self, event)
 
     def onCaretMoved(self, event):
-        """Called whenever the caret moves.
+        """Callback for object:text-caret-moved accessibility events."""
 
-        Arguments:
-        - event: the Event
-        """
-
-        if self.isStructuralNavigationCommand():
-            return
 
         if event.detail1 == -1:
             return
 
-        if self.utilities.isCellBeingEdited(event.source):
-            orca.setLocusOfFocus(event, event.source.parent, False)
-
-        if not orca_state.locusOfFocus \
-           or self.utilities.isZombie(orca_state.locusOfFocus):
-            orca.setLocusOfFocus(event, event.source)
-            default.Script.onCaretMoved(self, event)
-            return
+        if self.utilities._flowsFromOrToSelection(event.source):
+           return
 
-        if orca_state.locusOfFocus.getRole() == pyatspi.ROLE_TABLE_CELL:
-            default.Script.onCaretMoved(self, event)
+        if self.isStructuralNavigationCommand():
             return
 
-        # The lists and combo boxes in the Formatting toolbar emit
-        # object:active-descendant-changed events which cause us
-        # to set the locusOfFocus to the list item. If the user then
-        # arrows within the text portion, we will not present it due
-        # to the event not being from the locusOfFocus. A similar
-        # issue is present in the Target entry of the Hyperlink dialog
-        # for OOo 3.2.
-        #
-        if event.source.getRole() == pyatspi.ROLE_TEXT \
-           and self.utilities.ancestorWithRole(
-               event.source,
-               [pyatspi.ROLE_TOOL_BAR, pyatspi.ROLE_DIALOG],
-               [pyatspi.ROLE_FRAME]):
-            orca.setLocusOfFocus(event, event.source, False)
+        if self.utilities.isSpreadSheetCell(orca_state.locusOfFocus):
+            msg = "SOFFICE: locusOfFocus %s is spreadsheet cell" % orca_state.locusOfFocus
+            debug.println(debug.LEVEL_INFO, msg)
 
-        if self.utilities._flowsFromOrToSelection(event.source):
-            return
+            if not self.utilities.isCellBeingEdited(event.source):
+                msg = "SOFFICE: Event ignored: Source is not cell being edited."
+                debug.println(debug.LEVEL_INFO, msg)
+                return
 
-        default.Script.onCaretMoved(self, event)
+        super().onCaretMoved(event)
 
     def onCheckedChanged(self, event):
         """Callback for object:state-changed:checked accessibility events."""


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