Skip to content

Commit

Permalink
fix: updated _delete_single_drive method to update titles
Browse files Browse the repository at this point in the history
  • Loading branch information
gtdang authored and ntolley committed Sep 23, 2024
1 parent 13b1a52 commit eb212bc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions hnn_core/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,15 +640,22 @@ def _cell_layer_radio_change(value):
'value')

def _delete_single_drive(self, b):
index = self.drive_accordion.selected_index

# Remove selected drive from drive lists
self.drive_boxes.pop(self.drive_accordion.selected_index)
self.drive_widgets.pop(self.drive_accordion.selected_index)
self.drive_boxes.pop(index)
self.drive_widgets.pop(index)

# Rebuild the accordion collection
self.drive_accordion.titles = tuple(
t for i, t in enumerate(self.drive_accordion.titles) if i != index
)
self.drive_accordion.selected_index = None
self.drive_accordion.children = self.drive_boxes

# Render
self._drives_out.clear_output()
with self._drives_out:
self.drive_accordion.selected_index = None
self.drive_accordion.children = self.drive_boxes
display(self.drive_accordion)

def compose(self, return_layout=True):
Expand Down

0 comments on commit eb212bc

Please sign in to comment.