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']
|
||||
elif atype == 'highlight':
|
||||
aid = annot['uuid']
|
||||
text = annot.get('highlighed_text') or ''
|
||||
text = annot.get('highlighted_text') or ''
|
||||
notes = annot.get('notes') or ''
|
||||
if notes:
|
||||
text += '\n0x1f\n' + notes
|
||||
|
@ -37,6 +37,8 @@ class ResultsList(QListWidget):
|
||||
|
||||
def set_results(self, results):
|
||||
self.clear()
|
||||
for result in results:
|
||||
print(result)
|
||||
|
||||
|
||||
class BrowsePanel(QWidget):
|
||||
@ -120,6 +122,10 @@ class AnnotationsBrowser(Dialog):
|
||||
Dialog.__init__(self, _('Annotations browser'), 'library-annotations-browser-1', parent=parent)
|
||||
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):
|
||||
l = QVBoxLayout(self)
|
||||
|
||||
@ -136,10 +142,19 @@ class AnnotationsBrowser(Dialog):
|
||||
self.bb.setStandardButtons(self.bb.Close)
|
||||
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__':
|
||||
from calibre.library import db
|
||||
app = Application([])
|
||||
current_db.ans = db(os.path.expanduser('~/test library'))
|
||||
AnnotationsBrowser().exec_()
|
||||
br = AnnotationsBrowser()
|
||||
br.show_dialog()
|
||||
del br
|
||||
del app
|
||||
|
Loading…
x
Reference in New Issue
Block a user