[orca/gnome-42] Fix KeyError resulting from existing "string" argument
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-42] Fix KeyError resulting from existing "string" argument
- Date: Wed, 20 Apr 2022 10:19:32 +0000 (UTC)
commit 628a796fcd66e92ed435caffc60f15c85ec8a8a2
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Apr 20 12:13:13 2022 +0200
Fix KeyError resulting from existing "string" argument
_generateCurrentLineText may be called with an existing "string"
argument. Because we're potentially breaking the string up, based
on attributes such as language or formatting, this existing argument
is irrelevant. Plus calling voice() with two string arguments causes
a KeyError which interrupts the generation. Handle this condition by
removing the existing "string" argument before calling voice().
src/orca/speech_generator.py | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 08d6e320e..d71ea03c8 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1243,6 +1243,11 @@ class SpeechGenerator(generator.Generator):
if not string:
continue
args["language"], args["dialect"] = language, dialect
+ if "string" in args:
+ msg = "INFO: Found existing string '%s'; using '%s'" % (args.get("string"), string)
+ debug.println(debug.LEVEL_INFO, msg)
+ args.pop("string")
+
voice = self.voice(string=string, obj=obj, **args)
string = self._script.utilities.adjustForLinks(obj, string, start)
rv = [self._script.utilities.adjustForRepeats(string)]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]