Automatically resume speaking after configuring

This commit is contained in:
Kovid Goyal 2020-12-07 09:09:05 +05:30
parent 979a016f1d
commit d82de098d1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 0 deletions

View File

@ -477,6 +477,7 @@ class WebView(RestartingWebEngineView):
self.current_cfi = self.current_content_file = None
RestartingWebEngineView.__init__(self, parent)
self.tts = TTS(self)
self.tts.settings_changed.connect(self.tts_settings_changed)
self.tts.event_received.connect(self.tts_event_received)
self.dead_renderer_error_shown = False
self.render_process_failed.connect(self.render_process_died)
@ -716,3 +717,6 @@ class WebView(RestartingWebEngineView):
def tts_event_received(self, which, data):
self.execute_when_ready('tts_event', which, data)
def tts_settings_changed(self, ui_settings):
self.execute_when_ready('tts_event', 'configured', ui_settings)

View File

@ -132,6 +132,7 @@ class ReadAloud:
def configure(self):
self.pause()
self.waiting_for_configure = True
ui_operations.tts('configure')
def play(self):
@ -200,6 +201,10 @@ class ReadAloud:
elif which is 'end':
self.state = STOPPED
self.view.show_next_spine_item()
elif which is 'configured':
if self.waiting_for_configure:
self.waiting_for_configure = False
self.play()
def send_message(self, type, **kw):
self.view.iframe_wrapper.send_message('tts', type=type, **kw)