Skip to content

Commit

Permalink
wxGUI/dbmgr: show warning message dialog if new layer table link exis…
Browse files Browse the repository at this point in the history
…ts (OSGeo#2428)
  • Loading branch information
tmszi authored Jun 20, 2022
1 parent 2dcc9d4 commit 2af9d79
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions gui/wxpython/dbmgr/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3725,29 +3725,34 @@ def OnAddLayer(self, event):
table=table,
key=key,
layer=layer,
getErrorMsg=True,
)

# insert records into table if required
if self.addLayerWidgets["addCat"][0].IsChecked():
RunCommand(
"v.to.db",
parent=self,
quiet=True,
map=self.mapDBInfo.map,
layer=layer,
qlayer=layer,
option="cat",
columns=key,
overwrite=True,
)

if ret == 0:
if ret[0] == 0 and not ret[1]:
# insert records into table if required
if self.addLayerWidgets["addCat"][0].IsChecked():
RunCommand(
"v.to.db",
parent=self,
quiet=True,
map=self.mapDBInfo.map,
layer=layer,
qlayer=layer,
option="cat",
columns=key,
overwrite=True,
)
# update dialog (only for new layer)
self.parentDialog.parentDbMgrBase.UpdateDialog(layer=layer)
# update db info
self.mapDBInfo = self.parentDialog.dbMgrData["mapDBInfo"]
# increase layer number
layerWin.SetValue(layer + 1)
elif ret[1]:
GWarning(
parent=self,
message=ret[1],
)

if len(self.mapDBInfo.layers.keys()) == 1:
# first layer add --- enable previously disabled widgets
Expand Down

0 comments on commit 2af9d79

Please sign in to comment.