diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index 793a2b93..f651b3d9 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -951,6 +951,13 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): elif res == QMessageBox.Cancel: 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 # ######################### @@ -2033,12 +2040,22 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): bin_list = list(filter(lambda s: "bin" in s, dir_list)) 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 path = os.path.normpath(dir_path) solver_name = path.split(os.sep)[-2] 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( self._study, repertory=dir_path, qlog=None) # self._output) @@ -2050,13 +2067,10 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): results=solver_results_adists, ) else: - dlg = QDialog(self) - dlg.setWindowTitle("AdisTS Results") - layout = QVBoxLayout() - message = QLabel("AdisTS Results not found") - layout.addWidget(message) - dlg.setLayout(layout) - dlg.exec() + self.msg_results_warning( + info=self._trad["mb_results_not_found"], + text=self._trad["mb_results_bin_not_found"] + ) ################# # DOCUMENTATION # @@ -2100,7 +2114,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): def open_doc_user(self): 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"): diff --git a/src/View/Translate.py b/src/View/Translate.py index 8cddb4c0..43317275 100644 --- a/src/View/Translate.py +++ b/src/View/Translate.py @@ -282,4 +282,20 @@ class MainTranslate(UnitTranslate): self._dict["Cancel"] = _translate("MainWindow", "Cancel") self._dict["Save"] = _translate("MainWindow", "Save") self._dict["Close"] = _translate("MainWindow", "Close") +<<<<<<< HEAD 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)