spacr.qt.widgets.card

Card — QFrame with rounded border, optional title bar, and a body widget.

Consumers add content to card.body_layout (a QVBoxLayout).

Classes

Card

Rounded-border container with optional title/subtitle and a body area.

Module Contents

class spacr.qt.widgets.card.Card(title: str = '', subtitle: str = '', parent=None, *, foldable: bool = False, fold_key: str = '')[source]

Bases: PySide6.QtWidgets.QFrame

Rounded-border container with optional title/subtitle and a body area.

Consumers add content to body_layout.

Parameters:
  • title – optional heading rendered above the body.

  • subtitle – optional muted subheading rendered under the title.

Variables:
  • body – inner QWidget that holds the body layout.

  • body_layout – QVBoxLayout consumers add widgets to.

Initialize the card and optional persistent folding behavior.

Parameters:
  • foldable – allow the title to hide or restore the body. Disabled by default because folding is useful only when adjacent content can occupy the released space.

  • fold_key – "<module>/<panel>"; given, the fold survives a restart.

  • parent – parent widget; ownership only.

add_title_action(widget: PySide6.QtWidgets.QWidget) → None[source]

Put widget at the right-hand end of the title row.

The title row is built on first use, so a card nobody adds an action to keeps its original layout exactly.

Parameters:

widget – the control to add, e.g. a Refresh button.

follow_fold(folder) → None[source]

Let the card shrink to its heading while folder is shut.

The body is laid out with a stretch, and a layout counts that stretch even while the body is hidden, so a folded card still asked for room and shared it evenly with the stretch that locks a folded heading to the bottom of its pane (item 515): the folded Console came out half the pane tall. Folded, the body gives its stretch up; opened, it takes it back.

Parameters:

folder – the Folder that folds body.