hledger-ui
Safe HaskellNone
LanguageGHC2021

Hledger.UI.ErrorScreen

Synopsis

Documentation

esNew :: String -> Screen Source #

Construct an error screen. Screen-specific arguments: the error message to show.

esUpdate :: ErrorScreenState -> ErrorScreenState Source #

Update an error screen. Currently a no-op since error screen depends only on its screen-specific state.

esDraw :: UIState -> [Widget Name] Source #

esHandle :: BrickEvent Name AppEvent -> EventM Name UIState () Source #

uiReload :: CliOpts -> Day -> UIState -> EventM Name UIState UIState Source #

Reload the journal from its input files, then update the ui app state accordingly. This means regenerate the entire screen stack from top level down to the current screen, using the provided today-date. As a convenience (usually), if journal reloading fails, this enters the error screen, or if already there, updates its message.

The provided cli options can influence reloading; then if reloading succeeds they are saved in the ui state, otherwise the UIState keeps its old options. (XXX needed for.. ?)

Like at hledger-ui startup, --forecast is always enabled. A forecast period specified in the provided opts, or at startup, is preserved.

uiReloadIfFileChanged :: CliOpts -> Day -> Journal -> UIState -> IO UIState Source #

Like uiReload, except it skips re-reading the journal if its file(s) have not changed since it was last loaded. The up app state is always updated, since the options or today-date may have changed. Also, this one runs in IO, suitable for suspendAndResume.

uiToggleBalanceAssertions :: Day -> UIState -> EventM Name UIState () Source #

Toggle ignoring balance assertions (when user presses I), and if no longer ignoring, recheck them. Normally the recheck is done quickly on the in-memory journal. But if --pivot is active, a full journal reload is done instead (because we can't check balance assertions after pivoting has occurred). In that case, this operation could be slower and could reveal other data changes (not just balance assertion failures).