diff --git a/src/calibre/gui2/viewer/highlights.py b/src/calibre/gui2/viewer/highlights.py index 65891af73d..8a41869085 100644 --- a/src/calibre/gui2/viewer/highlights.py +++ b/src/calibre/gui2/viewer/highlights.py @@ -82,7 +82,6 @@ class Highlights(QListWidget): class HighlightsPanel(QWidget): jump_to_cfi = pyqtSignal(object) - add_highlight = pyqtSignal() request_highlight_action = pyqtSignal(object, object) def __init__(self, parent=None): @@ -145,3 +144,6 @@ class HighlightsPanel(QWidget): if h is None: return self.no_selected_highlight() self.request_highlight_action.emit(h['uuid'], 'delete') + + def add_highlight(self): + self.request_highlight_action.emit(None, 'create') diff --git a/src/calibre/gui2/viewer/ui.py b/src/calibre/gui2/viewer/ui.py index 074f4409c8..7f25169fd0 100644 --- a/src/calibre/gui2/viewer/ui.py +++ b/src/calibre/gui2/viewer/ui.py @@ -155,7 +155,6 @@ class EbookViewer(MainWindow): self.bookmarks_dock.setWidget(w) self.highlights_widget = w = HighlightsPanel(self) - w.add_highlight.connect(self.add_highlight) self.highlights_dock.setWidget(w) self.web_view = WebView(self) @@ -339,9 +338,6 @@ class EbookViewer(MainWindow): def bookmark_activated(self, cfi): self.web_view.goto_cfi(cfi) - def add_highlight(self): - self.web_view.trigger_shortcut('create_annotation') - def view_image(self, name): path = get_path_for_name(name) if path: diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 1757384e48..6a6bb0bdb5 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -1191,6 +1191,9 @@ class View: self.show_name(sr.file_name, initial_position={'type':'search_result', 'search_result':sr, 'replace_history':True}) def highlight_action(self, uuid, which): + if which is 'create': + self.iframe_wrapper.send_message('create_annotation') + return spine = self.book.manifest.spine spine_index = self.annotations_manager.spine_index_for_highlight(uuid, spine) if spine_index < 0 or spine_index >= spine.length: