From 873ebee3ed12b640746fff9a2f5fca7115cbcc68 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 20 Dec 2013 14:37:26 +0530 Subject: [PATCH] Edit book: Fix deleting a file that is currently open in an editor, not auto-closing the editor --- src/calibre/gui2/tweak_book/boss.py | 2 +- src/calibre/gui2/tweak_book/preview.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index 1771e158c8..1502e3de4e 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -257,7 +257,7 @@ class Boss(QObject): c.remove_item(name) self.set_modified() self.gui.file_list.delete_done(spine_items, other_items) - for name in list(spine_items) + list(other_items): + for name in [x for x, remove in spine_items if remove] + list(other_items): if name in editors: self.close_editor(name) if not editors: diff --git a/src/calibre/gui2/tweak_book/preview.py b/src/calibre/gui2/tweak_book/preview.py index bbcd94b032..c54f369465 100644 --- a/src/calibre/gui2/tweak_book/preview.py +++ b/src/calibre/gui2/tweak_book/preview.py @@ -549,6 +549,7 @@ class Preview(QWidget): def clear(self): self.view.clear() + self.current_name = None @property def is_visible(self):