Skip to content

Commit

Permalink
Fixed the bug on clicking YES to open ebook on finish notification.
Browse files Browse the repository at this point in the history
  • Loading branch information
bookfere committed Mar 29, 2023
1 parent f8b8ef4 commit 80197d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EbookTranslator(InterfaceActionBase):
title = _(name)
supported_platforms = ['windows', 'osx', 'linux']
author = 'bookfere.com'
version = (1, 0, 0)
version = (1, 0, 1)
minimum_calibre_version = (1, 0, 0)

actual_plugin = 'calibre_plugins.ebook_translator.ui:EbookTranslatorGui'
Expand Down
14 changes: 9 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class MainWindowFrame(QDialog):
def __init__(self, plugin, icon, ebooks):
self.gui = plugin.gui
QDialog.__init__(self, self.gui)
self.db = self.gui.current_db
self.api = self.db.new_api
self.plugin = plugin
self.icon = icon
self.ebooks = ebooks
Expand Down Expand Up @@ -245,12 +247,13 @@ def translate_done(self, job):
shutil.move(temp_file, output_path)
else:
if job.same_format:
self.gui.current_db.save_original_format(
self.db.save_original_format(
book_id, ofmt, notify=False)

with open(temp_file, 'rb') as data:
self.gui.current_db.add_format(
self.db.add_format(
book_id, ofmt, data, index_is_id=True)
output_path = self.api.format_abspath(book_id, ofmt)
os.remove(temp_file)

self.gui.tags_view.recount()
Expand All @@ -265,8 +268,10 @@ def translate_done(self, job):
job.description + ' ' + _('completed'), 5000)

self.gui.proceed_question(
lambda payload: payload(['ebook-viewer', output_path]),
ebook_viewer,
lambda payload: payload(
'ebook-viewer',
kwargs={'args': ['ebook-viewer', output_path]}),
self.gui.job_manager.launch_gui_app,
job.log_path,
_('Ebook Translation Log'),
_('Translation Completed'),
Expand Down Expand Up @@ -466,7 +471,6 @@ def choose_translate_engine(self, engine):
if current_engine in engine_info:
self.api_key.setText(engine_info[current_engine])


def choose_output_path(self):
path = QFileDialog.getExistingDirectory()
self.output_path_entry.setText(path)
Expand Down

0 comments on commit 80197d6

Please sign in to comment.