Skip to content

Commit

Permalink
Merge pull request #48 from tudelft3d/gio-dev
Browse files Browse the repository at this point in the history
Update loader_dialog.py
  • Loading branch information
gioagu authored Nov 12, 2023
2 parents c5cd5ad + 1e9aa04 commit af78d76
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cdb4/gui_loader/loader_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,20 +985,27 @@ def evt_btnDropLayers_clicked(self) -> None:
"""
# Check whether there are layers loaded in QGIS, and inform the user. If the user decides to drop the layers
# all loaded layers will lose the link to the respective database view and should be removed before.
drop_layers: bool = True

curr_db_node = tl_f.get_citydb_node(dlg=self)
curr_db_node = tl_f.get_citydb_node(dlg=self)
# print("curr_db_node:", curr_db_node.name())
curr_cdb_schema_node_label: str = "@".join([self.DB.username, self.CDB_SCHEMA])


if curr_db_node:
curr_cdb_schema_node = curr_db_node.findGroup(name=curr_cdb_schema_node_label)
# print("curr_cdb_schema_node:", curr_cdb_schema_node.name())
if curr_cdb_schema_node:

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?"
res = QMessageBox.question(self, "Drop layers", msg)

if res == QMessageBox.Yes:
curr_db_node.removeChildNode(curr_cdb_schema_node)
thr.run_drop_layers_thread(dlg=self)
else:
# There are no layers loaded in QGIS, we can drop the layers in the database without problems.
else:
drop_layers = False

if drop_layers:
thr.run_drop_layers_thread(dlg=self)

return None
Expand Down

0 comments on commit af78d76

Please sign in to comment.