Skip to content

Commit 650db1d

Browse files
committed
There was an issues, When last label was being deleted, object list was not clearing: now its removed, by changing the condition in file list_widget.py in Class:CustomObjectListWidget in Methods: set_label_list()
1 parent 8a6dadd commit 650db1d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

labelvim/labelvim/widgets/list_widgets.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -493,15 +493,15 @@ def set_label_list(self, category_id: list = [], object_id: list = []):
493493
label_list (list, optional): A list of label names to display. Defaults to an empty list.
494494
"""
495495
# Check if the label list is a non-empty list
496-
if isinstance(category_id, list) and len(category_id) > 0 and isinstance(object_id, list) and len(object_id) > 0:
496+
# if isinstance(category_id, list) and len(category_id) > 0 and isinstance(object_id, list) and len(object_id) > 0:
497497
# Clear the model before updating
498-
self.clear_list()
499-
# Update the label list and model
500-
self.category_id = category_id
501-
self.object_id = object_id
502-
object_list = [f"{self.label_list[id]}" for id in category_id]
503-
# update the model
504-
self.model.setStringList(object_list)
498+
self.clear_list()
499+
# Update the label list and model
500+
self.category_id = category_id
501+
self.object_id = object_id
502+
object_list = [f"{self.label_list[id]}" for id in category_id]
503+
# update the model
504+
self.model.setStringList(object_list)
505505

506506
def clear_list(self):
507507
"""
@@ -534,6 +534,7 @@ def remove_label(self, data: list):
534534
Args:
535535
label (str): The label to remove.
536536
"""
537+
print(f"Data To Be remoed: {data}")
537538
category_id = [label["category_id"] for label in data]
538539
object_id = [label['id'] for label in data]
539540
self.object = {label['id']: label['category_id'] for label in data}

0 commit comments

Comments
 (0)