Skip to content

Commit

Permalink
feat: update combobox behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
PD-Mera committed May 13, 2024
1 parent 64d0908 commit aca9f33
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version_info__ = ('1', '8', '7')
__version_info__ = ('1', '8', '8')
__version__ = '.'.join(__version_info__)
4 changes: 4 additions & 0 deletions libs/combobox.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@ def __init__(self, parent=None, items=[]):
def update_items(self, items):
self.items = items

current_text = "[SHOW ALL]" if self.cb.currentText() == "" else self.cb.currentText()
new_index = items.index(current_text)
self.cb.clear()
self.cb.addItems(self.items)
self.cb.setCurrentIndex(new_index)

8 changes: 5 additions & 3 deletions mlabelImg.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,9 @@ def update_combo_box(self):

unique_text_list = list(set(items_text_list))
# Add a null row for showing all the labels
unique_text_list.append("")
unique_text_list.sort()

unique_text_list.insert(0, "[SHOW ALL]")
unique_text_list.insert(1, "[HIDE ALL]")
self.combo_box.update_items(unique_text_list)

def save_labels(self, annotation_file_path):
Expand Down Expand Up @@ -895,8 +895,10 @@ def copy_selected_shape(self):
def combo_selection_changed(self, index):
text = self.combo_box.cb.itemText(index)
for i in range(self.label_list.count()):
if text == "":
if text == "[SHOW ALL]":
self.label_list.item(i).setCheckState(2)
elif text == "[HIDE ALL]":
self.label_list.item(i).setCheckState(0)
elif text != self.label_list.item(i).text():
self.label_list.item(i).setCheckState(0)
else:
Expand Down

0 comments on commit aca9f33

Please sign in to comment.