[orca/gnome-2-28] Work on bgo#597159 - Orca does not provide access to the contents of Packagemanager's HTML container



commit 7ce1842dc1a9d4819981644d428f88f0dc260197
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Thu Nov 5 18:58:15 2009 -0500

    Work on bgo#597159 - Orca does not provide access to the contents of Packagemanager's HTML container.
    
    Display the built-up line content in braille.

 src/orca/scripts/apps/packagemanager/script.py |   42 ++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/apps/packagemanager/script.py b/src/orca/scripts/apps/packagemanager/script.py
index e427b7d..4653d0b 100644
--- a/src/orca/scripts/apps/packagemanager/script.py
+++ b/src/orca/scripts/apps/packagemanager/script.py
@@ -27,6 +27,7 @@ __license__   = "LGPL"
 
 import pyatspi
 
+import orca.braille as braille
 import orca.default as default
 import orca.orca as orca
 import orca.orca_state as orca_state
@@ -186,6 +187,47 @@ class Script(default.Script):
 
         return True
 
+    def updateBraille(self, obj, extraRegion=None):
+        """Updates the braille display to show the given object.
+
+        Arguments:
+        - obj: the Accessible
+        - extra: extra Region to add to the end
+        """
+
+        if not self.getAncestor(
+           obj, [pyatspi.ROLE_HTML_CONTAINER], [pyatspi.ROLE_FRAME]):
+            return default.Script.updateBraille(self, obj, extraRegion)
+
+        try:
+            text = obj.queryText()
+        except:
+            return default.Script.updateBraille(self, obj, extraRegion)
+
+        braille.clear()
+        line = braille.Line()
+        braille.addLine(line)
+
+        focusedRegion = None
+        contents = self.getLineContentsAtOffset(obj, text.caretOffset)
+        for i, content in enumerate(contents):
+            child, startOffset, endOffset, string = content
+            isFocusedObj = self.isSameObject(child, obj)
+            regions = [braille.Text(child,
+                                    startOffset=startOffset,
+                                    endOffset=endOffset)]
+
+            if isFocusedObj:
+                focusedRegion = regions[0]
+
+            line.addRegions(regions)
+
+        if extraRegion:
+            line.addRegion(extraRegion)
+
+        braille.setFocus(focusedRegion, getLinkMask=False)
+        braille.refresh(panToCursor=True, getLinkMask=False)
+
     def sayLine(self, obj):
         """Speaks the line at the current caret position."""
 



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