Skip to content

Commit

Permalink
Check - Look for duplicated label within the legend, for rule base re…
Browse files Browse the repository at this point in the history
…nderer
  • Loading branch information
Gustry committed Apr 5, 2024
1 parent fb68e99 commit afca016
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lizmap/project_checker_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def duplicated_rule_key_legend(project: QgsProject) -> Dict[str, Dict[str, int]]
return data


def duplicated_label_legend(project: QgsProject) -> Dict[str, list[str]]:
def duplicated_label_legend(project: QgsProject) -> Dict[str, List[str]]:
""" Check for all duplicated labels in the legend, per layer. """
results = {}
for layer in project.mapLayers().values():
Expand All @@ -517,12 +517,12 @@ def duplicated_label_legend(project: QgsProject) -> Dict[str, list[str]]:

# From QGIS source code :
# https://github.com/qgis/QGIS/blob/71499aacf431d3ac244c9b75c3d345bdc53572fb/src/core/symbology/qgsrendererregistry.cpp#L33
if renderer.type() in ("categorizedSymbol", "RuleRenderer", "graduatedSymbol"):
if renderer.type() in ("RuleRenderer", ):
results[layer.id()] = _duplicated_label_legend_layer(renderer)
return results


def _duplicated_label_legend_layer(renderer: QgsFeatureRenderer) -> list[str]:
def _duplicated_label_legend_layer(renderer: QgsFeatureRenderer) -> List[str]:
""" Check at the renderer level for the check above. """
# noinspection PyUnresolvedReferences
root_rule = renderer.rootRule()
Expand Down
2 changes: 1 addition & 1 deletion lizmap/widgets/check_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def __init__(self):
'duplicated_rule_key_label_legend',
tr('The layer has some duplicated "label" in its legend'),
tr(
"The layer should not have duplicated labels within its own legend. This is limitation on QGIS Server."
"The layer should not have duplicated labels within its own legend. This is a limitation on QGIS Server."
), (
'<ul>'
'<li>{}</li>'
Expand Down

0 comments on commit afca016

Please sign in to comment.