cadrumo.entrypoints.tui.components.dialogs module

Reusable confirmation dialog for irreversible TUI actions.

class ConfirmScreen(*, title, message, confirm_label, cancel_label)[source]

Bases: ModalScreen[bool]

Ask before an irreversible action and default to declining it.

Parameters:
  • title (str)

  • message (str)

  • confirm_label (str)

  • cancel_label (str)

DEFAULT_CSS: ClassVar[str]

Default TCSS.

BINDINGS: ClassVar

A list of key bindings.

compose()[source]

Called by Textual to create child widgets.

This method is called when a widget is mounted or by setting recompose=True when calling [refresh()][textual.widget.Widget.refresh].

Note that you don’t typically need to explicitly call this method.

Return type:

Iterable[Widget]

Example

def compose(self) -> ComposeResult:
    yield Header()
    yield Label("Press the button below:")
    yield Button()
    yield Footer()
on_mount()[source]

Focus the safe declining action first.

Return type:

None

on_button_pressed(event)[source]

Dismiss with the selected confirmation state.

Return type:

None

Parameters:

event (Pressed)

action_decline()[source]

Dismiss without approving the action.

Return type:

None

action_confirm()[source]

Dismiss with explicit approval.

Return type:

None

can_focus: bool

Widget may receive focus.

can_focus_children: bool

Widget’s children may receive focus.