Commit a95364db authored by Theophile Terraz's avatar Theophile Terraz
Browse files

replace export raw data by export to CSV

No related merge requests found
Pipeline #58586 passed with stages
in 7 minutes and 17 seconds
Showing with 20 additions and 38 deletions
+20 -38
......@@ -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()
......@@ -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:
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>414</width>
<height>81</height>
<height>70</height>
</rect>
</property>
<property name="windowTitle">
......@@ -44,33 +44,15 @@
</widget>
</item>
<item row="1" column="0">
<widget class="Line" name="line">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="checkBox_export">
<property name="text">
<string>Export to CSV</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
......
......@@ -262,7 +262,7 @@
<string>Export</string>
</property>
<property name="toolTip">
<string>Export raw data</string>
<string>Export data as CSV</string>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment