tw.view: subheader display fix

This commit is contained in:
The MMGen Project 2025-05-23 15:35:23 +00:00
commit 7cd7f0b08a
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 8 additions and 10 deletions

View file

@ -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)

View file

@ -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 = '',

View file

@ -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'):