cadrumo.entrypoints.tui.ledger.workspace_presentation module¶
Reusable Ledger workspace layout, focus, and confirmation mechanics.
- ALLOWED_FLOW_TRANSITIONS: dict[LedgerFlowState, frozenset[LedgerFlowState]]¶
The legal moves of a confirmed Ledger flow, as a state a caller can read.
A state absent from this mapping is terminal and absorbing:
SUCCEEDED,FAILEDandCANCELLEDadmit no move at all, so a screen cannot be driven back into an editable state after its command has settled.Two absences are the safety of the machine rather than gaps in it.
EDITINGcannot reachSUBMITTING, so nothing is written without passing the confirmation step; andSUBMITTINGcannot reachCANCELLED, so a write already in flight cannot be abandoned — which is whatLedgerConfirmationFlowScreen.action_back()refuses out loud.Held here rather than rebuilt inside the transition method so the machine can be read and tested as the specification it is.
- door_refusal_text(error)[source]¶
Render an application door’s typed refusal in the operator’s language.
- Return type:
- Parameters:
error (CadrumoError | ValidationError)
- ledger_workspace_page()[source]¶
Compose the one scroll owner and canonical workspace navigation table.
- Return type:
- restore_transaction_focus(*, navigation, table, transaction_id)[source]¶
Focus a transaction by semantic identity or return focus to navigation.
- class LedgerConfirmationFlowScreen(controller, *, id)[source]¶
Bases:
LedgerWorkspaceScreenShared presentation state machine for confirmed, one-shot Ledger flows.
- Parameters:
controller (LedgerWorkspaceController)
id (str)
- FLOW_NAME: ClassVar[str]¶
- property flow_state: LedgerFlowState¶
Expose the guarded interaction state without a public setter.
- refresh_after_write(then)[source]¶
Continue with
thenover a re-read workspace once this flow has written.Only a settled write changes anything, so any other state continues at once over the snapshot already shown.
- action_back()[source]¶
Refuse abandonment after submission; otherwise unwind confirmation.
- Return type:
- can_focus: bool¶
Widget may receive focus.
- can_focus_children: bool¶
Widget’s children may receive focus.