orca r4066 - in trunk: . src/orca src/orca/scripts/apps/soffice src/orca/scripts/toolkits/Gecko



Author: wwalker
Date: Sat Jul 26 23:35:05 2008
New Revision: 4066
URL: http://svn.gnome.org/viewvc/orca?rev=4066&view=rev

Log:
More work on bug #542714 - Orca should indicate read-only text boxes.


Modified:
   trunk/ChangeLog
   trunk/src/orca/braillegenerator.py
   trunk/src/orca/default.py
   trunk/src/orca/scripts/apps/soffice/script.py
   trunk/src/orca/scripts/toolkits/Gecko/braille_generator.py
   trunk/src/orca/scripts/toolkits/Gecko/script.py
   trunk/src/orca/scripts/toolkits/Gecko/speech_generator.py
   trunk/src/orca/speechgenerator.py
   trunk/src/orca/where_am_I.py

Modified: trunk/src/orca/braillegenerator.py
==============================================================================
--- trunk/src/orca/braillegenerator.py	(original)
+++ trunk/src/orca/braillegenerator.py	Sat Jul 26 23:35:05 2008
@@ -864,7 +864,7 @@
             regions.append(braille.Region(" " + text))
 
         if settings.presentReadOnlyText \
-           and not obj.getState().contains(pyatspi.STATE_EDITABLE):
+           and self._script.isReadOnlyTextArea(obj):
             regions.append(braille.Region(" " \
                                           + settings.brailleReadOnlyString))
 

Modified: trunk/src/orca/default.py
==============================================================================
--- trunk/src/orca/default.py	(original)
+++ trunk/src/orca/default.py	Sat Jul 26 23:35:05 2008
@@ -2041,6 +2041,17 @@
                               pyatspi.ROLE_PARAGRAPH,
                               pyatspi.ROLE_TERMINAL)
 
+    def isReadOnlyTextArea(self, obj):
+        """Returns True if obj is a text entry area that is read only."""
+        state = obj.getState()
+        readOnly = self.isTextArea(obj) \
+                   and state.contains(pyatspi.STATE_FOCUSABLE) \
+                   and not state.contains(pyatspi.STATE_EDITABLE)
+        debug.println(debug.LEVEL_ALL,
+                      "default.py:isReadOnlyTextArea=%s for %s" \
+                      % (readOnly, debug.getAccessibleDetails(obj)))
+        return readOnly
+
     def getText(self, obj, startOffset, endOffset):
         """Returns the substring of the given object's text specialization.
 

Modified: trunk/src/orca/scripts/apps/soffice/script.py
==============================================================================
--- trunk/src/orca/scripts/apps/soffice/script.py	(original)
+++ trunk/src/orca/scripts/apps/soffice/script.py	Sat Jul 26 23:35:05 2008
@@ -331,6 +331,17 @@
         except:
             debug.printException(debug.LEVEL_WARNING)
 
+    def isReadOnlyTextArea(self, obj):
+        """Returns True if obj is a text entry area that is read only."""
+        state = obj.getState()
+        readOnly = obj.getRole() == pyatspi.ROLE_TEXT \
+                   and state.contains(pyatspi.STATE_FOCUSABLE) \
+                   and not state.contains(pyatspi.STATE_EDITABLE)
+        debug.println(debug.LEVEL_ALL,
+                      "soffice.script.py:isReadOnlyTextArea=%s for %s" \
+                      % (readOnly, debug.getAccessibleDetails(obj)))
+        return readOnly
+
     def adjustForWriterTable(self, obj):
         """Check to see if we are in Writer, where the object with focus
         is a paragraph, and the parent is the table cell. If it is, then,

Modified: trunk/src/orca/scripts/toolkits/Gecko/braille_generator.py
==============================================================================
--- trunk/src/orca/scripts/toolkits/Gecko/braille_generator.py	(original)
+++ trunk/src/orca/scripts/toolkits/Gecko/braille_generator.py	Sat Jul 26 23:35:05 2008
@@ -250,7 +250,7 @@
         regions.append(textRegion)
 
         if settings.presentReadOnlyText \
-           and not obj.getState().contains(pyatspi.STATE_EDITABLE):
+           and self._script.isReadOnlyTextArea(obj):
             regions.append(braille.Region(" " \
                                           + settings.brailleReadOnlyString))
 

Modified: trunk/src/orca/scripts/toolkits/Gecko/script.py
==============================================================================
--- trunk/src/orca/scripts/toolkits/Gecko/script.py	(original)
+++ trunk/src/orca/scripts/toolkits/Gecko/script.py	Sat Jul 26 23:35:05 2008
@@ -4440,6 +4440,17 @@
     #                                                                  #
     ####################################################################
 
+    def isReadOnlyTextArea(self, obj):
+        """Returns True if obj is a text entry area that is read only."""
+        state = obj.getState()
+        readOnly = obj.getRole() == pyatspi.ROLE_ENTRY \
+                   and state.contains(pyatspi.STATE_FOCUSABLE) \
+                   and not state.contains(pyatspi.STATE_EDITABLE)
+        debug.println(debug.LEVEL_ALL,
+                      "Gecko.script.py:isReadOnlyTextArea=%s for %s" \
+                      % (readOnly, debug.getAccessibleDetails(obj)))
+        return readOnly
+
     def clearCaretContext(self):
         """Deletes all knowledge of a character context for the current
         document frame."""

Modified: trunk/src/orca/scripts/toolkits/Gecko/speech_generator.py
==============================================================================
--- trunk/src/orca/scripts/toolkits/Gecko/speech_generator.py	(original)
+++ trunk/src/orca/scripts/toolkits/Gecko/speech_generator.py	Sat Jul 26 23:35:05 2008
@@ -144,7 +144,7 @@
                 self, obj, already_focused)
 
         if settings.presentReadOnlyText \
-           and not obj.getState().contains(pyatspi.STATE_EDITABLE):
+           and self._script.isReadOnlyTextArea(obj):
             utterances.append(settings.speechReadOnlyString)
 
         utterances.extend(self.getSpeechForObjectRole(obj))

Modified: trunk/src/orca/speechgenerator.py
==============================================================================
--- trunk/src/orca/speechgenerator.py	(original)
+++ trunk/src/orca/speechgenerator.py	Sat Jul 26 23:35:05 2008
@@ -962,7 +962,7 @@
                 utterances.append(obj.name)
 
         if settings.presentReadOnlyText \
-           and not obj.getState().contains(pyatspi.STATE_EDITABLE):
+           and self._script.isReadOnlyTextArea(obj):
             utterances.append(settings.speechReadOnlyString)
 
         if obj.getRole() != pyatspi.ROLE_PARAGRAPH:

Modified: trunk/src/orca/where_am_I.py
==============================================================================
--- trunk/src/orca/where_am_I.py	(original)
+++ trunk/src/orca/where_am_I.py	Sat Jul 26 23:35:05 2008
@@ -501,7 +501,7 @@
         utterances.append(text)
 
         if settings.presentReadOnlyText \
-           and not obj.getState().contains(pyatspi.STATE_EDITABLE):
+           and self._script.isReadOnlyTextArea(obj):
             utterances.append(settings.speechReadOnlyString)
 
         text = rolenames.getSpeechForRoleName(obj)



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