CS viewer: Fix read aloud broken after a configure with no changes

This commit is contained in:
Kovid Goyal 2024-11-26 14:37:53 +05:30
parent f82ea2036a
commit 0438ad7c94
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -190,6 +190,7 @@ class Client:
ut = self.current_utterance ut = self.current_utterance
self.current_utterance = None self.current_utterance = None
ut.onstart = ut.onpause = ut.onend = ut.onerror = ut.onresume = None ut.onstart = ut.onpause = ut.onend = ut.onerror = ut.onresume = None
ut.removeEventListener('boundary', self.utterance_boundary_reached)
window.speechSynthesis.cancel() window.speechSynthesis.cancel()
def resume_after_configure(self): def resume_after_configure(self):
@ -313,12 +314,11 @@ class Client:
self.current_rate = rate self.current_rate = rate
if bar_pos is not current_bar_pos: if bar_pos is not current_bar_pos:
sd.set('tts_bar_position', bar_pos) sd.set('tts_bar_position', bar_pos)
is_speaking = bool(window.speechSynthesis.speaking) is_speaking = bool(window.speechSynthesis.speaking)
if is_speaking: if is_speaking:
self.pause_for_configure() self.pause_for_configure()
self.save_settings() self.save_settings()
if is_speaking: if is_speaking:
self.resume_after_configure() self.resume_after_configure()
self.onevent('configured') self.onevent('configured')
) )