mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
HS: Refacto update function and fix NA value at table data set.
This commit is contained in:
1 parent
eea355a784
commit
163a842384
2 files changed
+36
-24
No files matched your search
@@ -264,36 +264,41 @@ class HydraulicStructuresWindow(PamhyrWindow):
|
||||
|
||||
def update(self):
|
||||
self._set_checkbox_state()
|
||||
self._update_clear_plot()
|
||||
|
||||
def _update_clear_plot(self):
|
||||
rows = self.index_selected_rows()
|
||||
|
||||
if len(rows) > 0 and len(self._hs_lst) > 0:
|
||||
reach = self._hs_lst.get(rows[0]).input_reach
|
||||
else:
|
||||
reach = None
|
||||
self.plot_kpc.clear()
|
||||
self.plot_ac.clear()
|
||||
if len(rows) == 0 or len(self._hs_lst) == 0:
|
||||
self._update_clear_all()
|
||||
return
|
||||
|
||||
profile_kp = self._hs_lst.get(rows[0]).input_kp
|
||||
if profile_kp is None or profile_kp == "Not associated":
|
||||
profile = None
|
||||
self.plot_ac.clear()
|
||||
self.plot_kpc.clear_profile()
|
||||
else:
|
||||
profile = reach.reach.get_profiles_from_kp(float(profile_kp))
|
||||
|
||||
if reach is not None and reach != "Not associated":
|
||||
reach = self._hs_lst.get(rows[0]).input_reach
|
||||
if reach is not None:
|
||||
self.plot_kpc.set_reach(reach)
|
||||
self.plot_ac.set_reach(reach)
|
||||
else:
|
||||
self.plot_kpc.clear()
|
||||
self.plot_ac.clear()
|
||||
return
|
||||
|
||||
if profile is not None:
|
||||
self.plot_kpc.set_profile(profile[0])
|
||||
self.plot_ac.set_profile(profile[0])
|
||||
profile_kp = self._hs_lst.get(rows[0]).input_kp
|
||||
if profile_kp is not None:
|
||||
profiles = reach.reach\
|
||||
.get_profiles_from_kp(
|
||||
float(profile_kp)
|
||||
)
|
||||
|
||||
if profiles is not None:
|
||||
profile = profiles[0]
|
||||
|
||||
self.plot_kpc.set_profile(profile)
|
||||
self.plot_ac.set_profile(profile)
|
||||
else:
|
||||
self._update_clear_profile()
|
||||
else:
|
||||
self.plot_ac.clear()
|
||||
self.plot_kpc.clear_profile()
|
||||
self._update_clear_all()
|
||||
|
||||
def _update_clear_all(self):
|
||||
self.plot_kpc.clear()
|
||||
self.plot_ac.clear()
|
||||
|
||||
def _update_clear_profile(self):
|
||||
self.plot_ac.clear()
|
||||
self.plot_kpc.clear_profile()
|
||||
Reference in new issue
Block a user