Skip to content

ScripTree v0.1.6 — RadioWidget

Choose a tag to compare

@KenM76 KenM76 released this 25 Apr 13:14
· 230 commits to main since this release

ScripTree v0.1.6 — RadioWidget

Third of four small releases. v0.1.4 added env vars, v0.1.5 added the per-param no_split opt-out; this one ships a real radio-button widget for enum params.

What's new

Widget.ENUM_RADIO (already in the schema since day one) is now backed by a real RadioWidget instead of falling back to a dropdown. Use it for enum params with a small set of options where visibility matters more than compactness:

{
  "id": "mode",
  "type": "enum",
  "widget": "enum_radio",
  "default": "fast",
  "choices": ["fast", "thorough", "exhaustive"],
  "choice_labels": ["Fast (5s)", "Thorough (30s)", "Exhaustive (5m)"]
}

UI: a vertical stack of mutually-exclusive radio buttons, same selection semantics as a dropdown — get_value() returns the raw value (e.g. "fast"), labels are cosmetic.

"(none)" option

A choice with an empty value ("") plus a friendly label gives you a "no-op" option that emits nothing:

{
  "id": "verbosity",
  "type": "enum",
  "widget": "enum_radio",
  "default": "",
  "choices": ["", "-v", "-vv", "-vvv"],
  "choice_labels": ["(none)", "Quiet", "Verbose", "Debug"]
}

Selecting (none) makes {verbosity} substitute as "", which drops the whole template token (or its enclosing token group) via the existing empty-substitution rule. Argv with template = ["{verbosity}", "file.txt"]:

Selection argv
(none) ["tool", "file.txt"]
Quiet ["tool", "-v", "file.txt"]
Debug ["tool", "-vvv", "file.txt"]

No new mechanism — the drop-on-empty rule has always applied to substitutions; it just composes nicely with radio buttons.

Implementation

  • New RadioWidget(ParamWidget) in scriptree/ui/widgets/param_widgets.py. Uses QButtonGroup with setExclusive(True) for mutual exclusion.
  • Each QRadioButton stores its raw value as a Qt user property; visible label comes from param.label_for_choice(value).
  • set_value(None) clears all selections (flips exclusive off → unchecks all → flips back on — Qt requires this dance).
  • Dispatch in build_widget_for() updated from the placeholder WidgetKind.ENUM_RADIO: DropdownWidget to the real RadioWidget.

Documentation

help/LLM/param_types_widgets.md gains an enum_radio subsection with the (none) example and the argv table.

Download

ScripTree-v0.1.6-windows-x64.zip — portable folder with vendored PySide6 pre-trimmed. Extract and double-click run_scriptree.bat. Requires Python 3.11+ on the host.

Compare v0.1.5...v0.1.6