hledger-ui
Safe HaskellNone
LanguageGHC2021

Hledger.UI.UIUtils

Description

Rendering & misc. helpers.

Synopsis

Documentation

borderDepthStr :: Maybe Int -> Widget Name Source #

borderKeysStr :: [(String, String)] -> Widget Name Source #

borderKeysStr' :: [(String, Widget Name)] -> Widget Name Source #

borderPeriodStr :: String -> Period -> Widget Name Source #

borderQueryStr :: String -> Widget Name Source #

clickFocusStep :: UTCTime -> BrickEvent n e -> ClickFocus -> (ClickFocus, Bool) Source #

Recognise the click that brings a background terminal window forward, so that it only activates the window, without also selecting or entering something. With focus reporting on, such a click arrives as a focus gain followed, a moment later, by a left button press; we ignore that press, any repeats of it, and its release. A click made more than activatingClickTime after the window gained focus (eg after switching to it with the keyboard) is handled as usual. Focus events themselves are not passed on. Given the current time, an event and the current state, returns the new state and whether to ignore the event.

defaultLayout :: Widget Name -> Widget Name -> Widget Name -> Widget Name Source #

Wrap a widget in the default hledger-ui screen layout.

helpDialog :: Widget Name Source #

Draw the help dialog, called when help mode is active.

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

Event handler used when help mode is active. May invoke $PAGER, less, man or info, which is likely to fail on MS Windows, TODO.

minibuffer :: Text -> Editor String Name -> Widget Name Source #

Draw the minibuffer with the given label.

moveUpEvents :: [Event] Source #

normaliseMovementKeys :: Event -> Event Source #

renderToggle :: Bool -> String -> String -> Widget Name Source #

Show both states of a toggle ("aaa/bbb"), highlighting the active one.

renderToggle1 :: Bool -> String -> Widget Name Source #

Show a toggle's label, highlighted (bold) when the toggle is active.

replaceHiddenAccountsNameWith :: AccountName -> AccountName -> AccountName Source #

Replace the special account names "*" and "..." (from balance reports with depth limit 0) to something clearer.

scrollSelectionToMiddle :: Int -> List Name item -> EventM Name UIState () Source #

Scroll a list's viewport so that the selected item is centered in the middle of the display area. When the selected item is near the end of the list, the viewport is capped so that no blank padding is visible below the last real item, and the last real items stay bottom-aligned (so recentering a near-the-end selection doesn't push those items off screen). numitems is the number of non-blank items in the list.

put' :: UIState -> EventM Name UIState () Source #

modify' :: (UIState -> UIState) -> EventM Name UIState () Source #

suspend :: Ord a => s -> EventM a s () Source #

On posix platforms, suspend the program using the STOP signal, like control-z in bash, returning to the original shell prompt, and when resumed, continue where we left off. On windows, does nothing.

redraw :: EventM a s () Source #

Tell vty to redraw the whole screen.

uiInstallWarningCollector :: IO () Source #

Make warnIO collect warnings in uiWarningsRef instead of printing them to stderr. Call once, before starting the brick app.

uiTakeWarnings :: IO [String] Source #

Take any warnings collected since last time, clearing the collection.

journalIsFromStdin :: Journal -> Bool Source #

Was this journal's main file read from standard input ? If so it can't be re-read, edited, or watched for changes.

reportSpecAddQuery :: Query -> ReportSpec -> ReportSpec Source #

Restrict the ReportSpec's query by adding the given additional query.

reportSpecSetFutureAndForecast :: Maybe DateSpan -> ReportSpec -> ReportSpec Source #

Update the ReportSpec's query to exclude future transactions (later than its "today" date) and forecast transactions (generated by --forecast), if the given forecast DateSpan is Nothing, and include them otherwise.

listScrollPushingSelection :: Name -> Int -> Int -> EventM Name (List Name item) () Source #

dbgui :: String -> a -> a Source #

A debug logging helper for hledger-ui code: at any debug level >= 1, logs the string to hledger-ui.log before returning the second argument. Uses unsafePerformIO.

dbguiIO :: String -> IO () Source #

Like dbgui, but convenient to use in IO.

dbguiEv :: String -> EventM Name s () Source #

Like dbgui, but convenient to use in EventM handlers.

dbguiScreensEv :: String -> (Screen -> String) -> UIState -> EventM Name UIState () Source #

Like dbguiEv, but log a compact view of the current screen stack. See showScreenStack. To just log the stack: dbguiScreensEv "" showScreenId ui

mapScreens :: (Screen -> a) -> UIState -> [a] Source #

Run a function on each screen in a UIState's screen "stack", from topmost screen down to currently-viewed screen.

uiNumBlankItems :: Int Source #

How many blank items to add to lists to fill the full window height.

showScreenStack :: String -> (Screen -> String) -> UIState -> String Source #

sendVtyEvents :: [Event] -> EventM n s () Source #