From a9b905a03957e8dfd37767f4be785213d7902c98 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr> Date: Wed, 26 Jul 2023 12:15:16 +0200 Subject: [PATCH] SL: Reach/Profile: Add update. --- src/View/SedimentLayers/Reach/Profile/Window.py | 9 +++++++++ src/View/SedimentLayers/Reach/Window.py | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/View/SedimentLayers/Reach/Profile/Window.py b/src/View/SedimentLayers/Reach/Profile/Window.py index a622bfb5..93b201a6 100644 --- a/src/View/SedimentLayers/Reach/Profile/Window.py +++ b/src/View/SedimentLayers/Reach/Profile/Window.py @@ -109,6 +109,9 @@ class ProfileSedimentLayersWindow(ASubMainWindow, ListedSubWindow): self.plot_layout = self.find(QVBoxLayout, "verticalLayout") self.plot_layout.addWidget(self.canvas) + self._update_plot() + + def _update_plot(self): self.plot = Plot( canvas = self.canvas, data = self._profile, @@ -124,6 +127,12 @@ class ProfileSedimentLayersWindow(ASubMainWindow, ListedSubWindow): self.copy_sc.activated.connect(self.copy) self.paste_sc.activated.connect(self.paste) + self._table.layoutChanged\ + .connect(self._update_plot) + self._table.dataChanged\ + .connect(self._update_plot) + + def index_selected_rows(self): table = self.find(QTableView, f"tableView") return list( diff --git a/src/View/SedimentLayers/Reach/Window.py b/src/View/SedimentLayers/Reach/Window.py index 01f36348..ee477edc 100644 --- a/src/View/SedimentLayers/Reach/Window.py +++ b/src/View/SedimentLayers/Reach/Window.py @@ -100,6 +100,9 @@ class ReachSedimentLayersWindow(ASubMainWindow, ListedSubWindow): self.plot_layout = self.find(QVBoxLayout, "verticalLayout_2") self.plot_layout.addWidget(self.canvas) + self._update_plot() + + def _update_plot(self): self.plot = Plot( canvas = self.canvas, data = self._reach, @@ -124,6 +127,12 @@ class ReachSedimentLayersWindow(ASubMainWindow, ListedSubWindow): self.copy_sc.activated.connect(self.copy) self.paste_sc.activated.connect(self.paste) + self._table.layoutChanged\ + .connect(self._update_plot) + self._table.dataChanged\ + .connect(self._update_plot) + + def index_selected_rows(self): table = self.find(QTableView, f"tableView") return list( @@ -144,9 +153,11 @@ class ReachSedimentLayersWindow(ASubMainWindow, ListedSubWindow): def undo(self): self._table.undo() + self._update_plot() def redo(self): self._table.redo() + self._update_plot() def apply_sl_each_profile(self): slw = SLDialog( @@ -157,6 +168,8 @@ class ReachSedimentLayersWindow(ASubMainWindow, ListedSubWindow): sl = slw.sl self._table.apply_sl_each_profile(sl) + self._update_plot() + def edit_profile(self): rows = self.index_selected_rows() -- GitLab