From e086958dd52d2da669978cd2727c7a23a2925fa7 Mon Sep 17 00:00:00 2001 From: UnknownUser95 Date: Sun, 7 Jul 2024 03:52:09 +0200 Subject: [PATCH] put loop in index_multi_select higher --- src/pickpack/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pickpack/__init__.py b/src/pickpack/__init__.py index 7697243..fe36d99 100644 --- a/src/pickpack/__init__.py +++ b/src/pickpack/__init__.py @@ -238,14 +238,13 @@ def get_selected_no_index(self) -> NodeNameOnly | list[NodeNameOnly]: def index_multi_select(self) -> list[NodeWithIndex]: nodes: list[tuple[str | Node, int]] = [] - if self.output_leaves_only: - for selected in self.all_selected: + for selected in self.all_selected: + if self.output_leaves_only: node: Node = find_by_index(self.options.node, selected) nodes.extend([(leaf, leaf.index) for leaf in get_leaves_only(node) if (leaf, leaf.index) not in nodes]) - else: - for selected in self.all_selected: + else: nodes.append((find_by_index(self.options.node, selected), selected)) - + if self.name_only: nodes = [(n[0].name, n[1]) for n in nodes]