mirror of https://gitlab.com/pamhyr/pamhyr2
add a warning window when opening Adis-TS results from file if wrong directory
parent
bb0e176956
commit
00b89635f3
|
|
@ -951,6 +951,13 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
elif res == QMessageBox.Cancel:
|
elif res == QMessageBox.Cancel:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def msg_results_warning(self, text="", info=""):
|
||||||
|
self.message_box(
|
||||||
|
window_title=self._trad["Warning"],
|
||||||
|
text=text,
|
||||||
|
informative_text=info
|
||||||
|
)
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
# SUB WINDOWS MENU LIST #
|
# SUB WINDOWS MENU LIST #
|
||||||
#########################
|
#########################
|
||||||
|
|
@ -2033,12 +2040,22 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
|
|
||||||
bin_list = list(filter(lambda s: "bin" in s, dir_list))
|
bin_list = list(filter(lambda s: "bin" in s, dir_list))
|
||||||
if len(bin_list) < 1:
|
if len(bin_list) < 1:
|
||||||
# TODO message
|
self.msg_results_warning(
|
||||||
|
info=self._trad["mb_results_not_found"],
|
||||||
|
text=self._trad["mb_results_bin_not_found"]
|
||||||
|
)
|
||||||
return
|
return
|
||||||
path = os.path.normpath(dir_path)
|
path = os.path.normpath(dir_path)
|
||||||
solver_name = path.split(os.sep)[-2]
|
solver_name = path.split(os.sep)[-2]
|
||||||
solver_results = next(filter(lambda x: x.name == solver_name,
|
solver_results = next(filter(lambda x: x.name == solver_name,
|
||||||
self.conf.solvers))
|
self.conf.solvers), None)
|
||||||
|
if solver_results is None:
|
||||||
|
self.msg_results_warning(
|
||||||
|
info=self._trad["mb_results_not_found"],
|
||||||
|
text=self._trad["mb_results_folder_not_found"]
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
solver_results_adists = solver_results.results(
|
solver_results_adists = solver_results.results(
|
||||||
self._study,
|
self._study,
|
||||||
repertory=dir_path, qlog=None) # self._output)
|
repertory=dir_path, qlog=None) # self._output)
|
||||||
|
|
@ -2050,13 +2067,10 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
results=solver_results_adists,
|
results=solver_results_adists,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
dlg = QDialog(self)
|
self.msg_results_warning(
|
||||||
dlg.setWindowTitle("AdisTS Results")
|
info=self._trad["mb_results_not_found"],
|
||||||
layout = QVBoxLayout()
|
text=self._trad["mb_results_bin_not_found"]
|
||||||
message = QLabel("AdisTS Results not found")
|
)
|
||||||
layout.addWidget(message)
|
|
||||||
dlg.setLayout(layout)
|
|
||||||
dlg.exec()
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# DOCUMENTATION #
|
# DOCUMENTATION #
|
||||||
|
|
@ -2100,7 +2114,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
|
|
||||||
def open_doc_user(self):
|
def open_doc_user(self):
|
||||||
self.open_doc(
|
self.open_doc(
|
||||||
"https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home"
|
"https://gitlab.com/pamhyr/pamhyr2/-/wikis/home"
|
||||||
)
|
)
|
||||||
|
|
||||||
def open_doc_dev(self, ext="pdf"):
|
def open_doc_dev(self, ext="pdf"):
|
||||||
|
|
|
||||||
|
|
@ -282,4 +282,20 @@ class MainTranslate(UnitTranslate):
|
||||||
self._dict["Cancel"] = _translate("MainWindow", "Cancel")
|
self._dict["Cancel"] = _translate("MainWindow", "Cancel")
|
||||||
self._dict["Save"] = _translate("MainWindow", "Save")
|
self._dict["Save"] = _translate("MainWindow", "Save")
|
||||||
self._dict["Close"] = _translate("MainWindow", "Close")
|
self._dict["Close"] = _translate("MainWindow", "Close")
|
||||||
|
<<<<<<< HEAD
|
||||||
self._dict["Solver"] = _translate("MainWindow", "Solver")
|
self._dict["Solver"] = _translate("MainWindow", "Solver")
|
||||||
|
=======
|
||||||
|
|
||||||
|
self._dict["mb_results_not_found"] = _translate(
|
||||||
|
"MainWindow", "Results can not be loaded"
|
||||||
|
)
|
||||||
|
self._dict["mb_results_folder_not_found"] = _translate(
|
||||||
|
"MainWindow", "Results folder does not correspond to a Pamhyr2 solver"
|
||||||
|
)
|
||||||
|
self._dict["mb_results_bin_not_found"] = _translate(
|
||||||
|
"MainWindow", "Results binary files not found"
|
||||||
|
)
|
||||||
|
self._dict["mb_results_total_bin_not_found"] = _translate(
|
||||||
|
"MainWindow", "total_sediment.bin file not found"
|
||||||
|
)
|
||||||
|
>>>>>>> 3bbc55b (add a warning window when opening Adis-TS results from file if wrong directory)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue