Enhance PhotoTagger GUI to update the right panel based on filtered results. Implement logic to load and display faces for the first person in the list after filtering or clearing the last name search, improving user experience and visual feedback. Ensure proper handling of UI states and clear faces panel when no matches are found.
This commit is contained in:
parent
62bb0dc31f
commit
347a597927
@ -3480,12 +3480,54 @@ class PhotoTagger:
|
||||
else:
|
||||
people_filtered = None
|
||||
populate_people_list()
|
||||
# Update right panel based on filtered results
|
||||
source = people_filtered if people_filtered is not None else people_data
|
||||
if source:
|
||||
# Load faces for the first person in the list
|
||||
first = source[0]
|
||||
try:
|
||||
# Update selection state
|
||||
for child in people_list_inner.winfo_children():
|
||||
for widget in child.winfo_children():
|
||||
if isinstance(widget, ttk.Label):
|
||||
widget.config(font=("Arial", 10))
|
||||
# Bold the first label if present
|
||||
first_row = people_list_inner.winfo_children()[0]
|
||||
for widget in first_row.winfo_children():
|
||||
if isinstance(widget, ttk.Label):
|
||||
widget.config(font=("Arial", 10, "bold"))
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
# Show faces for the first person
|
||||
show_person_faces(first['id'], first.get('full_name') or first.get('name') or "")
|
||||
else:
|
||||
# No matches: clear faces panel
|
||||
clear_faces_panel()
|
||||
|
||||
def clear_last_name_filter():
|
||||
nonlocal people_filtered
|
||||
last_name_search_var.set("")
|
||||
people_filtered = None
|
||||
populate_people_list()
|
||||
# After clearing, load faces for the first available person if any
|
||||
if people_data:
|
||||
first = people_data[0]
|
||||
try:
|
||||
for child in people_list_inner.winfo_children():
|
||||
for widget in child.winfo_children():
|
||||
if isinstance(widget, ttk.Label):
|
||||
widget.config(font=("Arial", 10))
|
||||
first_row = people_list_inner.winfo_children()[0]
|
||||
for widget in first_row.winfo_children():
|
||||
if isinstance(widget, ttk.Label):
|
||||
widget.config(font=("Arial", 10, "bold"))
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
show_person_faces(first['id'], first.get('full_name') or first.get('name') or "")
|
||||
else:
|
||||
clear_faces_panel()
|
||||
|
||||
def clear_faces_panel():
|
||||
for w in faces_inner.winfo_children():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user