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