diff --git a/src/View/Results/CustomPlot/CustomPlotValuesSelectionDialog.py b/src/View/Results/CustomPlot/CustomPlotValuesSelectionDialog.py index 631a530a..e88e5386 100644 --- a/src/View/Results/CustomPlot/CustomPlotValuesSelectionDialog.py +++ b/src/View/Results/CustomPlot/CustomPlotValuesSelectionDialog.py @@ -45,7 +45,6 @@ class CustomPlotValuesSelectionDialog(PamhyrDialog): self.setup_check_boxs() self.value = None - self.export_to_csv = False def setup_radio_buttons(self): self._radio = [] @@ -96,6 +95,5 @@ class CustomPlotValuesSelectionDialog(PamhyrDialog): ) self.value = x, y - self.export_to_csv = self.find(QCheckBox, - "checkBox_export").isChecked() + super().accept() diff --git a/src/View/Results/Window.py b/src/View/Results/Window.py index 325b16e3..b1872102 100644 --- a/src/View/Results/Window.py +++ b/src/View/Results/Window.py @@ -310,8 +310,8 @@ class ResultsWindow(PamhyrWindow): actions = { "action_reload": self._reload, "action_add": self._add_custom_plot, - # "action_export": self.export, - "action_export": self.export_current, + "action_export": self._export, + # "action_export": self.export_current, } for action in actions: @@ -491,17 +491,12 @@ class ResultsWindow(PamhyrWindow): dlg = CustomPlotValuesSelectionDialog(parent=self) if dlg.exec(): x, y = dlg.value - export = dlg.export_to_csv - self.create_new_tab_custom_plot(x, y, export) + self.create_new_tab_custom_plot(x, y) - def create_new_tab_custom_plot(self, x: str, y: list, export: bool): + def create_new_tab_custom_plot(self, x: str, y: list): name = f"{x}: {','.join(y)}" wname = f"tab_custom_{x}_{y}" - if export: - self.export(x, y) - return - tab_widget = self.find(QTabWidget, f"tabWidget") # This plot already exists @@ -590,7 +585,13 @@ class ResultsWindow(PamhyrWindow): self._button_last.setEnabled(True) self._button_play.setIcon(self._icon_start) - def export(self, x: str, y: list): + def _export(self): + + dlg = CustomPlotValuesSelectionDialog(parent=self) + if dlg.exec(): + x, y = dlg.value + else: + return logger.debug( "Export custom plot for: " + @@ -741,8 +742,9 @@ class ResultsWindow(PamhyrWindow): reach = self._results.river.reachs[self._get_current_reach()] profile = reach.profile(profile) ts = list(self._results.get("timestamps")) + ts.sort() my_dict = {} - my_dict["time"] = ts.sort() + my_dict["time"] = ts z = profile.get_key("Z") q = profile.get_key("Q") if "elevation" in y: diff --git a/src/View/ui/CustomPlotValuesSelectionDialog.ui b/src/View/ui/CustomPlotValuesSelectionDialog.ui index fb9334d1..f7daec37 100644 --- a/src/View/ui/CustomPlotValuesSelectionDialog.ui +++ b/src/View/ui/CustomPlotValuesSelectionDialog.ui @@ -7,7 +7,7 @@ 0 0 414 - 81 + 70 @@ -44,33 +44,15 @@ - + Qt::Horizontal + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + - - - - - - Export to CSV - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - diff --git a/src/View/ui/Results.ui b/src/View/ui/Results.ui index 1b4a93ee..e92bdab4 100644 --- a/src/View/ui/Results.ui +++ b/src/View/ui/Results.ui @@ -262,7 +262,7 @@ Export - Export raw data + Export data as CSV Ctrl+E