From f9fb0123228904c67950340d43e5710d3a8400c7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 7 Jan 2022 20:36:34 +0530 Subject: [PATCH] Auto trigger matching book search for not too large libraries --- src/calibre/gui2/dialogs/match_books.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/dialogs/match_books.py b/src/calibre/gui2/dialogs/match_books.py index 448bac19d9..82c7d2525e 100644 --- a/src/calibre/gui2/dialogs/match_books.py +++ b/src/calibre/gui2/dialogs/match_books.py @@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en' from qt.core import (Qt, QDialog, QAbstractItemView, QTableWidgetItem, - QByteArray, QApplication, QCursor) + QByteArray, QApplication, QCursor, QTimer) from calibre.gui2 import gprefs, error_dialog from calibre.gui2.dialogs.match_books_ui import Ui_MatchBooks @@ -110,9 +110,11 @@ class MatchBooks(QDialog, Ui_MatchBooks): self.buttonBox.rejected.connect(self.reject) self.ignore_next_key = False - search_text= self.device_db[self.current_device_book_id].title + search_text = self.device_db[self.current_device_book_id].title search_text = search_text.replace('(', '\\(').replace(')', '\\)') self.search_text.setText(search_text) + if search_text and len(self.library_db.new_api.all_book_ids()) < 8000: + QTimer.singleShot(0, self.search_button.click) def return_pressed(self): self.ignore_next_key = True