Skip to content

widgets/sidebar: extract Toad's Qt sidebar primitives - #33

Merged
trissim merged 1 commit into
mainfrom
feat/sidebar-widgets
Nov 17, 2026
Merged

trissim merged 1 commit into
mainfrom
feat/sidebar-widgets

Conversation

@trissim

@trissim trissim commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Toad was hand-rolling QtPlacementControl, SidebarPane and SidebarToggle in src/toad/qt/placement.py. They're Qt glue over formbridge-shaped contracts — move them into formbridge.widgets.sidebar where any PySide6 app can use them.

What changed

  • src/formbridge/widgets/sidebar.py — new module with the three widgets, plus runtime-checkable Placement, PlacementAction, PlacementLayout, SidebarControlsOwner, PlacementEdge protocols that the Toad types already satisfy.
  • SidebarPane now arranges controls edge-aware: leading edges (left, top) put controls on the FAR end of the pane (interior-facing); trailing edges (right, bottom) put them on the NEAR end. Horizontal edge → control row; vertical edge → control column. Fixes the "controls at the top of the pane" bug once Toad passes a placement through to it.
  • src/formbridge/widgets/__init__.py — one-line docstring, no imports.
  • pyproject.toml — adds [project.optional-dependencies] qt with PySide6 + pyqt-reactive. Headless consumers never import the widgets module.

Follow-up

Toad's src/toad/qt/placement.py will import from here and the toggle-bar edge honoring + float repaint fix land in that repo's PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_016gZLdupVQyBzHTmHBC9Cyn

QtPlacementControl, SidebarPane and SidebarToggle were duplicated inside Toad's
qt/ and are the kind of Qt glue formbridge is for — a toolkit-concrete layer
that uses PySide6 directly but is addressed through the formbridge protocols.

The pane now arranges controls edge-aware: on a leading edge (left, top) the
controls dock at the far end of the pane (right / bottom), on a trailing edge
(right, bottom) they dock at the near end, so the controls are always on the
interior-facing side regardless of which edge the pane is on. Top/bottom edges
run the control band as a row; left/right as a column. Floating keeps the row
layout, as a short horizontal overlay.

Widgets live under formbridge.widgets, opt-in (extras: `qt`). Headless
consumers never import PySide6 because they never import this subpackage.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gZLdupVQyBzHTmHBC9Cyn
@trissim
trissim merged commit d46c8af into main Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant