-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check for empty baselayers group in the legend fix #540
- Loading branch information
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
__license__ = 'GPL version 3' | ||
__email__ = '[email protected]' | ||
|
||
from qgis.core import QgsProject | ||
from qgis.core import QgsLayerTreeGroup, QgsProject | ||
|
||
|
||
def is_layer_wms_excluded(project: QgsProject, name: str) -> bool: | ||
|
@@ -12,3 +12,14 @@ def is_layer_wms_excluded(project: QgsProject, name: str) -> bool: | |
""" | ||
server_wms_excluded_list, server_exclude = project.readListEntry('WMSRestrictedLayers', '') | ||
return server_exclude and name in server_wms_excluded_list | ||
|
||
|
||
def empty_baselayers(project: QgsProject) -> bool: | ||
""" Check if the "baselayers" group is empty or not. """ | ||
root_group = project.layerTreeRoot() | ||
groups = root_group.findGroups() | ||
for qgis_group in groups: | ||
qgis_group: QgsLayerTreeGroup | ||
if qgis_group.name() == 'baselayers': | ||
return len(qgis_group.children()) == 0 | ||
return False |