From aac6e172f6e4583e751bee00db6f381aaff8ac69 Mon Sep 17 00:00:00 2001 From: wyzula-jan <133381102+wyzula-jan@users.noreply.github.com> Date: Fri, 1 Sep 2023 09:41:32 +0200 Subject: [PATCH] fix: check if num_columns is not higher that actual number of plots --- bec_widgets/examples/extreme/extreme.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bec_widgets/examples/extreme/extreme.py b/bec_widgets/examples/extreme/extreme.py index 85eab541..fe7011df 100644 --- a/bec_widgets/examples/extreme/extreme.py +++ b/bec_widgets/examples/extreme/extreme.py @@ -130,6 +130,15 @@ class PlotApp(QWidget): self.grid_coordinates = [] num_plots = len(self.plot_data) + + # Check if num_columns exceeds the number of plots + if num_columns > num_plots: + num_columns = num_plots + self.plot_settings["num_columns"] = num_columns # Update the settings + print( + f"Warning: num_columns in the YAML file was greater than the number of plots. Resetting num_columns to {num_columns}." + ) + num_rows = num_plots // num_columns last_row_cols = num_plots % num_columns remaining_space = num_columns - last_row_cols