grass
grass copied to clipboard
wxGUI/dbmgr: fix sorting newly added column values
Describe the bug Sorting (asc/desc) newly added column values via wxGUI dbmgr doesn't work.
To Reproduce Steps to reproduce the behavior:
- Launch Attribute Table Manager e.g
g.gui.dbmgr geology - Switch to Manage tables page (tab)
- Add new column e.g. area with double precision type
- Switch to Browse data page (tab)
- Right mouse click to the area column to invoke menu and choose Calculate (only numeric columns) -> Area size
- Left mouse click on the area column to sorting values
- See error
Traceback (most recent call last):
File "/home/tomas/.local/lib/python3.9/site-packages/wx/lib/mixins/listctrl.py", line 129, in __OnColClick
self._colSortFlag[col] = int(not self._colSortFlag[col])
IndexError: list index out of range
or
- Right mouse click to the area column to invoke menu and choose Sort ascending or Sort descending
- See error
Traceback (most recent call last):
File "/usr/lib64/grass83/gui/wxpython/dbmgr/base.py", line 580, in OnColumnSortAsc
self.SortListItems(col=self._col, ascending=True)
File "/home/tomas/.local/lib/python3.9/site-packages/wx/lib/mixins/listctrl.py", line 88, in SortListItems
self._colSortFlag[col] = ascending
IndexError: list assignment index out of range
Expected behavior Sorting (asc/desc) newly added column values via wxGUI dbmgr should be work without error message.
System description (please complete the following information):
- Operating System: all
- GRASS GIS version: all
Additional context
VirtualAttributeList class initialize private attribute self._colSortFlag inside listmix.ColumnSorterMixin.__init__() method, SetColumnCount() method during VirtualAttributeList class initialization, __init__() method.
https://github.com/OSGeo/grass/blob/1e0f8882da51d682982d048bb9031aa2587c0377/gui/wxpython/dbmgr/base.py#L146
If new column is added, private attribute self._colSortFlag isn't updated.