mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
E-book viewer: Highlights panel: Allow right clicking to export only selected highlights
This commit is contained in:
parent
6f6bd4b32f
commit
dd419a92b1
@ -189,6 +189,7 @@ class Highlights(QTreeWidget):
|
|||||||
delete_requested = pyqtSignal()
|
delete_requested = pyqtSignal()
|
||||||
edit_requested = pyqtSignal()
|
edit_requested = pyqtSignal()
|
||||||
edit_notes_requested = pyqtSignal()
|
edit_notes_requested = pyqtSignal()
|
||||||
|
export_selected_requested = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QTreeWidget.__init__(self, parent)
|
QTreeWidget.__init__(self, parent)
|
||||||
@ -225,6 +226,8 @@ class Highlights(QTreeWidget):
|
|||||||
'Delete this highlight', 'Delete selected highlights', len(self.selectedItems())
|
'Delete this highlight', 'Delete selected highlights', len(self.selectedItems())
|
||||||
), self.delete_requested.emit)
|
), self.delete_requested.emit)
|
||||||
m.addSeparator()
|
m.addSeparator()
|
||||||
|
if tuple(self.selected_highlights):
|
||||||
|
m.addAction(QIcon.ic('save.png'), _('Export selected highlights'), self.export_selected_requested.emit)
|
||||||
m.addAction(QIcon.ic('plus.png'), _('Expand all'), self.expandAll)
|
m.addAction(QIcon.ic('plus.png'), _('Expand all'), self.expandAll)
|
||||||
m.addAction(QIcon.ic('minus.png'), _('Collapse all'), self.collapseAll)
|
m.addAction(QIcon.ic('minus.png'), _('Collapse all'), self.collapseAll)
|
||||||
self.context_menu.popup(self.mapToGlobal(point))
|
self.context_menu.popup(self.mapToGlobal(point))
|
||||||
@ -508,6 +511,7 @@ class HighlightsPanel(QWidget):
|
|||||||
h.edit_requested.connect(self.edit_highlight)
|
h.edit_requested.connect(self.edit_highlight)
|
||||||
h.edit_notes_requested.connect(self.edit_notes)
|
h.edit_notes_requested.connect(self.edit_notes)
|
||||||
h.current_highlight_changed.connect(self.current_highlight_changed)
|
h.current_highlight_changed.connect(self.current_highlight_changed)
|
||||||
|
h.export_selected_requested.connect(self.export_selected)
|
||||||
self.load = h.load
|
self.load = h.load
|
||||||
self.refresh = h.refresh
|
self.refresh = h.refresh
|
||||||
|
|
||||||
@ -601,6 +605,12 @@ class HighlightsPanel(QWidget):
|
|||||||
return error_dialog(self, _('No highlights'), _('This book has no highlights to export'), show=True)
|
return error_dialog(self, _('No highlights'), _('This book has no highlights to export'), show=True)
|
||||||
Export(hl, self).exec()
|
Export(hl, self).exec()
|
||||||
|
|
||||||
|
def export_selected(self):
|
||||||
|
hl = list(self.highlights.selected_highlights)
|
||||||
|
if not hl:
|
||||||
|
return error_dialog(self, _('No highlights'), _('No highlights selected to export'), show=True)
|
||||||
|
Export(hl, self).exec()
|
||||||
|
|
||||||
def selected_text_changed(self, text, annot_id):
|
def selected_text_changed(self, text, annot_id):
|
||||||
if annot_id:
|
if annot_id:
|
||||||
self.highlights.find_annot_id(annot_id)
|
self.highlights.find_annot_id(annot_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user