[orca] The AT-SPI2 timeout handling continues.



commit e3e0984cc4104e8ed7a20f198f18d3290cf7e012
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Apr 10 13:23:27 2012 -0400

    The AT-SPI2 timeout handling continues.

 src/orca/braille_generator.py             |   12 +++++++++---
 src/orca/script_utilities.py              |    2 +-
 src/orca/scripts/apps/metacity/script.py  |   11 +++++++++--
 src/orca/scripts/toolkits/Gecko/script.py |   15 +++++++++++----
 src/orca/speech_generator.py              |    5 ++++-
 5 files changed, 34 insertions(+), 11 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 4dac26c..f28a8c3 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -193,8 +193,11 @@ class BrailleGenerator(generator.Generator):
         I wonder if this string should be moved to settings.py.]]]
         """
         result = []
-        alertAndDialogCount = \
-            self._script.utilities.unfocusedAlertAndDialogCount(obj)
+        try:
+            alertAndDialogCount = \
+                self._script.utilities.unfocusedAlertAndDialogCount(obj)
+        except:
+            alertAndDialogCount = 0
         if alertAndDialogCount > 0:
             # Translators: this tells the user how many unfocused
             # alert and dialog windows plus the total number of
@@ -288,7 +291,10 @@ class BrailleGenerator(generator.Generator):
         details.
         """
         result = []
-        relations = obj.getRelationSet()
+        try:
+            relations = obj.getRelationSet()
+        except:
+            relations = []
         for relation in relations:
             if relation.getRelationType() ==  pyatspi.RELATION_LABELLED_BY:
                 labelledBy = relation.getTarget(0)
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 40076d7..1c9dd90 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2870,7 +2870,7 @@ class Utilities:
         #
         try:
             bindingStrings = action.getKeyBinding(0).decode("UTF-8").split(';')
-        except AttributeError:
+        except:
             self._script.generatorCache[self.KEY_BINDING][obj] = ["", "", ""]
             return self._script.generatorCache[self.KEY_BINDING][obj]
 
diff --git a/src/orca/scripts/apps/metacity/script.py b/src/orca/scripts/apps/metacity/script.py
index a0e9141..7a32cd4 100644
--- a/src/orca/scripts/apps/metacity/script.py
+++ b/src/orca/scripts/apps/metacity/script.py
@@ -84,8 +84,15 @@ class Script(default.Script):
         found = False
         for app in self.utilities.knownApplications():
             i = 0
-            while i < app.childCount:
-                win = app.getChildAtIndex(i)
+            try:
+                childCount = app.childCount
+            except:
+                continue
+            while i < childCount:
+                try:
+                    win = app.getChildAtIndex(i)
+                except:
+                    win = None
                 if win is None:
                     print "app error " + app.name
                 elif win.name == objName:
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 71129f0..0ccf54a 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1456,10 +1456,17 @@ class Script(default.Script):
             self.liveMngr.handleEvent(event)
             return
 
-        if event.type.startswith("object:children-changed:add") \
-           and event.any_data.getRole() == pyatspi.ROLE_ALERT \
-           and event.source.getRole() in [pyatspi.ROLE_SCROLL_PANE,
-                                          pyatspi.ROLE_FRAME]:
+        if event.type.startswith("object:children-changed:add"):
+            try:
+                role = event.source.getRole()
+                childRole = event.any_data.getRole()
+            except:
+                return
+
+            if not (childRole == pyatspi.ROLE_ALERT \
+               and role in [pyatspi.ROLE_SCROLL_PANE, pyatspi.ROLE_FRAME]):
+                return
+
             utterances = []
             utterances.append(
                 self.speechGenerator.getLocalizedRoleName(event.any_data))
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index f6dbed9..4d98e4f 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1650,7 +1650,10 @@ class SpeechGenerator(generator.Generator):
         position = -1
         total = -1
 
-        relations = obj.getRelationSet()
+        try:
+            relations = obj.getRelationSet()
+        except:
+            relations = []
         for relation in relations:
             if relation.getRelationType() == pyatspi.RELATION_MEMBER_OF:
                 total = 0



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