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