mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
prevent scenario window to open if study is not saved
This commit is contained in:
1 parent
81c6d39c1a
commit
f7e563e71a
3 files changed
+36
-1
No files matched your search
@@ -1206,6 +1206,31 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
Returns:
|
||||
Nothing
|
||||
"""
|
||||
if self._study is None:
|
||||
return
|
||||
if self._study.filename is None or self._study.filename == "":
|
||||
self.message_box(
|
||||
window_title=self._trad["Warning"],
|
||||
text=self._trad["mb_unsaved_study_title"],
|
||||
informative_text=self._trad["mb_unsaved_studyh_msg"]
|
||||
)
|
||||
|
||||
options = QFileDialog.Options()
|
||||
options |= QFileDialog.DontUseNativeDialog
|
||||
|
||||
file_name, _ = QFileDialog.getSaveFileName(
|
||||
self, "Save File",
|
||||
"", "Pamhyr(*.pamhyr)",
|
||||
options=options,
|
||||
)
|
||||
if file_name is None or file_name == "":
|
||||
return
|
||||
|
||||
if file_name.rsplit(".", 1)[-1] == "pamhyr":
|
||||
self._study.filename = file_name
|
||||
else:
|
||||
self._study.filename = file_name + ".pamhyr"
|
||||
|
||||
if self._study is not None:
|
||||
if self.sub_window_exists(
|
||||
ScenariosWindow,
|
||||
|
||||
Reference in new issue
Block a user