spacr.qt.widgets.collapsible_section

A titled section that folds away in tabs containing several panels.

Resizable sections let users give the active panel more room, while folding inactive sections prevents controls from competing for the same vertical space.

FOLDED, NOT REMOVED, and the header stays put: a section that disappeared would take with it the only clue that the feature exists, which is the same rule the greyed-out picture settings follow.

Classes

CollapsibleSection

content under a header that folds it away.

Module Contents

class spacr.qt.widgets.collapsible_section.CollapsibleSection(title: str, content: PySide6.QtWidgets.QWidget, *, expanded: bool = True, parent=None)[source]

Bases: PySide6.QtWidgets.QWidget

content under a header that folds it away.

Parameters:
  • title – what the header says. Kept short – it is a name, not a description; the panel inside says what it does.

  • content – the widget to fold. Reparented here.

  • expanded – whether it starts open.

  • parent – parent widget; ownership only.

Build one foldable section around a content widget.

The header carries its own style rule: a QToolButton without one paints the palette’s button colour as an opaque block, which was the “black categories”. Its resting text is the theme’s foreground rather than a dimmed one – on a panel where at most one section is open, the folded headings are what the reader is scanning, and dimming them says “secondary” about the only thing on screen that is not.

Parameters:
  • title – the section’s heading.

  • content – the widget it folds away.

  • expanded – open it immediately.

  • parent – parent widget, or None.

content() → PySide6.QtWidgets.QWidget[source]

The widget this section wraps.

Returns:

the body widget.

is_expanded() → bool[source]

Whether the body is showing.

READ OFF THE HEADER, not a flag beside it. The header button IS the state, so a cached copy could disagree with what the user sees.

Returns:

True when open.

set_expanded(expanded: bool) → None[source]

Open or close the section.

Parameters:

expanded – True to show the body.

set_open_minimum(height: int) → None[source]

How short the section may be dragged while it is open.

Parameters:

height – the smallest body height, in pixels, the open section may be dragged to; converted to int and floored at 0. The header’s folded height is added on top.

title() → str[source]

The section’s caption, as written rather than as displayed.

The header uppercases it and may append a maturity badge; this is the string a catalog or a settings file is keyed on.

Returns:

the title.