From 4e0218a562d8995a5673d754b52ba75ceeb563c9 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Mon, 7 Sep 2026 21:41:53 -0400 Subject: [PATCH] gui: stop scrape-all dialog from reappearing after cancel Cancelling the store scrape now closes the dialog and drops its reference immediately, so queued progress signals can't re-show it (QProgressDialog re-shows on setValue while a value is pending). _scraping stays true until the worker finishes to prevent a second concurrent scrape. --- app/gui.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/gui.py b/app/gui.py index 97f89dd..0b5ae83 100644 --- a/app/gui.py +++ b/app/gui.py @@ -2320,7 +2320,7 @@ class StorePage(QWidget): thread.started.connect(worker.run) worker.progress.connect(self._on_scrape_progress) worker.finished.connect(thread.quit) - dlg.canceled.connect(worker.cancel) + dlg.canceled.connect(self._on_scrape_cancelled) worker.finished.connect(self._on_scrape_done) self._scrape_thread = thread self._scrape_worker = worker @@ -2328,6 +2328,19 @@ class StorePage(QWidget): self._workers.append(worker) thread.start() + def _on_scrape_cancelled(self): + worker = self._scrape_worker + if worker is not None: + worker.cancel() + dlg = self._scrape_dialog + if dlg is not None: + dlg.close() + # Drop the dialog reference so queued progress signals can't re-show it + # (QProgressDialog re-appears on setValue while a value is pending). + # Keep _scraping True until the worker actually finishes (_on_scrape_done) + # so a re-click doesn't spawn a second scrape while this one winds down. + self._scrape_dialog = None + def _on_scrape_progress(self, done, total): dlg = self._scrape_dialog if dlg is not None: