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: do not modify layer settings if settings have not changed #3143

Conversation

tmszi
Copy link
Member

@tmszi tmszi commented Sep 11, 2023

Describe the bug
The wxGUI Attribute Table Manager adjusts the layer settings even if the settings have not changed while pressing the Modify layer button.

To Reproduce
Steps to reproduce the behavior:

  1. Launch Attribute Table Manager e.g. g.gui.dbmgr geology
  2. On the Attribute Table Manager window switch to the Manage Layers page (tab)
  3. On the Manage Layers page (tab) switch to the Modify layer page (tab)
  4. Do not change layer settings
  5. Hit Modify layer button
  6. See error
Traceback (most recent call last):
  File "/usr/lib64/grass84/gui/wxpython/dbmgr/base.py", line 3896, in OnModifyLayer
    self.parentDialog.parentDbMgrBase.UpdateDialog(layer=layer)
  File "/usr/lib64/grass84/gui/wxpython/dbmgr/manager.py", line 253, in UpdateDialog
    DbMgrBase.UpdateDialog(self, layer=layer)
  File "/usr/lib64/grass84/gui/wxpython/dbmgr/base.py", line 854, in UpdateDialog
    self.pages["browse"].DeletePage(layer)
  File "/usr/lib64/grass84/gui/wxpython/dbmgr/base.py", line 1023, in DeletePage
    self.selLayer = self.layers[self.GetSelection()]
IndexError: list index out of range

Expected behavior
The wxGUI Attribute Table Manager don't adjusts the layer settings if the settings have not changed while pressing the Modify layer button.

System description (please complete the following information):

  • Operating System: all
  • GRASS GIS version: all
GRASS nc_basic_spm_grass7/PERMANENT:~ > python3 -c "import sys, wx; print(sys.version); print(wx.version())"
3.10.13 (main, Aug 25 2023, 20:13:27) [GCC 12.3.1 20230526]
4.2.0 gtk3 (phoenix) wxWidgets 3.2.2.1

Additional context
Issue related to incorrectly evaluated if condition (layer settings changed), especially line 3863 self.modifyLayerWidgets["database"][1].GetStringSelection().

Layer Database setting is TextCtrl widget and self.modifyLayerWidgets["database"][1].GetStringSelection() code especially GetStringSelection() method return empty string. Correct method for return control value should be GetValue().

if (
self.modifyLayerWidgets["driver"][1].GetStringSelection()
!= self.mapDBInfo.layers[layer]["driver"]
or self.modifyLayerWidgets["database"][1].GetStringSelection()
!= self.mapDBInfo.layers[layer]["database"]
or self.modifyLayerWidgets["table"][1].GetStringSelection()
!= self.mapDBInfo.layers[layer]["table"]
or self.modifyLayerWidgets["key"][1].GetStringSelection()
!= self.mapDBInfo.layers[layer]["key"]
):
modify = True

@tmszi tmszi added bug Something isn't working GUI wxGUI related backport to 8.3 labels Sep 11, 2023
@tmszi tmszi added this to the 8.3.1 milestone Sep 11, 2023
@tmszi tmszi merged commit 3534782 into OSGeo:main Sep 26, 2023
18 checks passed
@tmszi tmszi deleted the wxgui-dbmgr-do-not-modify-layer-settings-if-settings-not-changed branch September 26, 2023 11:56
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
HuidaeCho pushed a commit to HuidaeCho/grass that referenced this pull request Jan 9, 2024
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.

2 participants