mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
IC: Fix display update and optimized discharge plot update.
This commit is contained in:
1 parent
61fd54c496
commit
8ca21c413f
2 files changed
+30
-2
No files matched your search
@@ -52,18 +52,41 @@ class PlotDischarge(PamhyrPlot):
|
||||
self._init = True
|
||||
|
||||
def draw_data(self):
|
||||
kp = self.data.reach.reach.get_kp()
|
||||
self.line_discharge = []
|
||||
|
||||
if len(self.data) != 0:
|
||||
kp = self.data.get_kp()
|
||||
discharge = self.data.get_discharge()
|
||||
|
||||
self.line_kp_zmin = self.canvas.axes.plot(
|
||||
line, = self.canvas.axes.plot(
|
||||
kp, discharge,
|
||||
color=self.color_plot,
|
||||
**self.plot_default_kargs
|
||||
)
|
||||
self.line_discharge.append(line)
|
||||
|
||||
@timer
|
||||
def update(self, ind=None):
|
||||
if not self._init:
|
||||
self.draw()
|
||||
|
||||
self.update_data()
|
||||
|
||||
self.update_idle()
|
||||
|
||||
def update_data(self):
|
||||
if len(self.data) == len(self.line_discharge):
|
||||
kp = self.data.get_kp()
|
||||
discharge = self.data.get_discharge()
|
||||
|
||||
line, = self.canvas.axes.plot(
|
||||
kp, discharge,
|
||||
color=self.color_plot,
|
||||
**self.plot_default_kargs
|
||||
)
|
||||
self.line_discharge.append(line)
|
||||
else:
|
||||
for line in self.line_discharge:
|
||||
line.remove()
|
||||
|
||||
self._draw_data()
|
||||
@@ -194,7 +194,12 @@ class InitialConditionsWindow(PamhyrWindow):
|
||||
return rows[0].row()
|
||||
|
||||
def update(self):
|
||||
self.update(propagate=False)
|
||||
|
||||
def _update(self, propagate=True):
|
||||
self._update_plot()
|
||||
|
||||
if propagate:
|
||||
self._propagate_update(key=Modules.INITIAL_CONDITION)
|
||||
|
||||
def _update_plot(self):
|
||||
|
||||
Reference in new issue
Block a user