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): ...@@ -45,7 +45,6 @@ class CustomPlotValuesSelectionDialog(PamhyrDialog):
self.setup_check_boxs() self.setup_check_boxs()
self.value = None self.value = None
self.export_to_csv = False
def setup_radio_buttons(self): def setup_radio_buttons(self):
self._radio = [] self._radio = []
...@@ -96,6 +95,5 @@ class CustomPlotValuesSelectionDialog(PamhyrDialog): ...@@ -96,6 +95,5 @@ class CustomPlotValuesSelectionDialog(PamhyrDialog):
) )
self.value = x, y self.value = x, y
self.export_to_csv = self.find(QCheckBox,
"checkBox_export").isChecked()
super().accept() super().accept()
...@@ -310,8 +310,8 @@ class ResultsWindow(PamhyrWindow): ...@@ -310,8 +310,8 @@ class ResultsWindow(PamhyrWindow):
actions = { actions = {
"action_reload": self._reload, "action_reload": self._reload,
"action_add": self._add_custom_plot, "action_add": self._add_custom_plot,
# "action_export": self.export, "action_export": self._export,
"action_export": self.export_current, # "action_export": self.export_current,
} }
for action in actions: for action in actions:
...@@ -491,17 +491,12 @@ class ResultsWindow(PamhyrWindow): ...@@ -491,17 +491,12 @@ class ResultsWindow(PamhyrWindow):
dlg = CustomPlotValuesSelectionDialog(parent=self) dlg = CustomPlotValuesSelectionDialog(parent=self)
if dlg.exec(): if dlg.exec():
x, y = dlg.value x, y = dlg.value
export = dlg.export_to_csv self.create_new_tab_custom_plot(x, y)
self.create_new_tab_custom_plot(x, y, export)
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)}" name = f"{x}: {','.join(y)}"
wname = f"tab_custom_{x}_{y}" wname = f"tab_custom_{x}_{y}"
if export:
self.export(x, y)
return
tab_widget = self.find(QTabWidget, f"tabWidget") tab_widget = self.find(QTabWidget, f"tabWidget")
# This plot already exists # This plot already exists
...@@ -590,7 +585,13 @@ class ResultsWindow(PamhyrWindow): ...@@ -590,7 +585,13 @@ class ResultsWindow(PamhyrWindow):
self._button_last.setEnabled(True) self._button_last.setEnabled(True)
self._button_play.setIcon(self._icon_start) 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( logger.debug(
"Export custom plot for: " + "Export custom plot for: " +
...@@ -741,8 +742,9 @@ class ResultsWindow(PamhyrWindow): ...@@ -741,8 +742,9 @@ class ResultsWindow(PamhyrWindow):
reach = self._results.river.reachs[self._get_current_reach()] reach = self._results.river.reachs[self._get_current_reach()]
profile = reach.profile(profile) profile = reach.profile(profile)
ts = list(self._results.get("timestamps")) ts = list(self._results.get("timestamps"))
ts.sort()
my_dict = {} my_dict = {}
my_dict["time"] = ts.sort() my_dict["time"] = ts
z = profile.get_key("Z") z = profile.get_key("Z")
q = profile.get_key("Q") q = profile.get_key("Q")
if "elevation" in y: if "elevation" in y:
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>414</width> <width>414</width>
<height>81</height> <height>70</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -44,33 +44,15 @@ ...@@ -44,33 +44,15 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="Line" name="line"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<resources/> <resources/>
......
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
<string>Export</string> <string>Export</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Export raw data</string> <string>Export data as CSV</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+E</string> <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