From ee28afac8639522833fa98883e75630995a41cd5 Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Fri, 22 May 2026 12:57:34 +0200 Subject: [PATCH] HydraulicStructures: Fix hydraulic structures plot with missing input section --- src/View/HydraulicStructures/PlotRKC.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/View/HydraulicStructures/PlotRKC.py b/src/View/HydraulicStructures/PlotRKC.py index d7ee4faf..c36cafaa 100644 --- a/src/View/HydraulicStructures/PlotRKC.py +++ b/src/View/HydraulicStructures/PlotRKC.py @@ -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,