cadrumo.entrypoints.tui.secret.credentials module¶
The shared credential-attempt host and password-assessment presentation.
CredentialScreen is the base every secret-entry surface builds on: it
owns the bounded, thread-backed attempt lifecycle (start once, settle back
on the UI task, refuse or leave) so
LoginScreen and
RegistrationScreen
differ only in their form and their injected door, never in how an attempt
is run or reported.
It is a screen rather than an application so a root shell can navigate to it: Textual does not nest applications, so an entry surface expressed as an application can only ever be the whole process. The outcome it used to return by exiting is now returned by dismissing, which is the same contract against a host that can be either the root shell or the standalone runner below.
The assessment helpers below project a canonical
ProfilePasswordAssessment into presentation
copy and CSS class – the strength banding policy itself stays with
assess_profile_password(), which callers
inject rather than import.
- class CredentialAttempt(*args, **kwargs)[source]¶
-
The secret-free result shape returned by an injected credential door.
- class CredentialScreen[source]¶
Bases:
TypedAppAccess,Screen[OutcomeT|None],GenericHost one bounded, thread-backed credential attempt at a time.
- BINDINGS: ClassVar¶
A list of key bindings.
- STATUS_ID: ClassVar[str]¶
- ATTEMPT_NAME: ClassVar[str]¶
- describe_appearance_key()[source]¶
Name the appearance key in the footer, in this screen’s language.
Bound here so a credential screen offers it before any workbench exists, and described at render time for the reason the workbench keys are: a class body resolves its text once, at import. Called again by a screen that changes its own language.
- Return type:
- credential_panel(*, panel_id)[source]¶
Compose the shared scrollable column that contains one credential form.
The caller owns its banner, status bar, fields, actions, and footer. This context manager owns only the stable nesting that makes each credential journey scroll and carry the common panel styling.
- start_attempt(work)[source]¶
Run
workoff the event loop as this screen’s sole attempt.- Return type:
None
- Parameters:
work (Callable[[], CredentialAttempt[OutcomeT]])
- on_worker_state_changed(event)[source]¶
Settle the sole attempt back on Textual’s UI task.
- Return type:
- Parameters:
event (StateChanged)
- resolve_attempt_refusal(attempt)[source]¶
Render one door refusal at this screen’s presentation boundary.
- Return type:
str | None
- Parameters:
attempt (CredentialAttempt[OutcomeT])
- progress_message()[source]¶
Operator-facing description of the subclass’s in-flight attempt.
- Return type:
- leave(outcome)[source]¶
Close the screen and return its optional outcome to its host.
- Return type:
None
- Parameters:
outcome (OutcomeT | None)
- action_abandon()[source]¶
Leave without a result unless storage work is still in flight.
- Return type:
- can_focus: bool¶
Widget may receive focus.
- can_focus_children: bool¶
Widget’s children may receive focus.
- run_credential_screen(screen)[source]¶
Run one credential screen standalone and return its optional outcome.
- Return type:
- Parameters:
screen (CredentialScreen)
- assessment_refusal(assessment)[source]¶
Project a canonical assessment through the application facade.
- Return type:
- Parameters:
assessment (ProfilePasswordAssessment)
- assessment_copy(assessment, *, locale=None)[source]¶
Resolve localized validation or advisory copy for one assessment.
- Return type:
- Parameters:
assessment (ProfilePasswordAssessment)
locale (str | None)
- assessment_css_class(assessment)[source]¶
Return the presentation class for a secret-free assessment.
- Return type:
- Parameters:
assessment (ProfilePasswordAssessment)