A better error message when the user tries to use the Manage Collections action in the library view

This commit is contained in:
Kovid Goyal 2016-09-01 14:34:46 +05:30
parent 942b4e3a0e
commit afb8f797c6

View File

@ -5,6 +5,7 @@ __license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__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)