Commit Graph

472 Commits

Author SHA1 Message Date
Simon Michael
4a35945a8f imp: ui: start on balance sheet accounts screen 2022-11-04 23:16:40 -10:00
Simon Michael
988c164ec8 imp: debug logging improvements; hledger-ui logs to hledger-ui.log only
Hledger.Utils.Debug's "trace or log" functions are now controlled as
follows: to enable logging, append ",logging" to the program name at
startup (using withProgName). This also works when running in GHCI.
And they log to PROGNAME.log, not debug.log.

All (hopefully) debug logging in the hledger packages is now "trace or
log" capable.

This means that hledger-ui should now log all debug output to
./hledger-ui.log, with none of it appearing on the console.
2022-11-03 16:07:54 -10:00
Simon Michael
c25c5cef44 fix: make no-argument --debug flag work with ui & web also 2022-11-03 08:13:58 -10:00
Simon Michael
9a9ebfc0e3 dev: ui: rename hledger-ui debug helpers 2022-10-31 12:42:09 -10:00
Simon Michael
603fae70c0 dev: lib: clean up/simplify debug helpers 2022-10-31 11:26:11 -10:00
Simon Michael
3a0473b5b4 fix: ui: fix regenerateScreens, it was not updating the journal
And add to test suite. Fixes unreleased code.
2022-10-28 23:03:12 -10:00
Simon Michael
778b660919 dev: ui: debug logging improvements, export screenRegisterDescriptions 2022-10-28 22:44:47 -10:00
Simon Michael
d948198303 dev: ui: cleanup 2022-10-28 17:16:45 -10:00
Simon Michael
52d7f99360 fix: ui: fix internal screen state when using --register
This seems not to have been user-visible.
2022-10-28 16:52:45 -10:00
Simon Michael
21c00f9ba2 imp: ui: improve --debug=2 debug.log logging 2022-10-28 16:51:55 -10:00
Simon Michael
020dec10a7 dev: ui: debug logging helpers
Hledger.UI.UIUtils
added:
dlogUiTraceIO
dlogUiScreenStack
mapScreens
screenId
2022-10-28 16:50:01 -10:00
Simon Michael
45ee5d125d imp: ui: support/require fsnotify 0.4.x 2022-09-19 18:18:50 -10:00
Simon Michael
e51d4059db feat: ui: add income statement accounts screen 2022-09-11 13:51:40 -10:00
Simon Michael
9fc92cefe4 imp: ui: at --debug 2+, also log events 2022-09-10 12:55:00 -10:00
Simon Michael
68b243e670 dev: ui: menu screen code cleanups 2022-09-10 12:44:27 -10:00
Simon Michael
0ba0a12cc0 dev: ui: add some commented debug logging of state 2022-09-10 12:44:27 -10:00
Simon Michael
96f42380e8 dev: ui: fix an unclear windows-conditional import 2022-09-10 12:44:21 -10:00
Simon Michael
6f258b704a dev: ui: bs: reuse account screen's event handler 2022-09-09 16:11:00 -10:00
Simon Michael
3fbef8ab88 dev: ui: asHandle refactor, cleanup 2022-09-09 11:01:49 -10:00
Simon Michael
a3c0716133 dev: ui: as, bs: reuse update, draw code 2022-09-08 13:42:29 -10:00
Simon Michael
a3ea054028 dev: ui: bs: reuse AccountsScreenState 2022-09-08 12:46:02 -10:00
Simon Michael
90703dcd84 dev: ui: ms: cleanups 2022-09-08 12:38:50 -10:00
Simon Michael
fb0053c15f imp: ui: fix a probable bug with detecting date change while running 2022-09-08 12:23:59 -10:00
Simon Michael
b81c2395d5 dev: ui: fix warning 2022-09-08 12:23:59 -10:00
Simon Michael
6737bb3d38 imp: ui: mouse-clicking below the list no longer navigates back
I and mail list think it's too obtrusive, eg sometimes it navigates
when you just want to focus the window.
2022-09-08 12:23:59 -10:00
Simon Michael
975522e759 feat: ui: add balance sheet accounts screen 2022-09-08 12:23:59 -10:00
Simon Michael
75a19e8609 feat: ui: add top-level menu screen 2022-09-08 12:23:59 -10:00
Simon Michael
8f8fc7bf75 dev: ui: re-export new/update functions from screen modules 2022-09-07 14:17:49 -10:00
Simon Michael
a5f4d2fd6e dev: ui: refactor: simpler, more debuggable Screen type
Follow-on from the brick 1.0 migration work (#1889, #1919).

These new types aim to be more restrictive, allowing fewer invalid
states, and easier to inspect and debug. The screen types store only
state, not behaviour (functions), and there is no longer a circular
dependency between UIState and Screen.
2022-09-07 11:56:13 -10:00
Simon Michael
c80c72d7cd dev: lib, cli, bin: enable/fix name shadowing warnings
And a few other cleanups.
2022-08-23 12:16:15 +01:00
Simon Michael
96db4fe9cc dev: ui: enable/fix name shadowing warnings 2022-08-23 02:57:59 +01:00
Simon Michael
f5efb2e08e fix: ui: cleanups, fix more state & logging bugs (#1889) 2022-08-23 01:55:25 +01:00
Simon Michael
b6353804b8 fix: ui: fix state bugs from brick 1 migration (#1889) 2022-08-23 00:50:51 +01:00
Simon Michael
67cd6be424 imp: ui: at --debug=2, do lots of logging to debug.log 2022-08-23 00:50:51 +01:00
Simon Michael
4e105f0cb7 ;dev: ui: note relevant discussion 2022-08-17 16:19:34 +01:00
Simon Michael
4bd9f4a6f7 dev: ui: avoid MonadFail entirely, simplifying ghc version compat (#1889) 2022-08-17 15:57:27 +01:00
Simon Michael
2a594b7fb7 pkg: ui: use/require brick 1.0+ (#1889) 2022-08-17 15:57:27 +01:00
Simon Michael
dde2ea7e42 pkg: ui: support doclayout 0.4, brick 0.72+ 2022-07-10 22:03:45 +01:00
Simon Michael
3eddd913e3 imp: ghc9.2: silence incomplete-record-updates warnings 2022-03-25 20:36:12 -10:00
Stephen Morgan
603b2e9f09 ref: Use ExceptT String IO a instead of IO (Either String a).
This increases composability and avoids some ugly case handling. We
re-export runExceptT in Hledger.Read.

The final return types of the following functions has been changed from
IO (Either String a) to ExceptT String IO a. If this causes a problem,
you can get the old behaviour by calling runExceptT on the output:
readJournal, readJournalFiles, readJournalFile

Or, you can use the easy functions readJournal', readJournalFiles', and
readJournalFile', which assume default options and return in the IO
monad.
2022-03-25 14:23:27 -10:00
Stephen Morgan
45408183fe dev: reg: areg: Strip prices early on in PostingsReport and AccountTransactionsReport, when possible.
This results in big speedups in cases when we have many transaction prices, like in examples/10000x1000x10.journal. This can be disabled with the show_costs_ option in ReportOpts.
2022-03-10 17:21:40 -10:00
Stephen Morgan
57d055b643 fix: cost: Add inferred equity postings during journal finalisation, so
they can be matched by queries.
2022-01-16 18:37:18 -10:00
Stephen Morgan
8eedbbbe87 imp: cost: Generate totally balanced conversion postings for amounts with costs.
Introduce --infer-equity option which will generate conversion postings.
--cost will override --infer-equity.

This means there will no longer be unbalanced transactions, but will be
offsetting conversion postings to balance things out. For example.

2000-01-01
  a   1 AAA @@ 2 BBB
  b  -2 BBB

When converting to cost, this is treated the same as before.
When used with --infer-equity, this is now treated as:

2000-01-01
  a                               1 AAA
  equity:conversion:AAA-BBB:AAA  -1 AAA
  equity:conversion:AAA-BBB:BBB   2 BBB
  b                              -2 BBB

There is a new account type, Conversion/V, which is a subtype of Equity/E.
The first account declared with this type, if any, is used as the base account
for inferred equity postings in conversion transactions, overriding the default
"equity:conversion".

API changes:

Costing has been changed to ConversionOp with three options:
NoConversionOp, ToCost, and InferEquity.
The first correspond to the previous NoCost and Cost options, while the
third corresponds to the --infer-equity flag.  This converts transactions with costs
(one or more transaction prices) to transactions with equity:conversion postings.
It is in ConversionOp because converting to cost with -B/--cost and inferring conversion
equity postings with --infer-equity are mutually exclusive.

Correspondingly, the cost_ record of ReportOpts has been changed to
conversionop_.

This also removes show_costs_ option in ReportOpts, as its functionality
has been replaced by the richer cost_ option.
2021-12-21 10:50:13 -10:00
Simon Michael
1ef8f329c6 lib: simpler more robust version strings, with date/without patchlevel
We no longer rely on git tags and git describe output, since it's
hard to reliably select the correct tag eg for minor releases.
We might use them again in future for dev builds, but it requires
adding git describe --match support to githash. For now,

* Program name, OS and architecture are always shown.
* The package version is always shown.
* If there is git info at build time, the latest commit hash and commit date are shown.

Example outputs:
A homebrew binary, not built in git repo: hledger-ui 1.24, mac-aarch64
A CI release build, built in git repo:    hledger 1.24.1-g455b35293-20211210, mac-x86_64

API changes:

* new type synonyms ProgramName, PackageVersion, VersionString
* versionStringForProgname -> versionString with extra argument
* versionStringFor -> versionStringWith with extra argument
2021-12-10 12:42:40 -10:00
Simon Michael
6b3d040fdf cln: ui: drop unused pragma 2021-12-09 12:23:55 -10:00
Simon Michael
bfb8a13c13 imp: ui: Z -> z for easier zero toggling
Z remains supported as a hidden legacy key.
2021-11-25 11:58:41 -10:00
Simon Michael
eb4ad8cc11 imp: ui: also show declared leaf accounts (when showing zeros)
Similar to (and motivating) balance --declared, the goal is to
show a useful list of accounts when all you have is some starter
files with account declarations.
2021-11-25 11:57:39 -10:00
Simon Michael
e5678ce230 Revert "imp: ui: accounts: also show declared accounts, even if unused"
This reverts commit 29efacf02c.
(It breaks filtering by account, also the parent accounts aren't really desirable to see.)
2021-11-22 12:06:23 -10:00
Simon Michael
29efacf02c imp: ui: accounts: also show declared accounts, even if unused
This will be more user-friendly when getting started.
2021-11-22 11:13:47 -10:00
Simon Michael
7e4b2af361 imp: ui: -w short flag for --watch 2021-11-21 19:34:40 -10:00