From a393486cef78caf4aa3522cbc97d54cdfeeb78b0 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Mon, 4 Dec 2023 13:32:45 -0500 Subject: [PATCH] TableResultTabWidget: Check all column widths to reduce wide ones. Previously it was only checking one column. Signed-off-by: Chris PeBenito --- setoolsgui/widgets/tab.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/setoolsgui/widgets/tab.py b/setoolsgui/widgets/tab.py index 875a960d..c6ed54d7 100644 --- a/setoolsgui/widgets/tab.py +++ b/setoolsgui/widgets/tab.py @@ -500,12 +500,17 @@ def query_completed(self, count: int) -> None: self.busy.setLabelText("Resizing the result table's columns; GUI may be unresponsive") self.busy.repaint() self.table_results.resizeColumnsToContents() - # If the permissions column width is too long, pull back - # to a reasonable size - header = self.table_results.horizontalHeader() - assert header, "No header set, this is an SETools bug" # type narrowing - if header.sectionSize(4) > 400: - header.resizeSection(4, 400) + + # If the column widths are too long, pull back to a reasonable size + header = self.table_results.horizontalHeader() + assert header, "No header set, this is an SETools bug" # type narrowing + self.busy.setLabelText("Resizing very wide columns; GUI may be unresponsive") + for i in range(header.count()): + if header.sectionSize(i) > 400: + header.resizeSection(i, 400) + + if self.busy.wasCanceled(): + break if not self.busy.wasCanceled(): self.busy.setLabelText("Resizing the result table's rows; GUI may be unresponsive")