cadrumo.entrypoints.tui.ledger.import_flow module

Import flow: choose a file or folder, preview what it holds, then confirm the write.

IMPORT_PROVIDERS: Final[tuple[LedgerProviderID, ...]]

The readers an operator may pick for a bank statement, automatic first.

import_outcome_lines(outcome)[source]

Describe a preview or an applied import, keeping unmeasured counts unmeasured.

Return type:

tuple[str, ...]

Parameters:

outcome (LedgerImportOutcomeV1)

class LedgerImportScreen(controller)[source]

Bases: LedgerConfirmationFlowScreen

Read an operator-chosen source, show what it would write, and write it on confirmation.

Parameters:

controller (LedgerWorkspaceController)

FLOW_NAME: ClassVar[str]
CSS: ClassVar[str]

Inline CSS, useful for quick scripts. Rules here take priority over CSS_PATH.

Note

This CSS applies to the whole app.

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]

Show only the controls that apply to the default source kind.

Return type:

None

property source_kind: LedgerImportSourceKind

The source kind currently selected.

on_select_changed(event)[source]

Swap the provider and country controls with the source kind.

Return type:

None

Parameters:

event (Changed)

on_directory_tree_file_selected(event)[source]

Take a browsed file as the source.

Return type:

None

Parameters:

event (FileSelected)

on_directory_tree_directory_selected(event)[source]

Take a browsed folder as the source; every importable file in it is read.

Return type:

None

Parameters:

event (DirectorySelected)

on_button_pressed(event)[source]

Route each control through the flow’s guarded transitions.

Return type:

None

Parameters:

event (Pressed)

can_focus: bool

Widget may receive focus.

can_focus_children: bool

Widget’s children may receive focus.