Commit ab776f15 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Friction: Connect to geometry update.

Showing with 20 additions and 16 deletions
+20 -16
......@@ -160,10 +160,10 @@ class FrictionsWindow(PamhyrWindow):
table = self.find(QTableView, f"tableView")
table.selectionModel()\
.selectionChanged\
.connect(self._set_current_reach)
.connect(self.update)
self._table.dataChanged\
.connect(self._set_current_reach)
.connect(self.update)
def index_selected_rows(self):
table = self.find(QTableView, f"tableView")
......@@ -177,6 +177,16 @@ class FrictionsWindow(PamhyrWindow):
)
)
def update(self):
self._set_current_reach()
# self._propagate_update(key="friction")
def _propagated_update(self, key=None):
if key != "geometry":
return
self.update_plot()
def _set_current_reach(self):
rows = self.index_selected_rows()
......@@ -190,23 +200,17 @@ class FrictionsWindow(PamhyrWindow):
sec = self._frictions.get(rows[0])
highlight = (sec.begin_kp, sec.end_kp)
self.plot = PlotKPZ(
canvas=self.canvas,
data=reach,
toolbar=None,
)
self.plot.highlight = highlight
self.plot.draw()
self.update_plot(highlight)
self.plot = PlotStricklers(
canvas=self.canvas_2,
data=data,
trad=self._trad,
toolbar=None
)
self.plot.highlight = highlight
def update_plot(self, highlight=None):
if highlight is not None:
self.plot.highlight = highlight
self.plot.draw()
if highlight is not None:
self.plot_2.highlight = highlight
self.plot_2.draw()
def add(self):
rows = self.index_selected_rows()
if len(self._frictions) == 0 or len(rows) == 0:
......
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