[orca] Fix side effects from indeterminate progress bar handling
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix side effects from indeterminate progress bar handling
- Date: Mon, 1 Nov 2021 12:25:10 +0000 (UTC)
commit 4fa04931a1e7329d9954f95d55d6b46edb722b56
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Nov 1 13:24:34 2021 +0100
Fix side effects from indeterminate progress bar handling
* Calculate the percentage of completion, even if it has state
indeterminate, if the value is non-zero.
* Return and check for the empty string as the result of a
progress bar update. This will make it possible to distinguish truly
valueless progress bars from those which claim indeterminate progress.
src/orca/generator.py | 4 +++-
src/orca/script_utilities.py | 11 ++++++-----
src/orca/speech_generator.py | 2 +-
3 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 920fd3d24..2058a436d 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -270,7 +270,7 @@ class Generator:
duration = "%.4f" % (time.time() - startTime)
debug.println(debug.LEVEL_ALL, "%sCOMPLETION TIME: %s" % (' ' * 18, duration))
self._debugResultInfo(result)
- if args.get('isProgressBarUpdate') and result:
+ if args.get('isProgressBarUpdate') and result and result[0]:
self.setProgressBarUpdateTimeAndValue(obj)
return result
@@ -1209,6 +1209,8 @@ class Generator:
percent = self._script.utilities.getValueAsPercent(obj)
lastTime, lastValue = self.getProgressBarUpdateTimeAndValue(obj, type=self)
if percent == lastValue:
+ msg = "GENERATOR: Not presenting update for %s. Value still %s" % (obj, percent)
+ debug.println(debug.LEVEL_INFO, msg, True)
return False
if percent == 100:
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index a4b16a00b..ae32cec41 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1173,11 +1173,6 @@ class Utilities:
return True, "Not handled by any other case"
def getValueAsPercent(self, obj):
- if obj.getState().contains(pyatspi.STATE_INDETERMINATE):
- msg = "INFO: Not calculating value: %s has state indeterminate" % obj
- debug.println(debug.LEVEL_INFO, msg, True)
- return None
-
try:
value = obj.queryValue()
minval, val, maxval = value.minimumValue, value.currentValue, value.maximumValue
@@ -1190,6 +1185,12 @@ class Utilities:
debug.println(debug.LEVEL_INFO, msg, True)
return None
+ if obj.getState().contains(pyatspi.STATE_INDETERMINATE):
+ msg = "INFO: %s has state indeterminate and value of %s" % (obj, val)
+ debug.println(debug.LEVEL_INFO, msg, True)
+ if val <= 0:
+ return None
+
if maxval == minval == val:
if 1 <= val <= 100:
return int(val)
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index fe726cb93..9b789ce6a 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -2364,7 +2364,7 @@ class SpeechGenerator(generator.Generator):
def _generateProgressBarValue(self, obj, **args):
if args.get('isProgressBarUpdate') \
and not self._shouldPresentProgressBarUpdate(obj, **args):
- return []
+ return ['']
result = []
percent = self._script.utilities.getValueAsPercent(obj)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]