embed_tts API in boss

This commit is contained in:
Kovid Goyal 2024-10-17 15:07:44 +05:30
parent aaa3d2f658
commit 4643ca6a1d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1664,6 +1664,19 @@ class Boss(QObject):
self.commit_all_editors_to_container() self.commit_all_editors_to_container()
self.gui.check_external_links.show() self.gui.check_external_links.show()
def embed_tts(self):
if not self.ensure_book(_('You must first open a book in order to add Text-to-speech narration.')):
return
self.commit_all_editors_to_container()
from calibre.gui2.tweak_book.tts import TTSEmbed
self.add_savepoint(_('Before: adding narration'))
d = TTSEmbed(current_container(), self.gui)
if d.exec() == QDialog.DialogCode.Accepted:
self.apply_container_update_to_gui()
self.show_current_diff()
else:
self.rewind_savepoint()
def compress_images(self): def compress_images(self):
if not self.ensure_book(_('You must first open a book in order to compress images.')): if not self.ensure_book(_('You must first open a book in order to compress images.')):
return return