From 3ea11a7657e50197460639f930e87a59690e45fa Mon Sep 17 00:00:00 2001 From: Florian Vahl Date: Fri, 5 Apr 2024 16:35:32 +0200 Subject: [PATCH] Use tree instead of stack for the names of the uninit actions --- .../dynamic_stack_decider_visualization/dsd_follower.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dynamic_stack_decider_visualization/dynamic_stack_decider_visualization/dsd_follower.py b/dynamic_stack_decider_visualization/dynamic_stack_decider_visualization/dsd_follower.py index 9b73fa8..34623da 100644 --- a/dynamic_stack_decider_visualization/dynamic_stack_decider_visualization/dsd_follower.py +++ b/dynamic_stack_decider_visualization/dynamic_stack_decider_visualization/dsd_follower.py @@ -312,6 +312,9 @@ def to_q_item_model(self): # Start with the root/bottom of the stack stack_element = self.stack + # Store the corresponding tree element + tree_element = self.tree + # Go through all stack elements while stack_element is not None: # Sanity check @@ -327,7 +330,7 @@ def to_q_item_model(self): # Set the text of the item if stack_element["type"] == "sequence": # Get the names of all actions - action_names = [element["name"] for element in stack_element["current_action"]] + action_names = [action["name"] for action in tree_element["action_elements"]] # Join them together and set the text elem_item.setText("Sequence: " + ", ".join(action_names)) else: @@ -351,6 +354,9 @@ def to_q_item_model(self): # Go to next element stack_element = stack_element["next"] + # Also select the corresponding tree element if there are any + if "children" in tree_element and stack_element is not None: + tree_element = tree_element["children"][stack_element["activation_reason"]] return model