Skip to content

Commit

Permalink
Temporary workaround when a layer is renamed #498
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Aug 25, 2023
1 parent ff8df8c commit 25cf37b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lizmap/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,7 @@ def initGui(self):
self.project.layersRemoved.connect(self.remove_layer_from_table_by_layer_ids)

self.project.layersAdded.connect(self.new_added_layers)
self.project.layerTreeRoot().nameChanged.connect(self.layer_renamed)

# Dataviz
self.dlg.button_add_dd_dataviz.setText('')
Expand Down Expand Up @@ -1753,6 +1754,20 @@ def new_added_layers(self, layers: List[QgsMapLayer]):
msg += ','.join(names)
self.iface.messageBar().pushMessage('Lizmap', msg, level=Qgis.Warning, duration=-1)

def layer_renamed(self, node, name: str):
""" When a layer/group is renamed in the legend. """
_ = node
if not self.dlg.check_cfg_file_exists():
# Not a Lizmap project
return

# Temporary workaround for
# https://github.com/3liz/lizmap-plugin/issues/498
msg = tr(
"The layer '{}' has been renamed. The configuration in the Lizmap <b>Layers</b> tab only must be checked."
).format(name)
self.iface.messageBar().pushMessage('Lizmap', msg, level=Qgis.Warning, duration=-1)

def remove_layer_from_table_by_layer_ids(self, layer_ids):
"""
Remove layers from tables when deleted from layer registry
Expand Down

0 comments on commit 25cf37b

Please sign in to comment.