mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Separate category value from notes in results list
Only works if there is no search or the match is close enough for the result text to include the category value.
This commit is contained in:
parent
d4d45eb5b9
commit
5875303a48
@ -34,7 +34,7 @@ class NotesResultsDelegate(ResultsDelegate):
|
|||||||
def result_data(self, result):
|
def result_data(self, result):
|
||||||
if not isinstance(result, dict):
|
if not isinstance(result, dict):
|
||||||
return None, None, None, None, None
|
return None, None, None, None, None
|
||||||
full_text = result['text']
|
full_text = result['text'].replace('\n', ': ', 1)
|
||||||
parts = full_text.split('\x1d', 2)
|
parts = full_text.split('\x1d', 2)
|
||||||
before = after = ''
|
before = after = ''
|
||||||
if len(parts) > 2:
|
if len(parts) > 2:
|
||||||
@ -44,6 +44,8 @@ class NotesResultsDelegate(ResultsDelegate):
|
|||||||
before, text = parts
|
before, text = parts
|
||||||
else:
|
else:
|
||||||
text = parts[0]
|
text = parts[0]
|
||||||
|
if len(parts) > 1 and before:
|
||||||
|
before = before.replace('\n', ': ', 1)
|
||||||
return False, before, text, after, False
|
return False, before, text, after, False
|
||||||
|
|
||||||
|
|
||||||
@ -519,4 +521,5 @@ if __name__ == '__main__':
|
|||||||
br = NotesBrowser()
|
br = NotesBrowser()
|
||||||
br.exec()
|
br.exec()
|
||||||
del br
|
del br
|
||||||
|
|
||||||
del app
|
del app
|
||||||
|
Loading…
x
Reference in New Issue
Block a user