HydraulicStructures: Fix hydraulic structures plot with missing input section

disable_edition_parent_scenario
Dylan Jeannin 2026-05-22 12:57:34 +02:00
parent 81ff6372e9
commit ee28afac86
1 changed files with 11 additions and 5 deletions

View File

@ -136,13 +136,18 @@ class PlotRKC(PamhyrPlot):
hs_color = []
index = self.parent.tableView.selectedIndexes()
for i, hs in enumerate(lhs):
section = hs.input_section
if section is None:
continue
if i == index[0].row():
hs_color.append("blue")
color = "blue"
elif hs.enabled:
hs_color.append("red")
color = "red"
else:
hs_color.append("darkgrey")
x = hs.input_section.rk
color = "darkgrey"
x = section.rk
if x is not None:
a = self.canvas.axes.annotate(
" > " + hs.name,
@ -151,12 +156,13 @@ class PlotRKC(PamhyrPlot):
verticalalignment='top',
annotation_clip=True,
fontsize=9,
color=hs_color[-1],
color=color,
)
self.anotate_lst.append(a)
vx.append(x)
vymin.append(min(z_min))
vymax.append(max(z_max))
hs_color.append(color)
self.hs_vlines = self.canvas.axes.vlines(
x=vx, ymin=vymin, ymax=vymax,