[GRASS-git] [OSGeo/grass] 2f7e14: GUI: looping over GetSelections() results in remov...

Māris Nartišs noreply at github.com
Fri Aug 5 07:55:16 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 2f7e14a05d3ce960447e500c67b2da4138a1c4a4
      https://github.com/OSGeo/grass/commit/2f7e14a05d3ce960447e500c67b2da4138a1c4a4
  Author: Māris Nartišs <maris.gis at gmail.com>
  Date:   2022-08-05 (Fri, 05 Aug 2022)

  Changed paths:
    M gui/wxpython/gui_core/dialogs.py

  Log Message:
  -----------
  GUI: looping over GetSelections() results in removal of all list items (#2511)

* GUI: wx.ListBox is dynamic – looping over GetSelections() results in removal of all list items

When the last item returned by GetSelections() has been .Delete()'d a new item is selected. The newly selected item is added to GetSelections(). If user selects the last item from a list, looping over GetSelections() output eventually will remove all list items not only ones selected by the user.
This is a workaround by freezing user selection in a list and iterating it in a reverse order as each .Delete() call updates the ListBox and thus changes positions of selected items. Reverse traversal ensures that no selected item gets a new position in the list.




More information about the grass-commit mailing list