Skip to content

Commit af78d76

Browse files
authored
Merge pull request #48 from tudelft3d/gio-dev
Update loader_dialog.py
2 parents c5cd5ad + 1e9aa04 commit af78d76

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

cdb4/gui_loader/loader_dialog.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -985,20 +985,27 @@ def evt_btnDropLayers_clicked(self) -> None:
985985
"""
986986
# Check whether there are layers loaded in QGIS, and inform the user. If the user decides to drop the layers
987987
# all loaded layers will lose the link to the respective database view and should be removed before.
988+
drop_layers: bool = True
988989

989-
curr_db_node = tl_f.get_citydb_node(dlg=self)
990+
curr_db_node = tl_f.get_citydb_node(dlg=self)
991+
# print("curr_db_node:", curr_db_node.name())
990992
curr_cdb_schema_node_label: str = "@".join([self.DB.username, self.CDB_SCHEMA])
991993

994+
992995
if curr_db_node:
993996
curr_cdb_schema_node = curr_db_node.findGroup(name=curr_cdb_schema_node_label)
997+
# print("curr_cdb_schema_node:", curr_cdb_schema_node.name())
994998
if curr_cdb_schema_node:
999+
9951000
msg: str = f"This will force the <b>automatic removal of all layers, detail views and look-up tables</b> currently loaded in QGIS and visible in group <b>'{curr_cdb_schema_node_label}'</b> of <b>'{self.DB.db_toc_node_label}'</b>.<br><br>Do you want to proceed anyway?"
9961001
res = QMessageBox.question(self, "Drop layers", msg)
1002+
9971003
if res == QMessageBox.Yes:
9981004
curr_db_node.removeChildNode(curr_cdb_schema_node)
999-
thr.run_drop_layers_thread(dlg=self)
1000-
else:
1001-
# There are no layers loaded in QGIS, we can drop the layers in the database without problems.
1005+
else:
1006+
drop_layers = False
1007+
1008+
if drop_layers:
10021009
thr.run_drop_layers_thread(dlg=self)
10031010

10041011
return None

0 commit comments

Comments
 (0)