Add an action to show the notes browser

This commit is contained in:
Kovid Goyal 2023-09-28 14:43:18 +05:30
parent 6106cab7ee
commit b07873586a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 34 additions and 1 deletions

View File

@ -855,6 +855,12 @@ class ActionBrowseAnnotations(InterfaceActionBase):
description = _('Browse highlights and bookmarks from all books in the library')
class ActionBrowseNotes(InterfaceActionBase):
name = 'Browse Notes'
actual_plugin = 'calibre.gui2.actions.browse_notes:BrowseNotesAction'
description = _('Browse notes for authors, tags, etc. in the library')
class ActionFullTextSearch(InterfaceActionBase):
name = 'Full Text Search'
actual_plugin = 'calibre.gui2.actions.fts:FullTextSearchAction'
@ -1133,7 +1139,7 @@ plugins += [ActionAdd, ActionFetchAnnotations, ActionGenerateCatalog,
ActionMarkBooks, ActionEmbed, ActionTemplateTester, ActionTagMapper, ActionAuthorMapper,
ActionVirtualLibrary, ActionBrowseAnnotations, ActionTemplateFunctions, ActionAutoscrollBooks,
ActionFullTextSearch, ActionManageCategories, ActionBooklistContextMenu, ActionSavedSearches,
ActionLayoutActions]
ActionLayoutActions, ActionBrowseNotes,]
# }}}

View File

@ -0,0 +1,27 @@
#!/usr/bin/env python
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from calibre.gui2.actions import InterfaceAction
class BrowseNotesAction(InterfaceAction):
name = 'Browse Notes'
action_spec = (_('Browse notes'), 'notes.png',
_('Browse notes for authors, tags, etc. in the library'), _('Ctrl+Shift+N'))
dont_add_to = frozenset(('context-menu-device',))
action_type = 'current'
def genesis(self):
self.d = None
self.qaction.triggered.connect(self.show_browser)
def show_browser(self):
if self.d is not None and self.d.isVisible():
self.d.raise_()
self.d.activateWindow()
else:
from calibre.gui2.library.notes import NotesBrowser
self.d = NotesBrowser(self.gui)
self.d.show()