Skip to content

Commit 2e74e8a

Browse files
authored
Merge pull request #28 from actlaboratory/cat/bug
Fix a crash bug on the latest NVDA
2 parents bf48002 + 6e3095b commit 2e74e8a

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ public/*.md
1212
output/
1313
UML-snapshot.zip
1414
UML-snapshot_info.json
15+
venv/

addon/synthDrivers/UML.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def __init__(self):
114114
synth = synthDriverHandler._getSynthDriver(v)()
115115
synth.initSettings()
116116
self.synthInstanceMap[k] = synth
117+
print("synth added as key %s" % k)
117118
except BaseException as e:
118119
raise InitializationError(
119120
"Failed to load %s (reason: %s)" % (v, e))
@@ -161,18 +162,22 @@ def terminate(self):
161162
self.thread.join()
162163

163164
def speak(self, seq):
165+
print("last_lang: %s, dictionary keys: %s" % (self.last_lang, list(self.synthInstanceMap.keys())))
164166
synth = self.synthInstanceMap[self.last_lang]
165167
textList = []
166168
for i, item in enumerate(seq):
167169
if isinstance(item, LangChangeCommand):
168-
if item.lang == self.last_lang:
170+
# monkeypatch: I don't know when it has changed, but apparently it receives "ja_JP" here, originally it was ja.
171+
code = item.lang.split("_")[0]
172+
if code == self.last_lang:
169173
continue
170174
if textList:
171175
_execWhenDone(self.wait_speak, synth, textList[:])
172176
textList = []
173177
# end textList exists
174-
self.last_lang = item.lang
175-
if item.lang == 'en':
178+
self.last_lang = code
179+
print("last_lang: %s" % code)
180+
if code == 'en':
176181
synth = self.synthInstanceMap['en']
177182
else:
178183
synth = self.synthInstanceMap['ja']

0 commit comments

Comments
 (0)