From b405427a6ba3559ee969373aa6725a12ac75448b Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sat, 4 Apr 2026 14:41:49 +0200 Subject: [PATCH] feat: dim frame thumbnail when its switch is toggled off Thumbnail opacity is 1.0 when the frame switch is on, 0.25 when off. Initial state reflects the current logic index bit, and updates live on toggle without requiring a page refresh. Co-Authored-By: Claude Sonnet 4.6 --- tab_batch_ng.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tab_batch_ng.py b/tab_batch_ng.py index 112deae..71f512d 100644 --- a/tab_batch_ng.py +++ b/tab_batch_ng.py @@ -566,9 +566,11 @@ def _render_sequence_card(i, seq, batch_list, data, file_path, state, (2, 'End Frame', 'end frame path', 'end frame high strength', 'end frame low strength'), ]: ui.label(img_label).classes('text-caption text-weight-bold q-mt-sm') + is_on = bool((logic_val >> bit) & 1) with ui.row().classes('w-full items-center no-wrap q-mt-xs'): inp = dict_input(ui.input, 'Path', seq, img_key).classes( 'col').props('outlined dense input-style="text-align: right"') + thumb = None img_path = Path(seq.get(img_key, '')) if seq.get(img_key) else None if (img_path and img_path.exists() and img_path.suffix.lower() in IMAGE_EXTENSIONS): @@ -576,13 +578,17 @@ def _render_sequence_card(i, seq, batch_list, data, file_path, state, with ui.dialog() as img_dlg, ui.card().style('max-width:90vw; padding:0'): ui.html(f'') - ui.html( + thumb = ui.html( f'' + f'border-radius:4px;cursor:pointer;flex-shrink:0;' + f'opacity:{"1.0" if is_on else "0.25"}">' ).on('click', img_dlg.open) - sw = ui.switch(value=bool((logic_val >> bit) & 1)) + sw = ui.switch(value=is_on) frame_switches.append(sw) + if thumb is not None: + sw.on('update:model-value', + lambda e, t=thumb: t.style(f'opacity: {"1.0" if e.args else "0.25"}')) with ui.row().classes('w-full no-wrap q-mt-xs q-gutter-xs'): dict_number('High', seq, hi_key, default=1.0, step=0.05, format='%.2f').classes('col').props('outlined dense')