Auto trigger matching book search for not too large libraries

This commit is contained in:
Kovid Goyal 2022-01-07 20:36:34 +05:30
parent b42b694c56
commit f9fb012322
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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