mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Cancel any speech in progress when hiding the selection_bar after triggering the speak aloud action on it
This commit is contained in:
parent
c92e726850
commit
23f0086ab7
@ -650,9 +650,13 @@ class SelectionBar:
|
|||||||
|
|
||||||
# show and hide {{{
|
# show and hide {{{
|
||||||
def hide(self):
|
def hide(self):
|
||||||
|
was_shown = self.state is not HIDDEN
|
||||||
self.state = HIDDEN
|
self.state = HIDDEN
|
||||||
self.container.style.display = 'none'
|
self.container.style.display = 'none'
|
||||||
self.view.focus_iframe()
|
self.view.focus_iframe()
|
||||||
|
if not was_shown and self.spoken_aloud_at_least_once:
|
||||||
|
ui_operations.speak_simple_text('') # cancel any on-going speech
|
||||||
|
self.spoken_aloud_at_least_once = False
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
sd = get_session_data()
|
sd = get_session_data()
|
||||||
@ -955,6 +959,7 @@ class SelectionBar:
|
|||||||
text = self.view.currently_showing.selection.text
|
text = self.view.currently_showing.selection.text
|
||||||
if text:
|
if text:
|
||||||
ui_operations.speak_simple_text(text)
|
ui_operations.speak_simple_text(text)
|
||||||
|
self.spoken_aloud_at_least_once = True
|
||||||
|
|
||||||
def create_highlight(self):
|
def create_highlight(self):
|
||||||
cs = self.view.currently_showing.selection
|
cs = self.view.currently_showing.selection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user