tw.view,tw.unspent: minor cleanups

This commit is contained in:
The MMGen Project 2022-12-08 15:14:01 +00:00
commit 41c3efcfdb
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 5 additions and 6 deletions

View file

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

View file

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