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

UX - Disable panel when the layer is excluded from WMS #524

Closed
wants to merge 1 commit into from
Closed
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
15 changes: 15 additions & 0 deletions lizmap/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2193,9 +2193,17 @@ def process_node(self, node, parent_node, json_layers):
self.myDic[child_id]['type']
]
)
server_wms_excluded_list, server_exclude = self.project.readListEntry('WMSRestrictedLayers', '')

if predefined_group != PredefinedGroup.No.value:
text = tr('Special group for Lizmap Web Client')
item.setToolTip(0, self.myDic[child_id]['name'] + ' - ' + text)
elif server_exclude and self.myDic[child_id]['name'] in server_wms_excluded_list:
text = tr(
'The layer is excluded from WMS service, in the '
'"Project Properties" → "QGIS Server" → "WMS" → "Excluded Layers"'
)
item.setToolTip(0, self.myDic[child_id]['name'] + ' - ' + text)
else:
item.setToolTip(0, self.myDic[child_id]['name'])
item.setIcon(0, child_icon)
Expand Down Expand Up @@ -2417,6 +2425,13 @@ def from_data_to_ui_for_layer_group(self):
if self._current_item_predefined_group() != PredefinedGroup.No.value:
self.dlg.gb_layerSettings.setEnabled(False)

layer = self._current_selected_layer()
if isinstance(layer, QgsMapLayer):
# Project properties → QGIS server → WMS → Exclude layers
server_wms_excluded_list, server_exclude = self.project.readListEntry('WMSRestrictedLayers', '')
if server_exclude and layer.name() in server_wms_excluded_list:
self.dlg.gb_layerSettings.setEnabled(False)

# def enable_or_not_toggle_checkbox(self):
# """ Only for groups, to determine the state of the "toggled" option. """
# if self.layer_options_list['groupAsLayer']['widget'].isChecked():
Expand Down