Skip to content

Commit

Permalink
wxGUI/dbmgr: update Browse data page Simple SQL Query WHERE ComboBox …
Browse files Browse the repository at this point in the history
…widget column names choices (#2438)

* update Browse data page SQL Builder column names
ListBox widget column names choices

* update Browse data page column field calculator
column names ListBox widget choices

If new table column was added, renamed, deleted or
deleted are all columns.
  • Loading branch information
tmszi committed Sep 28, 2023
1 parent 0e04a75 commit b989e81
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion gui/wxpython/dbmgr/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2643,6 +2643,7 @@ def OnTableItemChange(self, event):
)
self.FindWindowById(self.layerPage[self.selLayer]["renameCol"]).SetSelection(0)
self.FindWindowById(self.layerPage[self.selLayer]["renameColTo"]).SetValue("")
self._updateTableColumnWidgetChoices(table=table)

event.Skip()

Expand Down Expand Up @@ -2730,6 +2731,7 @@ def OnTableItemDelete(self, event):
self.dbMgrData["mapDBInfo"].GetColumns(table)
)
self.FindWindowById(self.layerPage[self.selLayer]["renameCol"]).SetSelection(0)
self._updateTableColumnWidgetChoices(table=table)

event.Skip()

Expand Down Expand Up @@ -2777,6 +2779,7 @@ def OnTableItemDeleteAll(self, event):
self.dbMgrData["mapDBInfo"].GetColumns(table)
)
self.FindWindowById(self.layerPage[self.selLayer]["renameCol"]).SetSelection(0)
self._updateTableColumnWidgetChoices(table=table)

event.Skip()

Expand Down Expand Up @@ -2812,7 +2815,7 @@ def OnTableItemAdd(self, event):
self.dbMgrData["mapDBInfo"].GetColumns(table)
)
self.FindWindowById(self.layerPage[self.selLayer]["renameCol"]).SetSelection(0)

self._updateTableColumnWidgetChoices(table=table)
event.Skip()

def UpdatePage(self, layer):
Expand All @@ -2827,6 +2830,26 @@ def UpdatePage(self, layer):
)
self.OnTableReload(None)

def _updateTableColumnWidgetChoices(self, table):
"""Update table column widget choices
:param str table: table name
"""
cols = self.dbMgrData["mapDBInfo"].GetColumns(table)
# Browse data page SQL Query Simple page WHERE Combobox column names widget
self.FindWindowById(
self.pages["browse"].layerPage[self.selLayer]["whereColumn"]
).SetItems(cols)
# Browse data page SQL Query Builder page SQL builder frame ListBox column names widget
if self.pages["browse"].builder:
self.pages["browse"].builder.list_columns.Set(cols)
# Browse data page column Field calculator frame ListBox column names widget
fieldCalc = self.FindWindowById(
self.pages["browse"].layerPage[self.selLayer]["data"],
).fieldCalc
if fieldCalc:
fieldCalc.list_columns.Set(cols)


class DbMgrLayersPage(wx.Panel):
def __init__(self, parent, parentDbMgrBase):
Expand Down

0 comments on commit b989e81

Please sign in to comment.