mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Clicking search in book in selection bar should actually trigger the search not just fill the search box
This commit is contained in:
parent
5059025a18
commit
374edd1ff7
@ -680,6 +680,9 @@ class SearchPanel(QWidget): # {{{
|
||||
def find_next_requested(self, previous):
|
||||
self.results.find_next(previous)
|
||||
|
||||
def trigger(self):
|
||||
self.search_input.find_next()
|
||||
|
||||
def do_show_search_result(self, sr):
|
||||
self.show_search_result.emit(sr.for_js)
|
||||
|
||||
|
@ -292,11 +292,13 @@ class EbookViewer(MainWindow):
|
||||
def toggle_toc(self):
|
||||
self.toc_dock.setVisible(not self.toc_dock.isVisible())
|
||||
|
||||
def show_search(self, text):
|
||||
def show_search(self, text, trigger=False):
|
||||
self.search_dock.setVisible(True)
|
||||
self.search_dock.activateWindow()
|
||||
self.search_dock.raise_()
|
||||
self.search_widget.focus_input(text)
|
||||
if trigger:
|
||||
self.search_widget.trigger()
|
||||
|
||||
def search_results_count_changed(self, num=-1):
|
||||
if num < 0:
|
||||
|
@ -241,7 +241,7 @@ class ViewerBridge(Bridge):
|
||||
new_bookmark = from_js(object)
|
||||
toggle_inspector = from_js()
|
||||
toggle_lookup = from_js(object)
|
||||
show_search = from_js(object)
|
||||
show_search = from_js(object, object)
|
||||
search_result_not_found = from_js(object)
|
||||
find_next = from_js(object)
|
||||
quit = from_js()
|
||||
@ -431,7 +431,7 @@ class WebView(RestartingWebEngineView):
|
||||
cfi_changed = pyqtSignal(object)
|
||||
reload_book = pyqtSignal()
|
||||
toggle_toc = pyqtSignal()
|
||||
show_search = pyqtSignal(object)
|
||||
show_search = pyqtSignal(object, object)
|
||||
search_result_not_found = pyqtSignal(object)
|
||||
find_next = pyqtSignal(object)
|
||||
toggle_bookmarks = pyqtSignal()
|
||||
|
@ -885,7 +885,7 @@ class SelectionBar:
|
||||
self.view.overlay.show_word_actions(self.view.currently_showing.selection.text)
|
||||
|
||||
def book_search(self):
|
||||
self.view.show_search()
|
||||
self.view.show_search(True)
|
||||
self.clear_selection()
|
||||
|
||||
def new_bookmark(self):
|
||||
|
@ -672,15 +672,17 @@ class View:
|
||||
|
||||
self.get_current_cfi('prepare-close', close_prepared)
|
||||
|
||||
def show_search(self):
|
||||
def show_search(self, trigger):
|
||||
self.hide_overlays()
|
||||
text = self.currently_showing.selection.text
|
||||
if runtime.is_standalone_viewer:
|
||||
ui_operations.show_search(text or '')
|
||||
ui_operations.show_search(text or '', trigger)
|
||||
else:
|
||||
if text:
|
||||
self.search_overlay.set_text(text)
|
||||
self.search_overlay.show(text)
|
||||
if trigger and text:
|
||||
self.search_overlay.find_next()
|
||||
|
||||
def show_content_popup(self):
|
||||
self.hide_overlays()
|
||||
|
@ -330,8 +330,8 @@ if window is window.top:
|
||||
to_python.toggle_inspector()
|
||||
ui_operations.content_file_changed = def(name):
|
||||
to_python.content_file_changed(name)
|
||||
ui_operations.show_search = def(text):
|
||||
to_python.show_search(text)
|
||||
ui_operations.show_search = def(text, trigger):
|
||||
to_python.show_search(text, v'!!trigger')
|
||||
ui_operations.find_next = def(previous):
|
||||
to_python.find_next(previous)
|
||||
ui_operations.reset_interface = def():
|
||||
|
Loading…
x
Reference in New Issue
Block a user