Skip to content

Commit

Permalink
BUG: remove children and create proper row-widget when changing step …
Browse files Browse the repository at this point in the history
…type in-situ, closes #195
  • Loading branch information
tangkong committed Oct 2, 2023
1 parent 5026bab commit a934d4a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion atef/widgets/config/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ def replace_step(
if found_row is None:
return

step_row = ComparisonRowWidget(data=new_step)
step_row = ConfigurationGroupRowWidget(data=new_step)
self.setup_row_buttons(
row_widget=step_row,
item=comp_item,
Expand Down Expand Up @@ -1791,12 +1791,16 @@ def select_step_type(self, new_type_index: int) -> None:
return

step = cast_dataclass(data=self.data, new_type=new_type)
# Assumes self.parent_tree_item.widget: ProcedureGroupPage
# put another way, this assumes steps cannot be parent of other steps
self.parent_tree_item.widget.replace_step(
old_step=self.data,
new_step=step,
comp_item=self.tree_item,
)
self.tree_item.setText(1, new_type.__name__)
# remove old children, no longer needed.
self.tree_item.takeChildren()
self.new_step(step=step)
self.update_context()

Expand Down

0 comments on commit a934d4a

Please sign in to comment.