From 878ce2cf6917ac5f8fe33e0682e3434017836469 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Mon, 7 Aug 2023 18:20:19 +0100 Subject: [PATCH] Save column sizes before a rebuild To prevent overriding the defaults, don't save sizes before the initial build. Save column sizes as floats rather than integers. This prevents seeing a slight column resize after a rebuild. Fixes #12943. --- gramps/gui/views/listview.py | 2 ++ gramps/gui/widgets/persistenttreeview.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gramps/gui/views/listview.py b/gramps/gui/views/listview.py index 2ab08dcee89..fce21836d57 100644 --- a/gramps/gui/views/listview.py +++ b/gramps/gui/views/listview.py @@ -328,6 +328,8 @@ def set_inactive(self): self.uistate.viewmanager.tags.tag_disable() def build_tree(self, force_sidebar=False, preserve_col=True): + if self.list.get_columns()[0].get_width() > 0: + self.list.save_column_info(self.list) if self.active: cput0 = perf_counter() if not self.search_bar.is_visible(): diff --git a/gramps/gui/widgets/persistenttreeview.py b/gramps/gui/widgets/persistenttreeview.py index 6a8276b4707..59ee259f205 100644 --- a/gramps/gui/widgets/persistenttreeview.py +++ b/gramps/gui/widgets/persistenttreeview.py @@ -115,7 +115,7 @@ def get_columns_size(self): # Don't resize the icons size = 2 else: - size = int(column.get_width() / char_width) + 1 + size = column.get_width() / char_width size = 2 if size < 2 else size newsize.append(size) nbc += 1