mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Viewer highlights panel: Fix the "Edit notes" link not saving the changes
This commit is contained in:
parent
3e633713d9
commit
e74e14fdb0
@ -422,6 +422,7 @@ class HighlightsPanel(QWidget):
|
||||
request_highlight_action = pyqtSignal(object, object)
|
||||
web_action = pyqtSignal(object, object)
|
||||
toggle_requested = pyqtSignal()
|
||||
notes_edited_signal = pyqtSignal(object, object)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
@ -471,6 +472,7 @@ class HighlightsPanel(QWidget):
|
||||
if h is not None:
|
||||
h['notes'] = text
|
||||
self.web_action.emit('set-notes-in-highlight', h)
|
||||
self.notes_edited_signal.emit(h['uuid'], text)
|
||||
|
||||
def set_tooltips(self, rmap):
|
||||
a = rmap.get('create_annotation')
|
||||
|
@ -200,6 +200,7 @@ class EbookViewer(MainWindow):
|
||||
self.dock_visibility_changed()
|
||||
self.highlights_widget.request_highlight_action.connect(self.web_view.highlight_action)
|
||||
self.highlights_widget.web_action.connect(self.web_view.generic_action)
|
||||
self.highlights_widget.notes_edited_signal.connect(self.notes_edited)
|
||||
if continue_reading:
|
||||
self.continue_reading()
|
||||
self.setup_mouse_auto_hide()
|
||||
@ -649,6 +650,16 @@ class EbookViewer(MainWindow):
|
||||
self.highlights_widget.refresh(highlights)
|
||||
self.save_annotations()
|
||||
|
||||
def notes_edited(self, uuid, notes):
|
||||
for h in self.current_book_data['annotations_map']['highlight']:
|
||||
if h.get('uuid') == uuid:
|
||||
h['notes'] = notes
|
||||
h['timestamp'] = utcnow().isoformat()
|
||||
break
|
||||
else:
|
||||
return
|
||||
self.save_annotations()
|
||||
|
||||
def edit_book(self, file_name, progress_frac, selected_text):
|
||||
import subprocess
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user