From 7cd7f0b08a28a468b7ce6cf5c25cc8cc87fe2301 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 23 May 2025 15:35:23 +0000 Subject: [PATCH] tw.view: subheader display fix --- mmgen/proto/eth/tw/view.py | 4 +--- mmgen/tw/addresses.py | 6 +----- mmgen/tw/view.py | 8 ++++++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/mmgen/proto/eth/tw/view.py b/mmgen/proto/eth/tw/view.py index f68bb85c..94b157af 100755 --- a/mmgen/proto/eth/tw/view.py +++ b/mmgen/proto/eth/tw/view.py @@ -22,6 +22,4 @@ class EthereumTwView(TwView): def gen_subheader(self, cw, color): if self.disp_prec == 8: yield 'Balances truncated to 8 decimal points' - if self.twctl.use_cached_balances: - from ....color import nocolor, yellow - yield (nocolor, yellow)[color]('WARNING: Using cached balances. These may be out of date!') + yield from super().gen_subheader(cw, color) diff --git a/mmgen/tw/addresses.py b/mmgen/tw/addresses.py index f1d068a4..6dfdebc7 100755 --- a/mmgen/tw/addresses.py +++ b/mmgen/tw/addresses.py @@ -12,7 +12,7 @@ tw.addresses: Tracking wallet listaddresses class for the MMGen suite """ -from ..util import msg, suf, is_int +from ..util import msg, is_int from ..obj import MMGenListItem, ImmutableAttr, ListItemAttr, TwComment, NonNegativeInt from ..addr import CoinAddr, MMGenID, MMGenAddrType from ..amt import CoinAmtChk @@ -203,10 +203,6 @@ class TwAddresses(TwView): interactive = interactive, ) - def gen_subheader(self, cw, color): - if self.minconf: - yield f'Displaying balances with at least {self.minconf} confirmation{suf(self.minconf)}' - def squeezed_col_hdr(self, cw, fs, color): return fs.format( n = '', diff --git a/mmgen/tw/view.py b/mmgen/tw/view.py index 97540ee9..e4907d9a 100755 --- a/mmgen/tw/view.py +++ b/mmgen/tw/view.py @@ -27,7 +27,7 @@ from ..cfg import gv from ..objmethods import MMGenObject from ..obj import get_obj, MMGenIdx, MMGenList from ..color import nocolor, yellow, green, red, blue -from ..util import msg, msg_r, fmt, die, capfirst, make_timestr +from ..util import msg, msg_r, fmt, die, capfirst, suf, make_timestr from ..rpc import rpc_init from ..base_obj import AsyncInit @@ -379,7 +379,11 @@ class TwView(MMGenObject, metaclass=AsyncInit): return do_ret(get_freews(self.cols, varws, varw, minw)) def gen_subheader(self, cw, color): - return () + if self.twctl.use_cached_balances: + from ..color import nocolor, yellow + yield (nocolor, yellow)[color]('WARNING: Using cached balances. These may be out of date!') + else: + yield f'Displaying balances with {self.minconf} confirmation{suf(self.minconf)}' def gen_footer(self, color): if hasattr(self, 'total'):