mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More work on annotations browser
This commit is contained in:
parent
7ed580cad4
commit
9b7f69e4bb
@ -305,7 +305,7 @@ def save_annotations_for_book(cursor, book_id, fmt, annots_list, user_type='loca
|
|||||||
aid = text = annot['title']
|
aid = text = annot['title']
|
||||||
elif atype == 'highlight':
|
elif atype == 'highlight':
|
||||||
aid = annot['uuid']
|
aid = annot['uuid']
|
||||||
text = annot.get('highlighed_text') or ''
|
text = annot.get('highlighted_text') or ''
|
||||||
notes = annot.get('notes') or ''
|
notes = annot.get('notes') or ''
|
||||||
if notes:
|
if notes:
|
||||||
text += '\n0x1f\n' + notes
|
text += '\n0x1f\n' + notes
|
||||||
|
@ -37,6 +37,8 @@ class ResultsList(QListWidget):
|
|||||||
|
|
||||||
def set_results(self, results):
|
def set_results(self, results):
|
||||||
self.clear()
|
self.clear()
|
||||||
|
for result in results:
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
|
||||||
class BrowsePanel(QWidget):
|
class BrowsePanel(QWidget):
|
||||||
@ -120,6 +122,10 @@ class AnnotationsBrowser(Dialog):
|
|||||||
Dialog.__init__(self, _('Annotations browser'), 'library-annotations-browser-1', parent=parent)
|
Dialog.__init__(self, _('Annotations browser'), 'library-annotations-browser-1', parent=parent)
|
||||||
self.setAttribute(Qt.WA_DeleteOnClose, False)
|
self.setAttribute(Qt.WA_DeleteOnClose, False)
|
||||||
|
|
||||||
|
def keyPressEvent(self, ev):
|
||||||
|
if ev.key() not in (Qt.Key_Enter, Qt.Key_Return):
|
||||||
|
return Dialog.keyPressEvent(self, ev)
|
||||||
|
|
||||||
def setup_ui(self):
|
def setup_ui(self):
|
||||||
l = QVBoxLayout(self)
|
l = QVBoxLayout(self)
|
||||||
|
|
||||||
@ -136,10 +142,19 @@ class AnnotationsBrowser(Dialog):
|
|||||||
self.bb.setStandardButtons(self.bb.Close)
|
self.bb.setStandardButtons(self.bb.Close)
|
||||||
l.addWidget(self.bb)
|
l.addWidget(self.bb)
|
||||||
|
|
||||||
|
def show_dialog(self):
|
||||||
|
self.browse_panel.search_box.setFocus(Qt.OtherFocusReason)
|
||||||
|
if self.parent() is None:
|
||||||
|
self.exec_()
|
||||||
|
else:
|
||||||
|
self.show()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from calibre.library import db
|
from calibre.library import db
|
||||||
app = Application([])
|
app = Application([])
|
||||||
current_db.ans = db(os.path.expanduser('~/test library'))
|
current_db.ans = db(os.path.expanduser('~/test library'))
|
||||||
AnnotationsBrowser().exec_()
|
br = AnnotationsBrowser()
|
||||||
|
br.show_dialog()
|
||||||
|
del br
|
||||||
del app
|
del app
|
||||||
|
Loading…
x
Reference in New Issue
Block a user