diff --git a/src/View/Results/CustomExport/CustomExportAdis.py b/src/View/Results/CustomExport/CustomExportAdis.py index d8b845f351949f9842be241c2d59c4865ec40fdd..d2364ac6da88108ea812dd9e31b04ceb69dbec24 100644 --- a/src/View/Results/CustomExport/CustomExportAdis.py +++ b/src/View/Results/CustomExport/CustomExportAdis.py @@ -1,5 +1,5 @@ -# CustomPlotValuesSelectionDialog.py -- Pamhyr -# Copyright (C) 2023-2024 INRAE +# CustomExportAdis.py -- Pamhyr +# Copyright (C) 2023-2025 INRAE # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/View/Results/Window.py b/src/View/Results/Window.py index ccdd131ceb580ccde5950e273978524170db032b..ab3d58e9636ae731a16468a48c7e7104b6e36b0f 100644 --- a/src/View/Results/Window.py +++ b/src/View/Results/Window.py @@ -59,6 +59,7 @@ from View.Results.CustomPlot.Plot import CustomPlot from View.Results.CustomPlot.CustomPlotValuesSelectionDialog import ( CustomPlotValuesSelectionDialog, ) +from View.Results.CustomExport.CustomExport import CustomExportDialog from View.Results.Table import TableModel from View.Results.translate import ( @@ -665,9 +666,9 @@ class ResultsWindow(PamhyrWindow): def _export(self): - dlg = CustomPlotValuesSelectionDialog(parent=self) + dlg = CustomExportDialog(parent=self) if dlg.exec(): - x, y, envelop = dlg.value + x, y, envelop, solver_id = dlg.value else: return @@ -677,26 +678,26 @@ class ResultsWindow(PamhyrWindow): ) self.file_dialog( select_file="AnyFile", - callback=lambda f: self.export_to(f[0], x, y, envelop), + callback=lambda f: self.export_to(f[0], x, y, envelop, solver_id), default_suffix=".csv", file_filter=["CSV (*.csv)"], ) - def export_to(self, filename, x, y, envelop): - results = self._results[self._current_results[0]] + def export_to(self, filename, x, y, envelop, solver_id): + results = self._results[solver_id] reach = results.river.reachs[self._get_current_reach()] first_line = [f"Study: {results.study.name}", f"Reach: {reach.name}"] if x == "rk": timestamp = self._get_current_timestamp() first_line.append(f"Time: {timestamp}s") - val_dict = self._export_rk(timestamp, y, envelop) + val_dict = self._export_rk(timestamp, y, envelop, solver_id) elif x == "time": profile_id = self._get_current_profile() profile = reach.profile(profile_id) pname = profile.name if profile.name != "" else profile.rk first_line.append(f"Profile: {pname}") - val_dict = self._export_time(profile_id, y) + val_dict = self._export_time(profile_id, y, solver_id) with open(filename, 'w', newline='') as csvfile: writer = csv.writer(csvfile, delimiter=',', @@ -752,8 +753,8 @@ class ResultsWindow(PamhyrWindow): self._additional_plot.pop(tab_widget.tabText(index)) tab_widget.removeTab(index) - def _export_rk(self, timestamp, y, envelop): - results = self._results[self._current_results[0]] + def _export_rk(self, timestamp, y, envelop, solver_id): + results = self._results[solver_id] reach = results.river.reachs[self._get_current_reach()] dict_x = self._trad.get_dict("values_x") dict_y = self._trad.get_dict("values_y") @@ -997,8 +998,8 @@ class ResultsWindow(PamhyrWindow): return my_dict - def _export_time(self, profile, y): - results = self._results[self._current_results[0]] + def _export_time(self, profile, y, solver_id): + results = self._results[solver_id] reach = results.river.reachs[self._get_current_reach()] profile = reach.profile(profile) dict_x = self._trad.get_dict("values_x") diff --git a/src/View/Results/translate.py b/src/View/Results/translate.py index a2903b9662d753d563ab3cebb3de7e7d417ff8ea..834369dc10be5248f12f27f26b3507ff3b476e9c 100644 --- a/src/View/Results/translate.py +++ b/src/View/Results/translate.py @@ -42,7 +42,8 @@ class ResultsTranslate(MainTranslate): self._dict['day'] = _translate("Results", "day") self._dict['days'] = _translate("Results", "days") - self._dict['envelop'] = _translate("Results", "envelop") + self._dict['envelop'] = _translate("Results", "Envelop") + self._dict['solver'] = _translate("Results", "Solver") self._dict['x'] = _translate("Results", "X (m)") @@ -67,7 +68,7 @@ class ResultsTranslate(MainTranslate): } self._sub_dict["table_headers_solver"] = { - "solver": _translate("Results", "Solver"), + "solver": self._dict['solver'], } self._sub_dict["table_headers_pollutants"] = {