mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 01:03:26 +02:00
Hide edit_collections on context menu when device does not support collections
This commit is contained in:
parent
46a9d48b1d
commit
a7e20ef517
1 changed files with 7 additions and 1 deletions
|
|
@ -396,7 +396,8 @@ def set_context_menu(self, edit_metadata, send_to_device, convert, view,
|
|||
self.context_menu.addAction(add_to_library[0], func)
|
||||
if edit_device_collections is not None:
|
||||
func = partial(edit_device_collections[1], view=self)
|
||||
self.context_menu.addAction(edit_device_collections[0], func)
|
||||
self.edit_collections_menu = \
|
||||
self.context_menu.addAction(edit_device_collections[0], func)
|
||||
|
||||
def contextMenuEvent(self, event):
|
||||
self.context_menu.popup(event.globalPos())
|
||||
|
|
@ -498,6 +499,11 @@ def __init__(self, parent):
|
|||
self.setDragDropMode(self.NoDragDrop)
|
||||
self.setAcceptDrops(False)
|
||||
|
||||
def contextMenuEvent(self, event):
|
||||
self.edit_collections_menu.setVisible(self._model.db.supports_collections())
|
||||
self.context_menu.popup(event.globalPos())
|
||||
event.accept()
|
||||
|
||||
def set_database(self, db):
|
||||
self._model.set_database(db)
|
||||
self.restore_state()
|
||||
|
|
|
|||
Loading…
Reference in a new issue