Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxGUI/dbmgr: fix sorting newly added column values #2436

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

tmszi
Copy link
Member

@tmszi tmszi commented Jun 14, 2022

Describe the bug
Sorting (asc/desc) newly added column values via wxGUI dbmgr doesn't work.

To Reproduce
Steps to reproduce the behavior:

  1. Launch Attribute Table Manager e.g g.gui.dbmgr geology
  2. Switch to Manage tables page (tab)
  3. Add new column e.g. area with double precision type
  4. Switch to Browse data page (tab)
  5. Right mouse click to the area column to invoke menu and choose Calculate (only numeric columns) -> Area size
  6. Left mouse click on the area column to sorting values
  7. 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

  1. Right mouse click to the area column to invoke menu and choose Sort ascending or Sort descending
  2. 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.

listmix.ColumnSorterMixin.__init__(self, len(self.columns))

If new column is added, private attribute self._colSortFlag isn't updated.

@tmszi tmszi added bug Something isn't working backport_needed GUI wxGUI related labels Jun 14, 2022
@tmszi tmszi added this to the 8.2.1 milestone Jun 14, 2022
@neteler neteler modified the milestones: 8.2.1, 8.2.2 Jan 22, 2023
@wenzeslaus wenzeslaus modified the milestones: 8.2.2, 8.3.1 Jun 6, 2023
By left mouse click on the col or right mouse click invoked
col menu items for sorting.
@tmszi tmszi force-pushed the wxgui_dbmgr_fix_sort_new_added_col_vals branch from 95aef2b to 04d510b Compare September 13, 2023 02:14
@tmszi
Copy link
Member Author

tmszi commented Sep 13, 2023

Rebase 04d510b.

@tmszi tmszi merged commit 69dd324 into OSGeo:main Sep 13, 2023
18 checks passed
tmszi added a commit to tmszi/grass that referenced this pull request Sep 13, 2023
By left mouse click on the column or right mouse click invoked
column menu items for sorting.
tmszi added a commit to tmszi/grass that referenced this pull request Sep 13, 2023
By left mouse click on the column or right mouse click invoked
column menu items for sorting.
@tmszi tmszi deleted the wxgui_dbmgr_fix_sort_new_added_col_vals branch September 13, 2023 18:54
landam pushed a commit to landam/grass that referenced this pull request Oct 25, 2023
By left mouse click on the column or right mouse click invoked
column menu items for sorting.
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
By left mouse click on the column or right mouse click invoked
column menu items for sorting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GUI wxGUI related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants