orca r4039 - in trunk: . src/orca test/keystrokes/firefox



Author: joanied
Date: Thu Jul 17 17:48:09 2008
New Revision: 4039
URL: http://svn.gnome.org/viewvc/orca?rev=4039&view=rev

Log:
* src/orca/default.py:
  test/keystrokes/firefox/moz_progressbar.py:
  Fix for bug #542260 - Orca should only keep track of active/non-
  defunct progress bars.


Modified:
   trunk/ChangeLog
   trunk/src/orca/default.py
   trunk/test/keystrokes/firefox/moz_progressbar.py

Modified: trunk/src/orca/default.py
==============================================================================
--- trunk/src/orca/default.py	(original)
+++ trunk/src/orca/default.py	Thu Jul 17 17:48:09 2008
@@ -2610,6 +2610,27 @@
                orca_state.locusOfFocus.getApplication() == obj.getApplication():
                 currentTime = time.time()
 
+                # Check for defunct progress bars. Get rid of them if they
+                # are all defunct. Also find out which progress bar was
+                # the most recently updated.
+                #
+                defunctBars = 0
+                mostRecentUpdate = [obj, 0]
+                for key, value in self.lastProgressBarTime.items():
+                    if value > mostRecentUpdate[1]:
+                        mostRecentUpdate = [key, value]
+                    try:
+                        isDefunct = \
+                            key.getState().contains(pyatspi.STATE_DEFUNCT)
+                    except:
+                        isDefunct = True
+                    if isDefunct:
+                        defunctBars += 1
+
+                if defunctBars == len(self.lastProgressBarTime):
+                    self.lastProgressBarTime = {}
+                    self.lastProgressBarValue = {}
+
                 # If this progress bar is not already known, create initial
                 # values for it.
                 #
@@ -2634,12 +2655,14 @@
                         # bar is updating at the same time in a window.
                         # If this is the case, then speak the index of this
                         # progress bar in the dictionary of known progress
-                        # bars, as well as the value.
+                        # bars, as well as the value. But only speak the
+                        # index if this progress bar was not the most
+                        # recently updated to prevent chattiness.
                         #
                         if len(self.lastProgressBarTime) > 1:
                             index = 0
                             for key in self.lastProgressBarTime.keys():
-                                if key == obj:
+                                if key == obj and key != mostRecentUpdate[0]:
                                     # Translators: this is an index value
                                     # so that we can tell which progress bar
                                     # we are referring to.

Modified: trunk/test/keystrokes/firefox/moz_progressbar.py
==============================================================================
--- trunk/test/keystrokes/firefox/moz_progressbar.py	(original)
+++ trunk/test/keystrokes/firefox/moz_progressbar.py	Thu Jul 17 17:48:09 2008
@@ -140,29 +140,17 @@
                            pyatspi.ROLE_PROGRESS_BAR,
                            5000))
 
-
 sequence.append(utils.AssertPresentationAction(
     "progress output", 
-    ["BUG? - We're also speaking the progress bar number.  We weren't before.  Should we be?",
-     "SPEECH OUTPUT: 'Progress bar 2.'",
-     "SPEECH OUTPUT: '10 percent. '",
-     "SPEECH OUTPUT: 'Progress bar 2.'",
+    ["SPEECH OUTPUT: '10 percent. '",
      "SPEECH OUTPUT: '20 percent. '",
-     "SPEECH OUTPUT: 'Progress bar 2.'",
      "SPEECH OUTPUT: '30 percent. '",
-     "SPEECH OUTPUT: 'Progress bar 2.'",
      "SPEECH OUTPUT: '40 percent. '",
-     "SPEECH OUTPUT: 'Progress bar 2.'",
      "SPEECH OUTPUT: '50 percent. '",
-     "SPEECH OUTPUT: 'Progress bar 2.'",
      "SPEECH OUTPUT: '60 percent. '",
-     "SPEECH OUTPUT: 'Progress bar 2.'",
      "SPEECH OUTPUT: '70 percent. '",
-     "SPEECH OUTPUT: 'Progress bar 2.'",
      "SPEECH OUTPUT: '80 percent. '",
-     "SPEECH OUTPUT: 'Progress bar 2.'",
      "SPEECH OUTPUT: '90 percent. '",
-     "SPEECH OUTPUT: 'Progress bar 2.'",
      "SPEECH OUTPUT: '100 percent. '"]))
 
 ########################################################################



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