Skip to content

Commit

Permalink
[processing] Fix alg. postprocessing regression failing to add all bu…
Browse files Browse the repository at this point in the history
…t one output to the project
  • Loading branch information
nirvn committed Feb 16, 2025
1 parent 88383c3 commit 9c8c74d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions python/plugins/processing/gui/Postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def handleAlgorithmResults(
i = 0

added_layers: list[
tuple[Optional[QgsLayerTreeGroup], QgsLayerTreeLayer, QgsProject]
tuple[QgsMapLayer, Optional[QgsLayerTreeGroup], QgsLayerTreeLayer, QgsProject]
] = []
layers_to_post_process: list[
tuple[QgsMapLayer, QgsProcessingContext.LayerDetails]
Expand Down Expand Up @@ -245,7 +245,12 @@ def handleAlgorithmResults(
# later, after we've sorted all added layers
layer_tree_layer = create_layer_tree_layer(owned_map_layer, details)
added_layers.append(
(results_group, layer_tree_layer, details.project)
(
owned_map_layer,
results_group,
layer_tree_layer,
details.project,
)
)

if details.postProcessor():
Expand All @@ -272,7 +277,7 @@ def handleAlgorithmResults(

# sort added layer tree layers
sorted_layer_tree_layers = sorted(
added_layers, key=lambda x: x[1].customProperty(SORT_ORDER_CUSTOM_PROPERTY, 0)
added_layers, key=lambda x: x[2].customProperty(SORT_ORDER_CUSTOM_PROPERTY, 0)
)
have_set_active_layer = False

Expand All @@ -281,7 +286,7 @@ def handleAlgorithmResults(
current_selected_node = iface.layerTreeView().currentNode()
iface.layerTreeView().setUpdatesEnabled(False)

for group, layer_node, project in sorted_layer_tree_layers:
for layer, group, layer_node, project in sorted_layer_tree_layers:
if not project:
project = context.project()

Expand Down

0 comments on commit 9c8c74d

Please # to comment.