From afb8f797c61bbfb3dcbdb7782aabc71bfbb32231 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Sep 2016 14:34:46 +0530 Subject: [PATCH] A better error message when the user tries to use the Manage Collections action in the library view --- src/calibre/gui2/actions/edit_collections.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/actions/edit_collections.py b/src/calibre/gui2/actions/edit_collections.py index f92cdc1758..ee53cf318b 100644 --- a/src/calibre/gui2/actions/edit_collections.py +++ b/src/calibre/gui2/actions/edit_collections.py @@ -5,6 +5,7 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' +from calibre.gui2 import error_dialog from calibre.gui2.actions import InterfaceAction class EditCollectionsAction(InterfaceAction): @@ -25,10 +26,12 @@ class EditCollectionsAction(InterfaceAction): def edit_collections(self, *args): oncard = None cv = self.gui.current_view() + if cv is self.gui.library_view: + return error_dialog(self.gui, _('In library view'), _( + 'Collections can only be edited when showing the books on the device. Click the toolbar button to switch to the device view first.'), show=True) if cv is self.gui.card_a_view: oncard = 'carda' - if cv is self.gui.card_b_view: + elif cv is self.gui.card_b_view: oncard = 'cardb' self.gui.iactions['Edit Metadata'].edit_device_collections(cv, oncard=oncard) -