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) -