Also use same path for creating highlight

This commit is contained in:
Kovid Goyal 2020-05-12 19:24:13 +05:30
parent f259e86cb3
commit d6498bf837
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 6 additions and 5 deletions

View File

@ -82,7 +82,6 @@ class Highlights(QListWidget):
class HighlightsPanel(QWidget): class HighlightsPanel(QWidget):
jump_to_cfi = pyqtSignal(object) jump_to_cfi = pyqtSignal(object)
add_highlight = pyqtSignal()
request_highlight_action = pyqtSignal(object, object) request_highlight_action = pyqtSignal(object, object)
def __init__(self, parent=None): def __init__(self, parent=None):
@ -145,3 +144,6 @@ class HighlightsPanel(QWidget):
if h is None: if h is None:
return self.no_selected_highlight() return self.no_selected_highlight()
self.request_highlight_action.emit(h['uuid'], 'delete') self.request_highlight_action.emit(h['uuid'], 'delete')
def add_highlight(self):
self.request_highlight_action.emit(None, 'create')

View File

@ -155,7 +155,6 @@ class EbookViewer(MainWindow):
self.bookmarks_dock.setWidget(w) self.bookmarks_dock.setWidget(w)
self.highlights_widget = w = HighlightsPanel(self) self.highlights_widget = w = HighlightsPanel(self)
w.add_highlight.connect(self.add_highlight)
self.highlights_dock.setWidget(w) self.highlights_dock.setWidget(w)
self.web_view = WebView(self) self.web_view = WebView(self)
@ -339,9 +338,6 @@ class EbookViewer(MainWindow):
def bookmark_activated(self, cfi): def bookmark_activated(self, cfi):
self.web_view.goto_cfi(cfi) self.web_view.goto_cfi(cfi)
def add_highlight(self):
self.web_view.trigger_shortcut('create_annotation')
def view_image(self, name): def view_image(self, name):
path = get_path_for_name(name) path = get_path_for_name(name)
if path: if path:

View File

@ -1191,6 +1191,9 @@ class View:
self.show_name(sr.file_name, initial_position={'type':'search_result', 'search_result':sr, 'replace_history':True}) self.show_name(sr.file_name, initial_position={'type':'search_result', 'search_result':sr, 'replace_history':True})
def highlight_action(self, uuid, which): def highlight_action(self, uuid, which):
if which is 'create':
self.iframe_wrapper.send_message('create_annotation')
return
spine = self.book.manifest.spine spine = self.book.manifest.spine
spine_index = self.annotations_manager.spine_index_for_highlight(uuid, spine) spine_index = self.annotations_manager.spine_index_for_highlight(uuid, spine)
if spine_index < 0 or spine_index >= spine.length: if spine_index < 0 or spine_index >= spine.length: