| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Hledger.UI.UIState
Description
UIState operations.
Synopsis
- uiState :: UIOpts -> Journal -> [Screen] -> Screen -> UIState
- uiShowStatus :: CliOpts -> [Status] -> [String]
- setFilter :: String -> UIState -> Either String UIState
- setMode :: Mode -> UIState -> UIState
- setReportPeriod :: Period -> UIState -> UIState
- showMinibuffer :: Text -> Maybe String -> UIState -> UIState
- closeMinibuffer :: UIState -> UIState
- toggleCleared :: UIState -> UIState
- toggleConversionOp :: UIState -> UIState
- toggleIgnoreBalanceAssertions :: UIState -> UIState
- toggleEmpty :: UIState -> UIState
- toggleForecast :: Day -> UIState -> UIState
- toggleHistorical :: UIState -> UIState
- togglePending :: UIState -> UIState
- toggleUnmarked :: UIState -> UIState
- toggleReal :: UIState -> UIState
- toggleTree :: UIState -> UIState
- setTree :: UIState -> UIState
- setList :: UIState -> UIState
- toggleValue :: UIState -> UIState
- reportPeriod :: UIState -> Period
- shrinkReportPeriod :: Day -> UIState -> UIState
- growReportPeriod :: Day -> UIState -> UIState
- nextReportPeriod :: DateSpan -> UIState -> UIState
- previousReportPeriod :: DateSpan -> UIState -> UIState
- resetReportPeriod :: UIState -> UIState
- moveReportPeriodToDate :: Day -> UIState -> UIState
- getDepth :: UIState -> Maybe Int
- setDepth :: Maybe Int -> UIState -> UIState
- decDepth :: UIState -> UIState
- incDepth :: UIState -> UIState
- resetDepth :: UIState -> UIState
- popScreen :: UIState -> UIState
- pushScreen :: Screen -> UIState -> UIState
- enableForecast :: UIOpts -> CliOpts -> CliOpts
- resetFilter :: UIState -> UIState
- resetScreens :: Day -> UIState -> UIState
- regenerateScreens :: Journal -> Day -> UIState -> UIState
Documentation
uiState :: UIOpts -> Journal -> [Screen] -> Screen -> UIState Source #
Make an initial UI state with the given options, journal, parent screen stack if any, and starting screen.
uiShowStatus :: CliOpts -> [Status] -> [String] Source #
Generate zero or more indicators of the status filters currently active, which will be shown comma-separated as part of the indicators list.
setFilter :: String -> UIState -> Either String UIState Source #
Apply a new filter query, or return the failing query.
setReportPeriod :: Period -> UIState -> UIState Source #
Set the report period.
showMinibuffer :: Text -> Maybe String -> UIState -> UIState Source #
Open the minibuffer, setting its content to the current query with the cursor at the end.
closeMinibuffer :: UIState -> UIState Source #
Close the minibuffer, discarding any edit in progress.
toggleCleared :: UIState -> UIState Source #
Toggle between showing only cleared items or all items.
toggleConversionOp :: UIState -> UIState Source #
Toggle between showing the primary amounts or costs.
toggleIgnoreBalanceAssertions :: UIState -> UIState Source #
Toggle the ignoring of balance assertions.
toggleEmpty :: UIState -> UIState Source #
Toggle between showing all and showing only nonempty (more precisely, nonzero) items.
toggleForecast :: Day -> UIState -> UIState Source #
Toggle hledger-ui's "forecast/future mode". When this mode is enabled, hledger-shows regular transactions which have future dates, and "forecast" transactions generated by periodic transaction rules (which are usually but not necessarily future-dated). In normal mode, both of these are hidden.
toggleHistorical :: UIState -> UIState Source #
Toggle between historical balances and period balances.
togglePending :: UIState -> UIState Source #
Toggle between showing only pending items or all items.
toggleUnmarked :: UIState -> UIState Source #
Toggle between showing only unmarked items or all items.
toggleReal :: UIState -> UIState Source #
Toggle between showing all and showing only real (non-virtual) items.
toggleTree :: UIState -> UIState Source #
Toggle between flat and tree mode. If current mode is unspecified/default, assume it's flat.
toggleValue :: UIState -> UIState Source #
Toggle between showing primary amounts or values (using valuation specified at startup, or a default).
reportPeriod :: UIState -> Period Source #
Get the report period.
shrinkReportPeriod :: Day -> UIState -> UIState Source #
Step through smaller report periods, down to a day.
growReportPeriod :: Day -> UIState -> UIState Source #
Step through larger report periods, up to all.
nextReportPeriod :: DateSpan -> UIState -> UIState Source #
Step the report start/end dates to the next period of same duration, remaining inside the given enclosing span.
previousReportPeriod :: DateSpan -> UIState -> UIState Source #
Step the report start/end dates to the next period of same duration, remaining inside the given enclosing span.
resetReportPeriod :: UIState -> UIState Source #
Clear any report period limits.
moveReportPeriodToDate :: Day -> UIState -> UIState Source #
If a standard report period is set, step it forward/backward if needed so that it encloses the given date.
setDepth :: Maybe Int -> UIState -> UIState Source #
Set the current depth limit to the specified depth, or remove the depth limit. Also remove the depth limit if the specified depth is greater than the current maximum account depth. If the specified depth is negative, reset the depth limit to whatever was specified at uiartup.
decDepth :: UIState -> UIState Source #
Decrement the current depth limit towards 0. If there was no depth limit, set it to one less than the maximum account depth.
incDepth :: UIState -> UIState Source #
Increment the current depth limit. If this makes it equal to the the maximum account depth, remove the depth limit.
resetDepth :: UIState -> UIState Source #
enableForecast :: UIOpts -> CliOpts -> CliOpts Source #
Enable forecasting in this CliOpts. If it previously specified a forecast period, or else if the given ui startup options did, preserve that as the forecast period.
resetFilter :: UIState -> UIState Source #
Reset some filters & toggles.
resetScreens :: Day -> UIState -> UIState Source #
Reset options to their startup values, discard screen navigation history, and return to the top screen, regenerating it with the startup options and the provided reporting date.
regenerateScreens :: Journal -> Day -> UIState -> UIState Source #
Given a new journal and reporting date, save the new journal in the ui state, then regenerate the content of all screens in the stack (using the ui state's current options), preserving the screen navigation history. Note, does not save the reporting date.
XXX Currently this does not properly regenerate the transaction screen or error screen, which depend on state from their parent(s); those screens' handlers must do additional work, which is fragile.