From b5d38732315a964744c12ea52ed3ec51b42cd295 Mon Sep 17 00:00:00 2001 From: Tomas Zigo <50632337+tmszi@users.noreply.github.com> Date: Wed, 13 Sep 2023 20:51:40 +0200 Subject: [PATCH] wxGUI/dbmgr: fix sorting newly added column values (#2436) By left mouse click on the column or right mouse click invoked column menu items for sorting. --- gui/wxpython/dbmgr/base.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gui/wxpython/dbmgr/base.py b/gui/wxpython/dbmgr/base.py index 9c2d7a551af..f5344c33098 100644 --- a/gui/wxpython/dbmgr/base.py +++ b/gui/wxpython/dbmgr/base.py @@ -560,18 +560,19 @@ def OnColumnMenu(self, event): def OnColumnSort(self, event): """Column heading left mouse button -> sorting""" self._col = event.GetColumn() - + self._updateColSortFlag() self.ColumnSort() - event.Skip() def OnColumnSortAsc(self, event): """Sort values of selected column (ascending)""" + self._updateColSortFlag() self.SortListItems(col=self._col, ascending=True) event.Skip() def OnColumnSortDesc(self, event): """Sort values of selected column (descending)""" + self._updateColSortFlag() self.SortListItems(col=self._col, ascending=False) event.Skip() @@ -718,6 +719,14 @@ def IsEmpty(self): return True + def _updateColSortFlag(self): + """ + Update listmix.ColumnSorterMixin class self._colSortFlag list + private variable for new column which was added (required for + sorting new added column values) + """ + self._colSortFlag.extend([0] * (len(self.columns) - len(self._colSortFlag))) + class DbMgrBase: def __init__(