[orca/570658] Work on including ancestors and context



commit 5f734e74780cca83f3ba1acba10e566113068f0d
Author: Willie Walker <william walker sun com>
Date:   Tue Jul 7 11:39:35 2009 -0400

    Work on including ancestors and context
    
    For radio buttons, we do not want to include the radio button group,
    but we want to include other encapsulating labeled panels.  For
    text, we only want to include context when we're on the first line
    of text in a document.

 src/orca/braille_generator.py |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 0d9db19..e13532b 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -184,6 +184,16 @@ class BrailleGenerator(generator.Generator):
             return result
         args['includeContext'] = False
 
+        # Radio button group names are treated separately from the
+        # ancestors.  However, they can appear in the ancestry as a
+        # labeled panel.  So, we need to exlude the first one of
+        # these things we come across.  See also the
+        # generator.py:_generateRadioButtonGroup method that is
+        # used to find the radio button group name.
+        #
+        role = args.get('role', obj.getRole())
+        excludeRadioButtonGroup = role == pyatspi.ROLE_RADIO_BUTTON
+
         parent = obj.parent
         if parent and (parent.getRole() in self.SKIP_CONTEXT_ROLES):
             parent = parent.parent
@@ -208,12 +218,15 @@ class BrailleGenerator(generator.Generator):
             # container for the grouped objects.  When we detect this,
             # we add the label to the overall context.]]]
             #
-            if parent.getRole() == pyatspi.ROLE_FILLER \
-               and obj.getRole() != pyatspi.ROLE_RADIO_BUTTON:
+            if parent.getRole() in [pyatspi.ROLE_FILLER,
+                                    pyatspi.ROLE_PANEL]:
                 label = self._script.getDisplayedLabel(parent)
                 if label and len(label) and not label.isspace():
-                    args['role'] = parent.getRole()
-                    parentResult = self.generate(parent, **args)
+                    if not excludeRadioButtonGroup:
+                        args['role'] = parent.getRole()
+                        parentResult = self.generate(parent, **args)
+                    else:
+                        excludeRadioButtonGroup = False
             if result and parentResult:
                 result.append(braille.Region(" "))
             result.extend(parentResult)
@@ -287,6 +300,12 @@ class BrailleGenerator(generator.Generator):
                 text.caretOffset,
                 pyatspi.TEXT_BOUNDARY_LINE_START)
             include = startOffset == 0
+            if include:
+                for relation in obj.getRelationSet():
+                    if relation.getRelationType() \
+                            == pyatspi.RELATION_FLOWS_FROM:
+                        include = \
+                            not self._script.isTextArea(relation.getTarget(0))
         return include
 
     #####################################################################



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