From d5f136c413134112e5dc25c5b5614d8081605984 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Fri, 6 Jul 2018 14:45:41 +1200 Subject: [PATCH] improve behaviour when a spanning column makes table want to be wider than view --- subiquitycore/ui/table.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subiquitycore/ui/table.py b/subiquitycore/ui/table.py index 9fda168b..79e24e0d 100644 --- a/subiquitycore/ui/table.py +++ b/subiquitycore/ui/table.py @@ -256,6 +256,8 @@ def _compute_widths_for_size(maxcol, table_rows, colspecs, default_spacing): {2*user_i+1: cs.rpad for user_i, cs in colspecs.items() if cs.rpad is not None}) + widths_before = widths.copy() + # Make sure columns are big enough for cells that span mutiple # columns. for row in table_rows: @@ -271,6 +273,11 @@ def _compute_widths_for_size(maxcol, table_rows, colspecs, default_spacing): # If that column has a min_width, see if we need to omit any columns # to hit that target. if total_width > maxcol or unpacked_user_indices: + + for user_i in range(colcount): + if not colspecs[user_i].can_shrink and 2*user_i in widths: + widths[2*user_i] = widths_before[2*user_i] + for user_i in range(colcount): if colspecs[user_i].can_shrink or not colspecs[user_i].pack: if 2*user_i in widths: