From c40f4f9aa5ae103ccd4c87a28743455805015367 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 23 May 2025 15:35:23 +0000 Subject: [PATCH] proto.eth.tw.addresses: remove `get_column_widths()` --- mmgen/proto/btc/tw/addresses.py | 2 ++ mmgen/proto/eth/tw/addresses.py | 27 --------------------------- mmgen/tw/addresses.py | 8 ++++++-- 3 files changed, 8 insertions(+), 29 deletions(-) diff --git a/mmgen/proto/btc/tw/addresses.py b/mmgen/proto/btc/tw/addresses.py index e30ea060..9bc097b1 100755 --- a/mmgen/proto/btc/tw/addresses.py +++ b/mmgen/proto/btc/tw/addresses.py @@ -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', diff --git a/mmgen/proto/eth/tw/addresses.py b/mmgen/proto/eth/tw/addresses.py index f1c6256f..135933ae 100755 --- a/mmgen/proto/eth/tw/addresses.py +++ b/mmgen/proto/eth/tw/addresses.py @@ -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') diff --git a/mmgen/tw/addresses.py b/mmgen/tw/addresses.py index 6eb1408e..c3b37c64 100755 --- a/mmgen/tw/addresses.py +++ b/mmgen/tw/addresses.py @@ -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,