mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Fix a regression that caused a spurious error on Windows when reading out selected text
This commit is contained in:
parent
9531c86117
commit
d0cbe42b30
@ -76,10 +76,12 @@ class Client:
|
|||||||
self.backend.speak(self.current_chunks[self.current_chunk_idx], is_cued=True)
|
self.backend.speak(self.current_chunks[self.current_chunk_idx], is_cued=True)
|
||||||
|
|
||||||
def handle_event(self, x):
|
def handle_event(self, x):
|
||||||
if isinstance(x, MarkReached) and self.current_chunks:
|
if isinstance(x, MarkReached):
|
||||||
|
if self.current_chunks:
|
||||||
self.last_mark = x.id
|
self.last_mark = x.id
|
||||||
self.callback_ignoring_errors(Event(EventType.mark, x.id))
|
self.callback_ignoring_errors(Event(EventType.mark, x.id))
|
||||||
elif isinstance(x, MediaStateChanged) and self.current_chunks:
|
elif isinstance(x, MediaStateChanged):
|
||||||
|
if self.current_chunks:
|
||||||
if x.state is MediaState.ended:
|
if x.state is MediaState.ended:
|
||||||
if self.current_chunk_idx >= len(self.current_chunks) - 1:
|
if self.current_chunk_idx >= len(self.current_chunks) - 1:
|
||||||
self.clear_chunks()
|
self.clear_chunks()
|
||||||
@ -102,8 +104,10 @@ class Client:
|
|||||||
raise KeyError(f'Unknown event type: {x}')
|
raise KeyError(f'Unknown event type: {x}')
|
||||||
|
|
||||||
def speak_simple_text(self, text):
|
def speak_simple_text(self, text):
|
||||||
self.current_callback = None
|
self.backend.pause()
|
||||||
self.clear_chunks()
|
self.clear_chunks()
|
||||||
|
self.current_callback = None
|
||||||
|
if text:
|
||||||
self.backend.speak(text)
|
self.backend.speak(text)
|
||||||
|
|
||||||
def speak_marked_text(self, text, callback):
|
def speak_marked_text(self, text, callback):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user