[orca] Create a single isWordMisspelled() which handles the error attributes we see



commit b7e0739b97ce40f2636367de54fa24c5ea8ad95a
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Jun 6 14:21:40 2015 -0400

    Create a single isWordMisspelled() which handles the error attributes we see

 src/orca/script_utilities.py                       |    8 ++++++++
 src/orca/scripts/apps/soffice/script_utilities.py  |   17 -----------------
 .../scripts/toolkits/Gecko/script_utilities.py     |   17 -----------------
 3 files changed, 8 insertions(+), 34 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index dd49016..bf47c4e 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1672,6 +1672,14 @@ class Utilities:
         Returns True if the word is flagged as misspelled.
         """
 
+        attributes, start, end  = self.textAttributes(obj, offset, True)
+        if attributes.get("invalid") == "spelling":
+            return True
+        if attributes.get("text-spelling") == "misspelled":
+            return True
+        if attributes.get("underline") == "error":
+            return True
+
         return False
 
     def queryNonEmptyText(self, obj):
diff --git a/src/orca/scripts/apps/soffice/script_utilities.py 
b/src/orca/scripts/apps/soffice/script_utilities.py
index 1f1bc09..d07090b 100644
--- a/src/orca/scripts/apps/soffice/script_utilities.py
+++ b/src/orca/scripts/apps/soffice/script_utilities.py
@@ -616,23 +616,6 @@ class Utilities(script_utilities.Utilities):
     #                                                                       #
     #########################################################################
 
-    def isWordMisspelled(self, obj, offset):
-        """Identifies if the current word is flagged as misspelled by the
-        application.
-
-        Arguments:
-        - obj: An accessible which implements the accessible text interface.
-        - offset: Offset in the accessible's text for which to retrieve the
-          attributes.
-
-        Returns True if the word is flagged as misspelled.
-        """
-
-        attributes, start, end  = self.textAttributes(obj, offset, True)
-        error = attributes.get("text-spelling")
-
-        return error == "misspelled"
-
     def textAttributes(self, acc, offset, get_defaults=False):
         """Get the text attributes run for a given offset in a given accessible
 
diff --git a/src/orca/scripts/toolkits/Gecko/script_utilities.py 
b/src/orca/scripts/toolkits/Gecko/script_utilities.py
index 3c5bf72..50a3124 100644
--- a/src/orca/scripts/toolkits/Gecko/script_utilities.py
+++ b/src/orca/scripts/toolkits/Gecko/script_utilities.py
@@ -460,23 +460,6 @@ class Utilities(script_utilities.Utilities):
 
         return descendants
 
-    def isWordMisspelled(self, obj, offset):
-        """Identifies if the current word is flagged as misspelled by the
-        application.
-
-        Arguments:
-        - obj: An accessible which implements the accessible text interface.
-        - offset: Offset in the accessible's text for which to retrieve the
-          attributes.
-
-        Returns True if the word is flagged as misspelled.
-        """
-
-        attributes, start, end  = self.textAttributes(obj, offset, True)
-        error = attributes.get("invalid")
-
-        return error == "spelling"
-
     def setCaretOffset(self, obj, characterOffset):
         self.setCaretPosition(obj, characterOffset)
         self._script.updateBraille(obj)


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