Browse Source

tw.view: subheader display fix

The MMGen Project 8 months ago
parent
commit
7cd7f0b08a
3 changed files with 8 additions and 10 deletions
  1. 1 3
      mmgen/proto/eth/tw/view.py
  2. 1 5
      mmgen/tw/addresses.py
  3. 6 2
      mmgen/tw/view.py

+ 1 - 3
mmgen/proto/eth/tw/view.py

@@ -22,6 +22,4 @@ class EthereumTwView(TwView):
 	def gen_subheader(self, cw, color):
 	def gen_subheader(self, cw, color):
 		if self.disp_prec == 8:
 		if self.disp_prec == 8:
 			yield 'Balances truncated to 8 decimal points'
 			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)

+ 1 - 5
mmgen/tw/addresses.py

@@ -12,7 +12,7 @@
 tw.addresses: Tracking wallet listaddresses class for the MMGen suite
 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 ..obj import MMGenListItem, ImmutableAttr, ListItemAttr, TwComment, NonNegativeInt
 from ..addr import CoinAddr, MMGenID, MMGenAddrType
 from ..addr import CoinAddr, MMGenID, MMGenAddrType
 from ..amt import CoinAmtChk
 from ..amt import CoinAmtChk
@@ -203,10 +203,6 @@ class TwAddresses(TwView):
 			interactive = interactive,
 			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):
 	def squeezed_col_hdr(self, cw, fs, color):
 		return fs.format(
 		return fs.format(
 			n  = '',
 			n  = '',

+ 6 - 2
mmgen/tw/view.py

@@ -27,7 +27,7 @@ from ..cfg import gv
 from ..objmethods import MMGenObject
 from ..objmethods import MMGenObject
 from ..obj import get_obj, MMGenIdx, MMGenList
 from ..obj import get_obj, MMGenIdx, MMGenList
 from ..color import nocolor, yellow, green, red, blue
 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 ..rpc import rpc_init
 from ..base_obj import AsyncInit
 from ..base_obj import AsyncInit
 
 
@@ -379,7 +379,11 @@ class TwView(MMGenObject, metaclass=AsyncInit):
 			return do_ret(get_freews(self.cols, varws, varw, minw))
 			return do_ret(get_freews(self.cols, varws, varw, minw))
 
 
 	def gen_subheader(self, cw, color):
 	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):
 	def gen_footer(self, color):
 		if hasattr(self, 'total'):
 		if hasattr(self, 'total'):