[orca] Fix for bgo#594152 - positionInGroup includes non-showing objects



commit 8a46be15277ae90821f04ca662ef7185a5c474dd
Author: Willie Walker <wwalker gnome org>
Date:   Sun Apr 4 15:31:48 2010 -0400

    Fix for bgo#594152 - positionInGroup includes non-showing objects

 src/orca/speech_generator.py |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 47f8f34..66c6bb2 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1217,14 +1217,18 @@ class SpeechGenerator(generator.Generator):
         relations = obj.getRelationSet()
         for relation in relations:
             if relation.getRelationType() == pyatspi.RELATION_MEMBER_OF:
-                total = relation.getNTargets()
-                for i in range(0, total):
+                total = 0
+                for i in range(0, relation.getNTargets()):
                     target = relation.getTarget(i)
-                    if target == obj:
-                        position = total - i
-                        break
+                    if target.getState().contains(pyatspi.STATE_SHOWING):
+                        total += 1
+                        if target == obj:
+                            position = total
 
         if position >= 0:
+            # Adjust the position because the relations tend to be given
+            # in the reverse order.
+            position = total - position + 1
             result.append(self._script.formatting.getString(
                               mode='speech',
                               stringType='groupindex') \



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