[orca] Fix for Orca not presenting the 'Command not found' label in the gnome-shell run dialog



commit 2c376c85e97fd07930f719b3b683b5b2d86c1771
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jun 5 11:16:30 2012 -0400

    Fix for Orca not presenting the 'Command not found' label in the gnome-shell run dialog

 src/orca/scripts/toolkits/CALLY/script.py |   40 ++++++++++++++--------------
 1 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/CALLY/script.py b/src/orca/scripts/toolkits/CALLY/script.py
index 4baf4f2..bc8da3b 100644
--- a/src/orca/scripts/toolkits/CALLY/script.py
+++ b/src/orca/scripts/toolkits/CALLY/script.py
@@ -216,35 +216,40 @@ class Script(default.Script):
 
         return default.Script.skipObjectEvent(self, event)
 
-    def onNameChanged(self, event):
-        """Called whenever a property on an object changes.
-
-        Arguments:
-        - event: the Event
-        """
+    def presentDialogLabel(self, event):
+        """Examines and, if appropriate, presents a new or changed label
+        found in a dialog box. Returns True if we handled the presentation
+        here."""
 
         try:
             role = event.source.getRole()
             name = event.source.name
         except:
-            return
+            return False
 
         activeDialog, timestamp = self._activeDialog
         if not activeDialog or role != pyatspi.ROLE_LABEL:
-            default.Script.onNameChanged(self, event)
-            return
+            return False
 
-        # This seems to get us the labels which appear (bad password)
-        # and changes (will log out in 50... 40... seconds). But we
-        # also see these events when the dialog first becomes active.
-        # And we also seem to get duplicate events.
         obj = hash(event.source)
         if name == self._activeDialogLabels.get(obj):
-            return
+            return True
 
         if activeDialog == _parentDialog(event.source):
             self.presentMessage(name)
             self._activeDialogLabels[obj] = name
+            return True
+
+        return False
+
+    def onNameChanged(self, event):
+        """Called whenever a property on an object changes.
+
+        Arguments:
+        - event: the Event
+        """
+
+        if self.presentDialogLabel(event):
             return
 
         default.Script.onNameChanged(self, event)
@@ -283,13 +288,8 @@ class Script(default.Script):
                 self._activeDialogLabels = {}
                 return
 
-            # This is to minimize chattiness. So far it seems that labels
-            # which pop up (wrong password) or change (50 seconds to log
-            # out) cause name-changed events. If we later find out that
-            # we care about a state-showing label in the current dialog, we
-            # should add a timestamp check into the new heuristic.
             if activeDialog and role == pyatspi.ROLE_LABEL and event.detail1:
-                if activeDialog == _parentDialog(event.source):
+                if self.presentDialogLabel(event):
                     return
 
         elif eType.startswith("object:state-changed:focused") and event.detail1:



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