mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Show a busy cursor when running the search in the match books dialog
This commit is contained in:
parent
37eacf65b0
commit
9e775f3cb7
@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
|
|
||||||
from PyQt5.Qt import (Qt, QDialog, QAbstractItemView, QTableWidgetItem,
|
from PyQt5.Qt import (Qt, QDialog, QAbstractItemView, QTableWidgetItem,
|
||||||
QByteArray)
|
QByteArray, QApplication, QCursor)
|
||||||
|
|
||||||
from calibre.gui2 import gprefs, error_dialog
|
from calibre.gui2 import gprefs, error_dialog
|
||||||
from calibre.gui2.dialogs.match_books_ui import Ui_MatchBooks
|
from calibre.gui2.dialogs.match_books_ui import Ui_MatchBooks
|
||||||
@ -129,6 +129,9 @@ class MatchBooks(QDialog, Ui_MatchBooks):
|
|||||||
_('You must enter a search expression into the search box'))
|
_('You must enter a search expression into the search box'))
|
||||||
d.exec_()
|
d.exec_()
|
||||||
return
|
return
|
||||||
|
try:
|
||||||
|
self.search_button.setEnabled(False)
|
||||||
|
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||||
books = self.library_db.data.search(query, return_matches=True)
|
books = self.library_db.data.search(query, return_matches=True)
|
||||||
self.books_table.setRowCount(len(books))
|
self.books_table.setRowCount(len(books))
|
||||||
|
|
||||||
@ -148,6 +151,9 @@ class MatchBooks(QDialog, Ui_MatchBooks):
|
|||||||
self.books_table.setRowHeight(row, self.books_table_row_height)
|
self.books_table.setRowHeight(row, self.books_table_row_height)
|
||||||
|
|
||||||
self.books_table.setSortingEnabled(True)
|
self.books_table.setSortingEnabled(True)
|
||||||
|
finally:
|
||||||
|
self.search_button.setEnabled(True)
|
||||||
|
QApplication.restoreOverrideCursor()
|
||||||
|
|
||||||
# Deal with sizing the table columns. Done here because the numbers are not
|
# Deal with sizing the table columns. Done here because the numbers are not
|
||||||
# correct until the first paint.
|
# correct until the first paint.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user