From 6c9e90ceaf8a9273fce19a5552084cd18e1d279a Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr> Date: Tue, 12 Dec 2023 13:39:38 +0100 Subject: [PATCH] MainWindow: Add progress dialog for save as method. --- src/View/MainWindow.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index 47b6cd22..4ce865db 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -440,7 +440,20 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): else: self._study.filename = file_name + ".pamhyr" - self._study.save() + sql_request_count = self._study.sql_save_request_count() + progress = QProgressDialog( + "Saving...", None, + 0, sql_request_count, + parent=self + ) + progress.setWindowModality(Qt.WindowModal) + progress.setValue(0) + + logger.info("Save...") + self._study.save( + progress=lambda: progress.setValue(progress.value() + 1) + ) + logger.info("Done") ################## # MSG AND DIALOG # -- GitLab