mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Edit Book: Better error message when user tries to open a Check Book item that refers to a file that has beed deleted since the last time Check Book was run. Fixes #1632897 [KeyError after deleting unreferenced file](https://bugs.launchpad.net/calibre/+bug/1632897)
This commit is contained in:
parent
51024a7d9d
commit
bcabbd88d1
@ -1197,11 +1197,16 @@ class Boss(QObject):
|
||||
def check_item_activated(self, item):
|
||||
is_mult = item.has_multiple_locations and getattr(item, 'current_location_index', None) is not None
|
||||
name = item.all_locations[item.current_location_index][0] if is_mult else item.name
|
||||
editor = None
|
||||
if name in editors:
|
||||
editor = editors[name]
|
||||
self.gui.central.show_editor(editor)
|
||||
else:
|
||||
try:
|
||||
editor = self.edit_file_requested(name, None, current_container().mime_map[name])
|
||||
except KeyError:
|
||||
error_dialog(self.gui, _('File deleted'), _(
|
||||
'The file {} has already been deleted, re-run Check Book to update the results.').format(name), show=True)
|
||||
if getattr(editor, 'has_line_numbers', False):
|
||||
if is_mult:
|
||||
editor.go_to_line(*(item.all_locations[item.current_location_index][1:3]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user