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

Tip - Trailing spaces can be added #618

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions lizmap/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3182,6 +3182,7 @@ def check_project(
if results:
self.dlg.log_panel.append(tr("Duplicated labels in the legend"), Html.H2)
self.dlg.log_panel.append("<br>")
self.dlg.log_panel.append("<em>" + tr("A leading space can be added.") + "</em>")
self.dlg.log_panel.start_table()
Comment on lines +3185 to 3186
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leading or trailing or both ?

self.dlg.log_panel.append(
"<tr><th>{}</th><th>{}</th><th>{}</th></tr>".format(tr('Layer'), tr('Label'), tr('Count'))
Expand Down
6 changes: 6 additions & 0 deletions lizmap/project_checker_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,12 @@ def _clean_result(results: dict) -> dict:
for layer_id, labels in results.items():
data[layer_id] = {}
for label, count in labels.items():
if label == "":
# In a rule based symbology, this can be an empty string
label = tr("(empty string)")
else:
# Add some quotes, to see if they are some leading trailing spaces
label = f'"{label}"'
if count >= 2:
data[layer_id][label] = count

Expand Down
4 changes: 2 additions & 2 deletions lizmap/widgets/check_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ class SourceType:

Field = SourceField
Layer = SourceLayer
Groupe = SourceGroup
Group = SourceGroup


class Error:
Expand Down Expand Up @@ -1188,7 +1188,7 @@ def add_error(self, error: Error, lizmap_cloud: bool = False, severity=None, ico
layer = QgsProject.instance().mapLayer(error.source_type.layer_id)
item.setIcon(QgsMapLayerModel.iconForLayer(layer))
item.setData(self.JSON, error.source_type.layer_id)
elif isinstance(error.source_type, SourceType.Groupe):
elif isinstance(error.source_type, SourceType.Group):
item.setToolTip(error.source_type.name)
item.setIcon(QIcon(":images/themes/default/mActionFolder.svg"))
item.setData(self.JSON, error.source_type.name)
Expand Down
Loading