From 65445427fd6c6a6e108aa8728f70ff2c363e7ed9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 4 Dec 2020 06:22:51 +0530 Subject: [PATCH] Add Read aloud entry to viewer controls --- src/pyj/read_book/overlay.pyj | 7 +++++++ src/pyj/read_book/view.pyj | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pyj/read_book/overlay.pyj b/src/pyj/read_book/overlay.pyj index 913abe6b93..76fbc8940d 100644 --- a/src/pyj/read_book/overlay.pyj +++ b/src/pyj/read_book/overlay.pyj @@ -334,6 +334,13 @@ class MainOverlay: # {{{ if full_screen_actions.length: actions_div.appendChild(E.ul(*full_screen_actions)) + actions_div.appendChild(E.ul( + ac(_('Read aloud'), _('Read the book aloud'), def(): + self.overlay.hide() + self.overlay.view.start_read_aloud() + , 'bullhorn') + )) + no_selection_bar = not sd.get('show_selection_bar') if runtime.is_standalone_viewer: if no_selection_bar: diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index ff3a7bbb72..1fa6f6eb34 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -674,9 +674,11 @@ class View: else: self.iframe.contentWindow.focus() - def start_read_aloud(self): + def start_read_aloud(self, dont_start_talking): self.selection_bar.hide() self.read_aloud.show() + if not dont_start_talking: + self.read_aloud.play() def show_chrome(self, data): elements = {}