MainWindow: Add message box at results opening error.

scenario-dev-pa
Pierre-Antoine 2025-11-03 09:46:40 +01:00
parent 44a8be6be3
commit c63c776989
2 changed files with 30 additions and 0 deletions

View File

@ -1569,10 +1569,12 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
# No results available # No results available
if results is None: if results is None:
self.msg_open_results_no_results()
return return
# results does not have values, for example if geometry missmatch # results does not have values, for example if geometry missmatch
if not results.is_valid: if not results.is_valid:
self.msg_open_results_invalid_results()
return return
if results.get('study_revision') != self._study.status.version: if results.get('study_revision') != self._study.status.version:
@ -1598,6 +1600,20 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
) )
res.show() 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 open_solver_results_adists(self, solver, results=None):
def reading_fn(): def reading_fn():
self._tmp_results = results self._tmp_results = results

View File

@ -180,6 +180,9 @@ class MainTranslate(UnitTranslate):
) )
# Message box # Message box
self._dict["Error"] = _translate(
"MainWindow", "Error"
)
self._dict["Warning"] = _translate( self._dict["Warning"] = _translate(
"MainWindow", "Warning" "MainWindow", "Warning"
) )
@ -234,6 +237,17 @@ class MainTranslate(UnitTranslate):
self._dict["mb_diff_results_param_msg"] = _translate( self._dict["mb_diff_results_param_msg"] = _translate(
"MainWindow", "Results comparison parameters is invalid" "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( self._dict["mb_diff_results_compatibility_msg"] = _translate(
"MainWindow", "MainWindow",
"Results comparison with two " "Results comparison with two "