[orca] Use the same logic used in soffice to ignore duplicated caret movements



commit db52044ab6a57cfcf16855d80f0d2ab80dab7e9a
Author: José Vilmar Estácio de Souza <vilmar informal com br>
Date:   Fri Nov 15 21:00:20 2013 -0200

    Use the same logic used in soffice to ignore duplicated caret movements

 src/orca/scripts/apps/Eclipse/Makefile.am         |    3 +-
 src/orca/scripts/apps/Eclipse/script.py           |   13 ++--
 src/orca/scripts/apps/Eclipse/script_utilities.py |   73 ---------------------
 3 files changed, 6 insertions(+), 83 deletions(-)
---
diff --git a/src/orca/scripts/apps/Eclipse/Makefile.am b/src/orca/scripts/apps/Eclipse/Makefile.am
index e849129..8924942 100644
--- a/src/orca/scripts/apps/Eclipse/Makefile.am
+++ b/src/orca/scripts/apps/Eclipse/Makefile.am
@@ -1,7 +1,6 @@
 orca_python_PYTHON = \
        __init__.py \
-       script.py \
-       script_utilities.py
+       script.py
 
 orca_pythondir=$(pkgpythondir)/scripts/apps/Eclipse
 
diff --git a/src/orca/scripts/apps/Eclipse/script.py b/src/orca/scripts/apps/Eclipse/script.py
index 7312cff..efcdf77 100644
--- a/src/orca/scripts/apps/Eclipse/script.py
+++ b/src/orca/scripts/apps/Eclipse/script.py
@@ -27,7 +27,6 @@ __license__   = "LGPL"
 
 import orca.scripts.toolkits.GAIL as GAIL
 import pyatspi
-from .script_utilities import Utilities
 
 ########################################################################
 #                                                                      #
@@ -47,7 +46,10 @@ class Script(GAIL.Script):
         otherObj. Overridden here so that we can give more feedback to user.
         """
 
-        if self.utilities.isDuplicateEvent(event):
+        # Ignore caret movements in a duplicate event if the ofsset is the same
+        obj, offset = self.pointOfReference.get("lastCursorPosition", (None, -1))
+        if offset == event.detail1 \
+           and self.utilities.isSameObject(obj, event.source):
             return
 
         # Let the default script's normal behavior do its thing
@@ -59,8 +61,8 @@ class Script(GAIL.Script):
         if lastKey in self.movementKeys:
             # already spoken in default script
             return
-        obj = otherObj or event.source
 
+        obj = otherObj or event.source
         if obj.getState().contains(pyatspi.STATE_SINGLE_LINE):
             return
 
@@ -79,11 +81,6 @@ class Script(GAIL.Script):
 
         self._saveLastTextPosition(obj)
 
-    def getUtilities(self):
-        """Returns the utilities for this script."""
-
-        return Utilities(self)
-
     def onTextInserted(self, event):
         """Called whenever text is inserted into an object. Overridden here
         so that we can avoid speaking text when caret moves after new text


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