MainWindow: Add progress dialog for save process.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-12-12 11:57:19 +01:00
1 parent 8ce5a4d215
commit 1acd582de9
3 files changed
+83 -13

No files matched your search

+16 -3
View File
@@ -28,12 +28,12 @@ from PyQt5.QtGui import (
)
from PyQt5.QtCore import (
QTranslator, QEvent, QUrl,
Qt, QTranslator, QEvent, QUrl,
)
from PyQt5.QtWidgets import (
QMainWindow, QApplication, QAction,
QFileDialog, QShortcut, QMenu, QToolBar,
QMessageBox,
QMessageBox, QProgressDialog,
)
from PyQt5.uic import loadUi
@@ -406,8 +406,21 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
if self._study.is_saved:
return
sql_request_count = self._study.sql_save_request_count()
progress = QProgressDialog(
"Saving...", "Cancel",
0, sql_request_count,
parent=self
)
progress.setWindowModality(Qt.WindowModal)
progress.setValue(0)
logger.info("Save...")
self._study.save()
self._study.save(
progress=lambda: progress.setValue(progress.value() + 1)
)
logger.info("Done")
def save_as_study(self):
"""Save current study as new file