From 41c3efcfdb4bc174ca06e864395ad6fe9f77795a Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Thu, 8 Dec 2022 15:14:01 +0000 Subject: [PATCH] tw.view,tw.unspent: minor cleanups --- mmgen/tw/unspent.py | 4 ++-- mmgen/tw/view.py | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mmgen/tw/unspent.py b/mmgen/tw/unspent.py index 0f0b8808..fcee59cf 100755 --- a/mmgen/tw/unspent.py +++ b/mmgen/tw/unspent.py @@ -184,7 +184,7 @@ class TwUnspentOutputs(TwView): for n,d in enumerate(data): yield fs.format( n = str(n+1) + ')', - t = (d.txid.fmtc( '|' + '.'*(cw.txid-1), width=d.txid.width, color=color ) if d.skip == 'txid' + t = (d.txid.fmtc( '|' + '.'*(cw.txid-1), width=cw.txid, color=color ) if d.skip == 'txid' else d.txid.truncate( width=cw.txid, color=color )) if cw.txid else None, v = ' ' + d.vout.fmt( width=cw.vout-1, color=color ) if cw.vout else None, a = d.addr.fmtc( '|' + '.'*(cw.addr-1), width=cw.addr, color=color ) if d.skip == 'addr' @@ -202,7 +202,7 @@ class TwUnspentOutputs(TwView): for n,d in enumerate(data): yield fs.format( n = str(n+1) + ')', - t = d.txid.fmt( width=d.txid.width, color=color ) if cw.txid else None, + t = d.txid.fmt( width=cw.txid, color=color ) if cw.txid else None, v = ' ' + d.vout.fmt( width=cw.vout-1, color=color ) if cw.vout else None, a = d.addr.fmt( width=cw.addr, color=color ), m = d.twmmid.fmt( width=cw.mmid, color=color ), diff --git a/mmgen/tw/view.py b/mmgen/tw/view.py index 82816eeb..62b70d7a 100755 --- a/mmgen/tw/view.py +++ b/mmgen/tw/view.py @@ -449,8 +449,9 @@ class TwView(MMGenObject,metaclass=AsyncInit): if data != dsave: self.pos = 0 + display_hdr,display_body = make_display() + if scroll: - display_hdr,display_body = make_display() fixed_height = len(display_hdr) + self.prompt_height + 1 if self.term_height - fixed_height < self.min_scrollable_height: @@ -464,8 +465,6 @@ class TwView(MMGenObject,metaclass=AsyncInit): self.scrollable_height = self.term_height - fixed_height self.max_pos = max(0, len(display_body) - self.scrollable_height) self.pos = min(self.pos,self.max_pos) - else: - display_hdr,display_body = make_display() if not dt.detail: self.display_hdr = display_hdr @@ -695,7 +694,7 @@ class TwView(MMGenObject,metaclass=AsyncInit): s = ' ' if parent.scroll else '' )) if parent.scroll: await asyncio.sleep(1.5) - msg_r(CUR_UP(1) + ERASE_ALL + '\r') + msg_r(CUR_UP(1) + '\r' + ERASE_ALL) else: # action return values: # True: action successfully performed