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

Māris Nartišs noreply at github.com
Sun Aug 7 00:26:51 PDT 2022


  Branch: refs/heads/releasebranch_8_2
  Home:   https://github.com/OSGeo/grass
  Commit: b274a68b684082f28a7eeaabeb95d76cb79d1403
      https://github.com/OSGeo/grass/commit/b274a68b684082f28a7eeaabeb95d76cb79d1403
  Author: Māris Nartišs <maris.gis at gmail.com>
  Date:   2022-08-07 (Sun, 07 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