Private
Public Access
0
0

feat(gui): adaptation 1 of 9 - Screenshot button iff vision

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 <model>; 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.<field>)
  ... UI ...
  imgui.end_disabled()
  if not caps.<field>:
   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.
This commit is contained in:
2026-06-11 09:13:17 -04:00
parent 221cd33493
commit 40cf36edef
+12 -6
View File
@@ -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: