mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Show an error when toc editor fails to start
This commit is contained in:
parent
2c9e9831e7
commit
fd9cc8ce30
@ -159,8 +159,9 @@ class ToCEditAction(InterfaceAction):
|
|||||||
def check_for_completions(self):
|
def check_for_completions(self):
|
||||||
from calibre.utils.filenames import retry_on_fail
|
from calibre.utils.filenames import retry_on_fail
|
||||||
for job in tuple(self.jobs):
|
for job in tuple(self.jobs):
|
||||||
started_path = job['path'] + '.started'
|
path = job['path']
|
||||||
result_path = job['path'] + '.result'
|
started_path = path + '.started'
|
||||||
|
result_path = path + '.result'
|
||||||
if job['started'] and os.path.exists(result_path):
|
if job['started'] and os.path.exists(result_path):
|
||||||
self.jobs.remove(job)
|
self.jobs.remove(job)
|
||||||
ret = -1
|
ret = -1
|
||||||
@ -179,11 +180,13 @@ class ToCEditAction(InterfaceAction):
|
|||||||
'Cannot save changes made to {0} by the ToC editor as'
|
'Cannot save changes made to {0} by the ToC editor as'
|
||||||
' the calibre library has changed.').format(job['title']), show=True)
|
' the calibre library has changed.').format(job['title']), show=True)
|
||||||
else:
|
else:
|
||||||
db.new_api.add_format(job['book_id'], job['fmt'], job['path'], run_hooks=False)
|
db.new_api.add_format(job['book_id'], job['fmt'], path, run_hooks=False)
|
||||||
os.remove(job['path'])
|
retry_on_fail(os.remove, path)
|
||||||
else:
|
else:
|
||||||
if monotonic() - job['start_time'] > 120:
|
if monotonic() - job['start_time'] > 120:
|
||||||
self.jobs.remove(job)
|
self.jobs.remove(job)
|
||||||
|
error_dialog(self.gui, _('Failed to start editor'), _(
|
||||||
|
'Could not edit: {}. The Table of Contents editor did not start in four minutes').format(job['title']), show=True)
|
||||||
continue
|
continue
|
||||||
if os.path.exists(started_path):
|
if os.path.exists(started_path):
|
||||||
job['started'] = True
|
job['started'] = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user