Scenario: Save dialog at scenarios switch.

This commit is contained in:
parouby committed 2025-10-02 11:14:26 +02:00
1 parent 2a926a8d73
commit fa8fe508a7
2 files changed
+33 -2

No files matched your search

+26 -2
View File
@@ -31,7 +31,7 @@ from PyQt5.QtGui import (
)
from PyQt5.QtWidgets import (
QApplication, QGraphicsScene, QGraphicsView,
QGraphicsItem, QGraphicsTextItem, QMenu,
QGraphicsItem, QGraphicsTextItem, QMenu, QMessageBox,
)
from View.WaitingDialog import WaitingDialog
@@ -410,13 +410,37 @@ class GraphWidget(QGraphicsView):
)
m.run()
def dialog_save(self):
dlg = QMessageBox(self)
dlg.setWindowTitle(self._trad["mb_save_title"])
dlg.setText(self._trad["mb_save_msg"])
opt = QMessageBox.Save | QMessageBox.Cancel
dlg.setStandardButtons(opt)
dlg.setIcon(QMessageBox.Warning)
dlg.button(QMessageBox.Save).setText(self._trad["Save"])
dlg.button(QMessageBox.Cancel).setText(self._trad["Cancel"])
res = dlg.exec()
if res == QMessageBox.Save:
return True
elif res == QMessageBox.Cancel:
return False
def select_scenario(self, item):
if type(item) is not ScenarioItem:
return
must_saved = self.dialog_save()
def fn():
self._close_other_window()
self._study.save()
if must_saved:
self._study.save()
self._undo.push(
SelectScenariosCommand(
self._study,