Fix: keyword_class in draggable list

This commit is contained in:
Zebartin 2023-09-27 10:53:37 +08:00
parent b2fcbbc818
commit 4481da676c
2 changed files with 7 additions and 5 deletions

View File

@ -42,11 +42,9 @@ class DraggableList:
self.name = name
self.keyword_class = keyword_class
self.ocr_class = ocr_class
if not isinstance(keyword_class, list):
keyword_class = [keyword_class]
self.known_rows = [
kw for kc in keyword_class for kw in kc.instances.values()
]
if isinstance(keyword_class, list):
keyword_class = keyword_class[0]
self.known_rows = list(keyword_class.instances.values())
self.search_button = search_button
self.check_row_order = check_row_order
self.active_color = active_color

View File

@ -121,6 +121,10 @@ ASSIGNMENT_ENTRY_LIST = DraggableList(
check_row_order=False,
active_color=(40, 40, 40)
)
ASSIGNMENT_ENTRY_LIST.known_rows = [
kw for kc in ASSIGNMENT_ENTRY_LIST.keyword_class
for kw in kc.instances.values()
]
class AssignmentUI(UI):