mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 11:52:43 +03:00
ui: simplify & format screen titles
This commit is contained in:
parent
b38db8610f
commit
e5f00b3e05
@ -58,19 +58,19 @@ initAccountsScreen _ _ _ = error "init function called with wrong screen type, s
|
||||
drawAccountsScreen :: AppState -> [Widget]
|
||||
drawAccountsScreen st@AppState{aopts=uopts, ajournal=j, aScreen=AccountsScreen{asState=is}} = [ui]
|
||||
where
|
||||
label = str "Accounts in "
|
||||
<+> withAttr ("border" <> "bold") files
|
||||
label = files
|
||||
<+> str " accounts"
|
||||
<+> borderQuery querystr
|
||||
<+> str " ("
|
||||
<+> cur
|
||||
<+> str " of "
|
||||
<+> total
|
||||
<+> str ")"
|
||||
files = str $ case journalFilePaths j of
|
||||
[] -> ""
|
||||
[f] -> takeFileName f
|
||||
[f,_] -> takeFileName f ++ " (& 1 included file)"
|
||||
f:fs -> takeFileName f ++ " (& " ++ show (length fs) ++ " included files)"
|
||||
files = case journalFilePaths j of
|
||||
[] -> str ""
|
||||
[f] -> withAttr ("border" <> "bold") $ str $ takeFileName f
|
||||
[f,_] -> (withAttr ("border" <> "bold") $ str $ takeFileName f) <+> str " (& 1 included file)"
|
||||
f:fs -> (withAttr ("border" <> "bold") $ str $ takeFileName f) <+> str (" (& " ++ show (length fs) ++ " included files)")
|
||||
querystr = query_ $ reportopts_ $ cliopts_ uopts
|
||||
cur = str (case is^.listSelectedL of
|
||||
Nothing -> "-"
|
||||
|
@ -48,13 +48,19 @@ initRegisterScreen2 d args st@AppState{aopts=opts, ajournal=j, aScreen=s@Registe
|
||||
balancetype_=HistoricalBalance
|
||||
}
|
||||
-- XXX temp
|
||||
thisacctq = Acct $ accountNameToAccountRegex acct -- XXX why is this excluding subs: accountNameToAccountRegex curacct
|
||||
thisacctq = Acct $ accountNameToAccountRegex acct -- includes subs
|
||||
q = queryFromOpts d ropts
|
||||
-- query_="cur:\\$"} -- XXX limit to one commodity to ensure one-line items
|
||||
--{query_=unwords' $ locArgs l}
|
||||
|
||||
-- run a transactions report, most recent last
|
||||
(_label,items') = accountTransactionsReport ropts j q thisacctq
|
||||
q' =
|
||||
-- ltrace "q"
|
||||
q
|
||||
thisacctq' =
|
||||
-- ltrace "thisacctq"
|
||||
thisacctq
|
||||
(_label,items') = accountTransactionsReport ropts j q' thisacctq'
|
||||
items = reverse items'
|
||||
|
||||
-- pre-render all items; these will be the List elements. This helps calculate column widths.
|
||||
@ -82,8 +88,8 @@ drawRegisterScreen2 :: AppState -> [Widget]
|
||||
drawRegisterScreen2 AppState{aopts=_uopts@UIOpts{cliopts_=_copts@CliOpts{reportopts_=_ropts@ReportOpts{query_=querystr}}},
|
||||
aargs=_args, aScreen=RegisterScreen2{rs2State=l,rs2Acct=acct}} = [ui]
|
||||
where
|
||||
label = str "Transactions in "
|
||||
<+> withAttr ("border" <> "bold") (str acct)
|
||||
label = withAttr ("border" <> "bold") (str acct)
|
||||
<+> str " transactions"
|
||||
<+> borderQuery querystr
|
||||
-- <+> str " and subs"
|
||||
<+> str " ("
|
||||
|
@ -125,4 +125,4 @@ withBorderAttr attr = updateAttrMap (applyAttrMappings [(borderAttr, attr)])
|
||||
|
||||
borderQuery :: String -> Widget
|
||||
borderQuery "" = str ""
|
||||
borderQuery qry = str " filtered by: " <+> withAttr (borderAttr <> "query") (str qry)
|
||||
borderQuery qry = str " matching " <+> withAttr (borderAttr <> "query") (str qry)
|
||||
|
Loading…
Reference in New Issue
Block a user