From 347a5979273f0bae76bde97bd3ea2a56c3a75a31 Mon Sep 17 00:00:00 2001 From: tanyar09 Date: Mon, 29 Sep 2025 12:51:03 -0400 Subject: [PATCH] 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. --- photo_tagger.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/photo_tagger.py b/photo_tagger.py index ab752b4..3670acf 100644 --- a/photo_tagger.py +++ b/photo_tagger.py @@ -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():