Skip to content

Commit

Permalink
Merge pull request #4 from opengisch/fixqlrexp
Browse files Browse the repository at this point in the history
No child layers should be considered when the group has QLR definitionfile.
  • Loading branch information
signedav authored Sep 8, 2022
2 parents 6bc659c + a389a41 commit d69aa83
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions toppingmaker/projecttopping.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,32 @@ def make_item(
self.properties.checked = node.itemVisibilityChecked()
self.properties.expanded = node.isExpanded()

definition_setting = export_settings.get_setting(
ExportSettings.ToppingType.DEFINITION, node, node.name()
)
if definition_setting.get("export", False):
self.properties.definitionfile = self._temporary_definitionfile(node)

if isinstance(node, QgsLayerTreeGroup):
# it's a group
self.properties.group = True
self.properties.mutually_exclusive = node.isMutuallyExclusive()

index = 0
for child in node.children():
item = ProjectTopping.LayerTreeItem()
item.make_item(project, child, export_settings)
# set the first checked item as mutually exclusive child
if (
self.properties.mutually_exclusive
and self.properties.mutually_exclusive_child == -1
):
if item.properties.checked:
self.properties.mutually_exclusive_child = index
self.items.append(item)
index += 1
if not definition_setting.get("export", False):
# only consider children, when the group is not exported as DEFINITION
index = 0
for child in node.children():
item = ProjectTopping.LayerTreeItem()
item.make_item(project, child, export_settings)
# set the first checked item as mutually exclusive child
if (
self.properties.mutually_exclusive
and self.properties.mutually_exclusive_child == -1
):
if item.properties.checked:
self.properties.mutually_exclusive_child = index
self.items.append(item)
index += 1
else:
if isinstance(node, QgsLayerTreeLayer):
layer = node.layer()
Expand Down Expand Up @@ -155,12 +163,6 @@ def make_item(
),
)

definition_setting = export_settings.get_setting(
ExportSettings.ToppingType.DEFINITION, node, node.name()
)
if definition_setting.get("export", False):
self.properties.definitionfile = self._temporary_definitionfile(node)

def _layer_of_node(
self,
project: QgsProject,
Expand Down

0 comments on commit d69aa83

Please sign in to comment.