panic_button
panic_button
¶
Panic button widget with arm-then-fire safety mechanism.
The button sits in the main layout but is excluded from the Tab focus chain
(can_focus = False). A single click arms it (visual change + 5-second
auto-disarm timer); a second click fires the emergency panic sequence.
PanicButton(**kwargs)
¶
Bases: Static
Clickable emergency button with arm-then-fire two-phase activation.
Initialize in idle (disarmed) state.
Source code in src/terok/tui/widgets/panic_button.py
can_focus = False
class-attribute
instance-attribute
¶
DEFAULT_CSS = '\n PanicButton {\n height: 3;\n margin-top: 1;\n content-align: center middle;\n text-align: center;\n background: $error;\n color: white;\n text-style: bold;\n }\n\n PanicButton.armed {\n background: darkred;\n text-style: bold reverse;\n }\n '
class-attribute
instance-attribute
¶
Fired
¶
Bases: Message
Posted when the arm-then-fire sequence completes.
on_mount()
¶
arm()
¶
Transition from idle to armed state with auto-disarm timer.
Source code in src/terok/tui/widgets/panic_button.py
disarm()
¶
Return to idle state, cancelling any pending timer.