From 816d7663b5cb73c2034066c13589721583965a93 Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Tue, 21 Jul 2026 14:57:30 +0200 Subject: [PATCH] AdisTT: new button on interface to open AdisTT results from file --- src/View/MainWindow.py | 32 ++++++++++++++++++++++++++------ src/View/Translate.py | 5 +++++ src/View/ui/MainWindow.ui | 9 +++++++++ 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index b855fef7..65748091 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -149,7 +149,7 @@ model_action = [ "action_menu_close", "action_menu_edit", "action_menu_save", "action_menu_save_as", "action_toolBar_close", "action_toolBar_save", "action_menu_numerical_parameter", "action_menu_open_results_from_file", - "action_menu_open_results_adists", + "action_menu_open_results_adists", "action_menu_open_results_adistt", ] other_model_action = [ @@ -335,6 +335,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): "action_menu_compare_scenarios_results": self.compare_results_scenarios, "action_menu_open_results_adists": self.open_results_adists, + "action_menu_open_results_adistt": + lambda: self.open_results_adists(mode="adistt"), # Help "action_menu_pamhyr_users_wiki": self.open_doc_user, "action_menu_pamhyr_developers_pdf": @@ -2147,7 +2149,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): return [result4, result5, result3] - def open_results_adists(self): + def open_results_adists(self, mode="adists"): if self._study is None: return @@ -2195,16 +2197,34 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): ) return + expected_type = "adistt" if mode == "adistt" else "adists" + solver_type = solver_results._type.lower() + if not solver_type.startswith(expected_type): + self.msg_results_warning( + info=self._trad["mb_results_not_found"], + text=self._trad["mb_results_solver_mode_mismatch"].format( + solver=solver_results.name, + mode=expected_type.upper(), + ) + ) + return + solver_results_adists = solver_results.results( self._study, repertory=dir_path, qlog=None) # self._output) logger.info(f"Select results: {dir_path}") if len(bin_list) >= 2 and ("total_sediment.bin" in bin_list): - self.open_solver_results_adists( - solver_results, - results=solver_results_adists, - ) + if mode == "adistt": + self.open_solver_results_adistt( + solver_results, + results=solver_results_adists, + ) + else: + self.open_solver_results_adists( + solver_results, + results=solver_results_adists, + ) else: self.msg_results_warning( info=self._trad["mb_results_not_found"], diff --git a/src/View/Translate.py b/src/View/Translate.py index 4809cb9b..5a7f20b0 100644 --- a/src/View/Translate.py +++ b/src/View/Translate.py @@ -294,6 +294,11 @@ class MainTranslate(UnitTranslate): "MainWindow", "Results folder does not correspond to a Pamhyr2 solver name" ) + self._dict["mb_results_solver_mode_mismatch"] = _translate( + "MainWindow", + "The folder belongs to solver '{solver}',\nwhich is not an " + "{mode} solver" + ) self._dict["mb_results_bin_not_found"] = _translate( "MainWindow", "Results binary files not found" ) diff --git a/src/View/ui/MainWindow.ui b/src/View/ui/MainWindow.ui index 1eaf9ad7..a97d2e8a 100644 --- a/src/View/ui/MainWindow.ui +++ b/src/View/ui/MainWindow.ui @@ -162,6 +162,7 @@ + @@ -863,6 +864,14 @@ Run AdisTT + + + false + + + Open results temperature + +