diff --git a/src/calibre/db/cache.py b/src/calibre/db/cache.py index 96f01d483b..0f9c332eda 100644 --- a/src/calibre/db/cache.py +++ b/src/calibre/db/cache.py @@ -142,6 +142,7 @@ class Cache: def __init__(self, backend, library_database_instance=None): self.shutting_down = False + self.is_doing_rebuild_or_vacuum = False self.backend = backend self.library_database_instance = (None if library_database_instance is None else weakref.ref(library_database_instance)) @@ -2429,7 +2430,11 @@ class Cache: @write_api def vacuum(self): - self.backend.vacuum() + self.is_doing_rebuild_or_vacuum = True + try: + self.backend.vacuum() + finally: + self.is_doing_rebuild_or_vacuum = False def __del__(self): self.close() diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index 2b8396390e..b6cf8903a5 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -659,7 +659,9 @@ class ChooseLibraryAction(InterfaceAction): d = DBCheck(self.gui, db) try: d.start() - d.exec() + from calibre.gui2.widgets import BusyCursor + with BusyCursor(): + d.exec() try: m.close() except Exception: diff --git a/src/calibre/gui2/dialogs/scheduler.py b/src/calibre/gui2/dialogs/scheduler.py index 7a06c1d49f..c133d872ae 100644 --- a/src/calibre/gui2/dialogs/scheduler.py +++ b/src/calibre/gui2/dialogs/scheduler.py @@ -612,7 +612,9 @@ class Scheduler(QObject): from calibre.gui2.ui import get_gui gui = get_gui() if gui is not None: - return gui.current_db + ans = gui.current_db + if not ans.new_api.is_doing_rebuild_or_vacuum: + return ans def oldest_check(self): if self.oldest > 0: diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 75d764ec4a..dacfcd98b5 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -966,6 +966,8 @@ class BooksModel(QAbstractTableModel): # {{{ self.column_to_dc_decorator_map = [self.dc_decorator.get(col, None) for col in self.column_map] def data(self, index, role): + if self.db.new_api.is_doing_rebuild_or_vacuum: + return None col = index.column() # in obscure cases where custom columns are both edited and added, for a time # the column map does not accurately represent the screen. In these cases,