From cd01049c6e4b8a47adbbd7c08eed41f0f2433a8f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 1 Dec 2013 15:31:35 +0530 Subject: [PATCH] Nicer error message when clicking new file if no book has been opened. --- src/calibre/gui2/tweak_book/boss.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index f7ec61865e..5c7d242b28 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -201,6 +201,11 @@ class Boss(QObject): editors[c.opf_name].replace_data(c.raw_data(c.opf_name)) def add_file(self): + if current_container() is None: + return error_dialog(self.gui, _('No open book'), _( + 'You must first open a book to tweak, before trying to create new files' + ' in it.'), show=True) + if not self.check_opf_dirtied(): return d = NewFileDialog(self.gui)