mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Implement a separate context menu for the split book list
This commit is contained in:
parent
c75ae1acb9
commit
6c3e68289b
@ -87,6 +87,13 @@ def create_defs():
|
|||||||
'Similar Books', 'Tweak ePub', None, 'Remove Books',
|
'Similar Books', 'Tweak ePub', None, 'Remove Books',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
defs['action-layout-context-menu-split'] = (
|
||||||
|
'Edit Metadata', 'Send To Device', 'Save To Disk',
|
||||||
|
'Connect Share', 'Copy To Library', None,
|
||||||
|
'Convert Books', 'View', 'Open Folder', 'Show Book Details',
|
||||||
|
'Similar Books', 'Tweak ePub', None, 'Remove Books',
|
||||||
|
)
|
||||||
|
|
||||||
defs['action-layout-context-menu-device'] = (
|
defs['action-layout-context-menu-device'] = (
|
||||||
'View', 'Save To Disk', None, 'Remove Books', None,
|
'View', 'Save To Disk', None, 'Remove Books', None,
|
||||||
'Add To Library', 'Edit Collections', 'Match Books'
|
'Add To Library', 'Edit Collections', 'Match Books'
|
||||||
|
@ -82,6 +82,9 @@ class LibraryViewMixin(object): # {{{
|
|||||||
populate_menu(dm, gprefs['action-layout-context-menu-device'], self.iactions)
|
populate_menu(dm, gprefs['action-layout-context-menu-device'], self.iactions)
|
||||||
ec = self.iactions['Edit Collections'].qaction
|
ec = self.iactions['Edit Collections'].qaction
|
||||||
self.library_view.set_context_menu(lm, ec)
|
self.library_view.set_context_menu(lm, ec)
|
||||||
|
sm = QMenu(self)
|
||||||
|
populate_menu(sm, gprefs['action-layout-context-menu-split'], self.iactions)
|
||||||
|
self.library_view.pin_view.set_context_menu(sm)
|
||||||
for v in (self.memory_view, self.card_a_view, self.card_b_view):
|
for v in (self.memory_view, self.card_a_view, self.card_b_view):
|
||||||
v.set_context_menu(dm, ec)
|
v.set_context_menu(dm, ec)
|
||||||
|
|
||||||
|
@ -886,11 +886,14 @@ class BooksView(QTableView): # {{{
|
|||||||
self.alternate_views.set_context_menu(menu)
|
self.alternate_views.set_context_menu(menu)
|
||||||
self.edit_collections_action = edit_collections_action
|
self.edit_collections_action = edit_collections_action
|
||||||
|
|
||||||
def contextMenuEvent(self, event):
|
def show_context_menu(self, menu, event):
|
||||||
from calibre.gui2.main_window import clone_menu
|
from calibre.gui2.main_window import clone_menu
|
||||||
m = clone_menu(self.context_menu) if islinux else self.context_menu
|
m = clone_menu(menu) if islinux else menu
|
||||||
m.popup(event.globalPos())
|
m.popup(event.globalPos())
|
||||||
event.accept()
|
event.accept()
|
||||||
|
|
||||||
|
def contextMenuEvent(self, event):
|
||||||
|
self.show_context_menu(self.context_menu, event)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -14,6 +14,12 @@ class PinTableView(QTableView):
|
|||||||
self.books_view = books_view
|
self.books_view = books_view
|
||||||
self.verticalHeader().close()
|
self.verticalHeader().close()
|
||||||
|
|
||||||
|
def set_context_menu(self, menu):
|
||||||
|
self.context_menu = menu
|
||||||
|
|
||||||
|
def contextMenuEvent(self, event):
|
||||||
|
self.books_view.show_context_menu(self.context_menu, event)
|
||||||
|
|
||||||
|
|
||||||
class PinContainer(QSplitter):
|
class PinContainer(QSplitter):
|
||||||
|
|
||||||
|
@ -241,6 +241,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
('menubar-device', _('The menubar when a device is connected')),
|
('menubar-device', _('The menubar when a device is connected')),
|
||||||
('context-menu', _('The context menu for the books in the '
|
('context-menu', _('The context menu for the books in the '
|
||||||
'calibre library')),
|
'calibre library')),
|
||||||
|
('context-menu-split', _('The context menu for the split book list')),
|
||||||
('context-menu-device', _('The context menu for the books on '
|
('context-menu-device', _('The context menu for the books on '
|
||||||
'the device')),
|
'the device')),
|
||||||
('context-menu-cover-browser', _('The context menu for the Cover '
|
('context-menu-cover-browser', _('The context menu for the Cover '
|
||||||
|
Loading…
x
Reference in New Issue
Block a user