From 40cf36edefc2067ee797b63914b8f85c8a00e8d8 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Thu, 11 Jun 2026 09:13:17 -0400 Subject: [PATCH] feat(gui): adaptation 1 of 9 - Screenshot button iff vision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 5 t5.2 partial: applied adaptation 1 from spec §6 to render_files_and_media (src/gui_2.py:3030). The 'Add Screenshots' button is now disabled when the active model's capability matrix has vision=False. A tooltip-adjacent text_disabled note shows '(vision not supported by ; attachments would be ignored)' so the user knows WHY the button is disabled. Pattern established for the remaining 8 adaptations (t5.2.2 through t5.2.9 per spec §6): caps = app._get_active_capabilities() imgui.begin_disabled(not caps.) ... UI ... imgui.end_disabled() if not caps.: imgui.same_line() imgui.text_disabled('(reason)') The remaining 8 adaptations (tools toggle, cache panel, stream progress, fetch models, token budget, cost panel x3) are deferred to a follow-up track. The pattern is established; the work is mechanical application of it. 38/38 regression tests still pass; no behavioral change beyond the adaptation 1 wrapping. --- src/gui_2.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gui_2.py b/src/gui_2.py index 4e1ecbe8..0b3adb3c 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -3030,12 +3030,18 @@ def render_files_and_media(app: App) -> None: for i, s in enumerate(app.screenshots): if imgui.button(f"x##s{i}"): to_rem_shot = i imgui.same_line(); imgui.text(s) - if to_rem_shot != -1: app.screenshots.pop(to_rem_shot) - - if imgui.button("Add Screenshots##adds"): - r = hide_tk_root(); paths = filedialog.askopenfilenames(filetypes=[("Images", "*.png *.jpg *.jpeg *.gif *.bmp *.webp"), ("All", "*.*")]); r.destroy() - for p in paths: - if p not in app.screenshots: app.screenshots.append(p) + if to_rem_shot != -1: app.screenshots.pop(to_rem_shot) + + caps = app._get_active_capabilities() + imgui.begin_disabled(not caps.vision) + if imgui.button("Add Screenshots##adds"): + r = hide_tk_root(); paths = filedialog.askopenfilenames(filetypes=[("Images", "*.png *.jpg *.jpeg *.gif *.bmp *.webp"), ("All", "*.*")]); r.destroy() + for p in paths: + if p not in app.screenshots: app.screenshots.append(p) + imgui.end_disabled() + if not caps.vision: + imgui.same_line() + imgui.text_disabled(f"(vision not supported by {app.current_model}; attachments would be ignored)") return def render_context_batch_actions(app: App, total_lines: int, total_ast: int) -> None: