proto.eth.tw.addresses: remove get_column_widths()
This commit is contained in:
parent
9d33ae3d07
commit
c40f4f9aa5
3 changed files with 8 additions and 29 deletions
|
|
@ -20,6 +20,8 @@ from .rpc import BitcoinTwRPC
|
|||
class BitcoinTwAddresses(TwAddresses, BitcoinTwRPC):
|
||||
|
||||
has_age = True
|
||||
has_used = True
|
||||
|
||||
prompt_fs_in = [
|
||||
'Sort options: [a]mt, [A]ge, [M]mgen addr, [r]everse',
|
||||
'Column options: toggle [D]ays/date/confs/block',
|
||||
|
|
|
|||
|
|
@ -19,39 +19,12 @@ from .rpc import EthereumTwRPC
|
|||
|
||||
class EthereumTwAddresses(TwAddresses, EthereumTwView, EthereumTwRPC):
|
||||
|
||||
has_age = False
|
||||
prompt_fs_in = [
|
||||
'Sort options: [a]mt, [M]mgen addr, [r]everse',
|
||||
'Filters: show [E]mpty addrs, show all [L]abels',
|
||||
'View/Print: pager [v]iew, [w]ide pager view, [p]rint{s}',
|
||||
'Actions: [q]uit menu, r[e]draw, [D]elete addr, add [l]abel:']
|
||||
|
||||
def get_column_widths(self, data, *, wide, interactive):
|
||||
|
||||
return self.compute_column_widths(
|
||||
widths = { # fixed cols
|
||||
'num': max(2, len(str(len(data)))+1),
|
||||
'mmid': max(len(d.twmmid.disp) for d in data),
|
||||
'used': 0,
|
||||
'amt': self.amt_widths['amt'],
|
||||
'date': 0,
|
||||
'block': 0,
|
||||
'date_time': 0,
|
||||
'spc': 5, # 4 spaces between cols + 1 leading space in fs
|
||||
},
|
||||
maxws = { # expandable cols
|
||||
'addr': max(len(d.addr) for d in data) if self.showcoinaddrs else 0,
|
||||
'comment': max(d.comment.screen_width for d in data),
|
||||
},
|
||||
minws = {
|
||||
'addr': 12 if self.showcoinaddrs else 0,
|
||||
'comment': len('Comment'),
|
||||
},
|
||||
maxws_nice = {'addr': 18},
|
||||
wide = wide,
|
||||
interactive = interactive,
|
||||
)
|
||||
|
||||
async def get_rpc_data(self):
|
||||
|
||||
self.total = self.proto.coin_amt('0')
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ class TwAddresses(TwView):
|
|||
all_labels = False
|
||||
no_data_errmsg = 'No addresses in tracking wallet!'
|
||||
mod_subpath = 'tw.addresses'
|
||||
has_age = False
|
||||
has_used = False
|
||||
|
||||
key_mappings = {
|
||||
'a':'s_amt',
|
||||
|
|
@ -97,6 +99,8 @@ class TwAddresses(TwView):
|
|||
await super().__init__(cfg, proto)
|
||||
|
||||
self.minconf = NonNegativeInt(minconf)
|
||||
self.spc_w = 5 + self.has_age + self.has_used # 1 space between cols + 1 leading space in fs
|
||||
self.used_w = 4 if self.has_used else 0
|
||||
|
||||
if mmgen_addrs:
|
||||
a = mmgen_addrs.rsplit(':', 1)
|
||||
|
|
@ -151,12 +155,12 @@ class TwAddresses(TwView):
|
|||
widths = { # fixed cols
|
||||
'num': max(2, len(str(len(data)))+1),
|
||||
'mmid': max(len(d.twmmid.disp) for d in data),
|
||||
'used': 4,
|
||||
'used': self.used_w,
|
||||
'amt': self.amt_widths['amt'],
|
||||
'date': self.age_w if self.has_age else 0,
|
||||
'block': self.age_col_params['block'][0] if wide and self.has_age else 0,
|
||||
'date_time': self.age_col_params['date_time'][0] if wide and self.has_age else 0,
|
||||
'spc': 7, # 6 spaces between cols + 1 leading space in fs
|
||||
'spc': self.spc_w,
|
||||
},
|
||||
maxws = { # expandable cols
|
||||
'addr': max(len(d.addr) for d in data) if self.showcoinaddrs else 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue