Skip to content

Commit 9b6b4bc

Browse files
committed
Gracefully remove widgets from layout
1 parent 874965b commit 9b6b4bc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/napari_deeplabcut/_widgets.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,7 @@ def __init__(
11081108
self.setLayout(layout1)
11091109

11101110
def _map_individuals_to_bodyparts(self):
1111+
self.id2label.clear() # Empty dict so entries are ordered as in the config
11111112
for keypoint in self.store._keypoints:
11121113
label = keypoint.label
11131114
id_ = keypoint.id
@@ -1412,4 +1413,5 @@ def reset(self):
14121413
self.scheme_dict = {}
14131414
for i in reversed(range(self._layout.count())):
14141415
w = self._layout.itemAt(i).widget()
1416+
w.setParent(None)
14151417
self._layout.removeWidget(w)

0 commit comments

Comments
 (0)