From c63c77698913765642d8269938f100d3932983d5 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Mon, 3 Nov 2025 09:46:40 +0100 Subject: [PATCH] MainWindow: Add message box at results opening error. --- src/View/MainWindow.py | 16 ++++++++++++++++ src/View/Translate.py | 14 ++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index c7a303fe..7ce68594 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -1569,10 +1569,12 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): # No results available if results is None: + self.msg_open_results_no_results() return # results does not have values, for example if geometry missmatch if not results.is_valid: + self.msg_open_results_invalid_results() return if results.get('study_revision') != self._study.status.version: @@ -1598,6 +1600,20 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): ) res.show() + def msg_open_results_no_results(self): + self.message_box( + window_title=self._trad["Warning"], + text=self._trad["mb_open_results_title"], + informative_text=self._trad["mb_open_results_no_results_msg"] + ) + + def msg_open_results_invalid_results(self): + self.message_box( + window_title=self._trad["Error"], + text=self._trad["mb_open_results_title"], + informative_text=self._trad["mb_open_results_invalid_results_msg"] + ) + def open_solver_results_adists(self, solver, results=None): def reading_fn(): self._tmp_results = results diff --git a/src/View/Translate.py b/src/View/Translate.py index 30434d4f..6bd9018b 100644 --- a/src/View/Translate.py +++ b/src/View/Translate.py @@ -180,6 +180,9 @@ class MainTranslate(UnitTranslate): ) # Message box + self._dict["Error"] = _translate( + "MainWindow", "Error" + ) self._dict["Warning"] = _translate( "MainWindow", "Warning" ) @@ -234,6 +237,17 @@ class MainTranslate(UnitTranslate): self._dict["mb_diff_results_param_msg"] = _translate( "MainWindow", "Results comparison parameters is invalid" ) + + self._dict["mb_open_results_title"] = _translate( + "MainWindow", "Open results" + ) + self._dict["mb_open_results_no_results_msg"] = _translate( + "MainWindow", "No results found" + ) + self._dict["mb_open_results_invalid_results_msg"] = _translate( + "MainWindow", "Failed to read results" + ) + self._dict["mb_diff_results_compatibility_msg"] = _translate( "MainWindow", "Results comparison with two "