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: show warning message dialog if new layer table link exists #2428

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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