ui: indicate when balance assertions are ignored
The indication takes up lots of space, may need refinement. It's currently not shown on the error screen.
This commit is contained in:
		
							parent
							
								
									347e9dc701
								
							
						
					
					
						commit
						19fc5b61f7
					
				| @ -100,7 +100,7 @@ asInit d reset ui@UIState{ | ||||
| asInit _ _ _ = error "init function called with wrong screen type, should not happen" | ||||
| 
 | ||||
| asDraw :: UIState -> [Widget] | ||||
| asDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}} | ||||
| asDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} | ||||
|                            ,ajournal=j | ||||
|                            ,aScreen=s@AccountsScreen{} | ||||
|                            ,aMode=mode | ||||
| @ -110,18 +110,22 @@ asDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}} | ||||
|     -- Minibuffer e -> [minibuffer e, maincontent] | ||||
|     _          -> [maincontent] | ||||
|   where | ||||
|     toplabel = files | ||||
|             <+> nonzero | ||||
|             <+> str " accounts" | ||||
|             <+> withAttr (borderAttr <> "query") (str (if flat_ ropts then " (flat)" else "")) | ||||
|             <+> borderQueryStr querystr | ||||
|             <+> togglefilters | ||||
|             <+> borderDepthStr mdepth | ||||
|             <+> str " (" | ||||
|             <+> cur | ||||
|             <+> str "/" | ||||
|             <+> total | ||||
|             <+> str ")" | ||||
|     toplabel = | ||||
|           files | ||||
|       <+> nonzero | ||||
|       <+> str " accounts" | ||||
|       <+> withAttr (borderAttr <> "query") (str (if flat_ ropts then " (flat)" else "")) | ||||
|       <+> borderQueryStr querystr | ||||
|       <+> togglefilters | ||||
|       <+> borderDepthStr mdepth | ||||
|       <+> str " (" | ||||
|       <+> cur | ||||
|       <+> str "/" | ||||
|       <+> total | ||||
|       <+> str ")" | ||||
|       <+> (if ignore_assertions_ copts | ||||
|            then withAttr (borderAttr <> "query") (str " ignoring balance assertions") | ||||
|            else str "") | ||||
|     files = case journalFilePaths j of | ||||
|                    [] -> str "" | ||||
|                    f:_ -> withAttr ("border" <> "bold") $ str $ takeFileName f | ||||
|  | ||||
| @ -9,6 +9,7 @@ module Hledger.UI.ErrorScreen | ||||
| where | ||||
| 
 | ||||
| import Brick | ||||
| -- import Brick.Widgets.Border (borderAttr) | ||||
| import Control.Monad | ||||
| import Control.Monad.IO.Class (liftIO) | ||||
| import Data.Monoid | ||||
| @ -36,15 +37,18 @@ esInit _ _ ui@UIState{aScreen=ErrorScreen{}} = ui | ||||
| esInit _ _ _ = error "init function called with wrong screen type, should not happen" | ||||
| 
 | ||||
| esDraw :: UIState -> [Widget] | ||||
| esDraw UIState{ -- aopts=_uopts@UIOpts{cliopts_=_copts@CliOpts{reportopts_=_ropts@ReportOpts{query_=querystr}}}, | ||||
|                              aScreen=ErrorScreen{..} | ||||
|                              ,aMode=mode} = | ||||
| esDraw UIState{ --aopts=UIOpts{cliopts_=copts@CliOpts{}} | ||||
|                aScreen=ErrorScreen{..} | ||||
|               ,aMode=mode} = | ||||
|   case mode of | ||||
|     Help       -> [helpDialog, maincontent] | ||||
|     -- Minibuffer e -> [minibuffer e, maincontent] | ||||
|     _          -> [maincontent] | ||||
|   where | ||||
|     toplabel = withAttr ("border" <> "bold") (str "Oops. Please fix this problem then press g to reload") | ||||
|     toplabel = | ||||
|           withAttr ("border" <> "bold") (str "Oops. Please fix this problem then press g to reload") | ||||
| --       <+> (if ignore_assertions_ copts then withAttr (borderAttr <> "query") (str " ignoring") else str " not ignoring") | ||||
| 
 | ||||
|     maincontent = Widget Greedy Greedy $ do | ||||
|       render $ defaultLayout toplabel bottomlabel $ withAttr "error" $ str $ esError | ||||
|       where | ||||
|  | ||||
| @ -99,7 +99,7 @@ rsInit d reset ui@UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}, ajo | ||||
| rsInit _ _ _ = error "init function called with wrong screen type, should not happen" | ||||
| 
 | ||||
| rsDraw :: UIState -> [Widget] | ||||
| rsDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}} | ||||
| rsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} | ||||
|                             ,aScreen=RegisterScreen{..} | ||||
|                             ,aMode=mode | ||||
|                             } = | ||||
| @ -120,6 +120,7 @@ rsDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}} | ||||
|       <+> str "/" | ||||
|       <+> total | ||||
|       <+> str ")" | ||||
|       <+> (if ignore_assertions_ copts then withAttr (borderAttr <> "query") (str " ignoring balance assertions") else str "") | ||||
|     togglefilters = | ||||
|       case concat [ | ||||
|            if cleared_ ropts then ["cleared"] else [] | ||||
|  | ||||
| @ -46,7 +46,7 @@ tsInit _d _reset ui@UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=_ropts}} | ||||
| tsInit _ _ _ = error "init function called with wrong screen type, should not happen" | ||||
| 
 | ||||
| tsDraw :: UIState -> [Widget] | ||||
| tsDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}} | ||||
| tsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} | ||||
|                               ,aScreen=TransactionScreen{ | ||||
|                                    tsTransaction=(i,t) | ||||
|                                   ,tsTransactions=nts | ||||
| @ -69,6 +69,7 @@ tsDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}} | ||||
|       <+> togglefilters | ||||
|       <+> borderQueryStr (query_ ropts) | ||||
|       <+> str (" in "++T.unpack (replaceHiddenAccountsNameWith "All" acct)++")") | ||||
|       <+> (if ignore_assertions_ copts then withAttr (borderAttr <> "query") (str " ignoring balance assertions") else str "") | ||||
|     togglefilters = | ||||
|       case concat [ | ||||
|            if cleared_ ropts then ["cleared"] else [] | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user