Handle search result not found

This commit is contained in:
Kovid Goyal 2021-05-20 13:35:33 +05:30
parent 83cbd28323
commit bb58aa60d9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 0 deletions

View File

@ -273,6 +273,14 @@ class SearchOverlay:
def search_result_discovered(self, sr):
self.make_result_current(sr.result_num)
def search_result_not_found(self, sr):
if sr.on_discovery:
return
error_dialog(
_('Search result not found'), _(
'This search result matches text that is hidden in the book and cannot be displayed'))
self.show()
def result_clicked(self, rnum):
sr = Object.assign({}, self.result_map[rnum])
sr.on_discovery = 0

View File

@ -88,6 +88,7 @@ class ReadUI:
ui_operations.speak_simple_text = self.speak_simple_text.bind(self)
ui_operations.tts = self.tts.bind(self)
ui_operations.search_result_discovered = self.view.search_overlay.search_result_discovered
ui_operations.search_result_not_found = self.view.search_overlay.search_result_not_found
ui_operations.open_url = def(url):
window.open(url, '_blank')
ui_operations.copy_selection = def(text, html):