@@ -1200,75 +1200,6 @@ def display_result_animated(
12001200 if draw_count is None :
12011201 draw_count = widget .current_count
12021202
1203- cached_widgets = getattr (widget , "_cached_animation_widgets" , None )
1204- cached_count = len (cached_widgets ) if cached_widgets else 0
1205- current_count = len (selected_students ) if selected_students else 0
1206-
1207- if cached_widgets and cached_count == current_count and current_count > 0 :
1208- new_texts = []
1209- new_colors = []
1210- font_size = render_settings .get ("font_size" , 50 )
1211- animation_color = render_settings .get ("animation_color" , 0 )
1212- display_format = render_settings .get ("display_format" , 0 )
1213-
1214- for item in selected_students :
1215- if isinstance (item , (list , tuple )) and len (item ) >= 2 :
1216- student_id = str (item [0 ]) if item [0 ] is not None else ""
1217- name = str (item [1 ])
1218- else :
1219- student_id = ""
1220- name = str (item )
1221-
1222- from app .common .display .result_display import (
1223- STUDENT_ID_FORMAT ,
1224- NAME_SPACING ,
1225- )
1226-
1227- student_id_str = (
1228- STUDENT_ID_FORMAT .format (num = student_id ) if student_id else ""
1229- )
1230-
1231- formatted_name = (
1232- f"{ name [0 ]} { NAME_SPACING } { name [1 ]} " if len (name ) == 2 else name
1233- )
1234-
1235- if display_format == 1 :
1236- text = formatted_name
1237- elif display_format == 2 :
1238- text = student_id_str if student_id_str else formatted_name
1239- else :
1240- if draw_count == 1 :
1241- text = (
1242- f"{ student_id_str } \n { formatted_name } "
1243- if student_id_str
1244- else formatted_name
1245- )
1246- else :
1247- text = (
1248- f"{ student_id_str } { formatted_name } "
1249- if student_id_str
1250- else formatted_name
1251- )
1252- new_texts .append (text )
1253-
1254- if animation_color == 1 :
1255- color = ResultDisplayUtils ._generate_vibrant_color ()
1256- elif animation_color == 2 :
1257- fixed_color = render_settings .get ("animation_fixed_color" , "#000000" )
1258- color = fixed_color
1259- else :
1260- from app .tools .personalised import is_dark_theme
1261- from qfluentwidgets import qconfig
1262-
1263- color = "#ffffff" if is_dark_theme (qconfig ) else "#000000"
1264- new_colors .append (color )
1265-
1266- updated = ResultDisplayUtils .update_animation_labels_fast (
1267- cached_widgets , new_texts , new_colors , font_size , "lottery_settings"
1268- )
1269- if updated :
1270- return
1271-
12721203 student_labels = ResultDisplayUtils .create_student_label (
12731204 class_name = pool_name ,
12741205 selected_students = selected_students ,
@@ -1285,18 +1216,19 @@ def display_result_animated(
12851216 settings_group = "lottery_settings" ,
12861217 show_tags = bool (render_settings .get ("show_tags" )),
12871218 )
1288-
1289- if cached_widgets and cached_count == current_count :
1219+ cached_widgets = ResultDisplayUtils . collect_grid_widgets ( widget . result_grid )
1220+ if cached_widgets and len ( cached_widgets ) == len ( student_labels ) :
12901221 updated = ResultDisplayUtils .update_grid_labels (
12911222 widget .result_grid , student_labels , cached_widgets
12921223 )
12931224 if updated :
12941225 ResultDisplayUtils .dispose_widgets (student_labels )
1295- widget ._cached_animation_widgets = cached_widgets
1296- return
1297-
1298- ResultDisplayUtils .display_results_in_grid (widget .result_grid , student_labels )
1299- widget ._cached_animation_widgets = student_labels
1226+ else :
1227+ ResultDisplayUtils .display_results_in_grid (
1228+ widget .result_grid , student_labels
1229+ )
1230+ else :
1231+ ResultDisplayUtils .display_results_in_grid (widget .result_grid , student_labels )
13001232
13011233 settings = widget .manager .get_notification_settings (pool_name , refresh = False )
13021234 if settings is not None :
0 commit comments