From 2d70cc9257c66e022c530f8c495d387803836476 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 26 May 2025 09:39:11 +0000 Subject: [PATCH] tw.view: new `item_desc_pl` attribute --- mmgen/proto/btc/tw/txhistory.py | 2 +- mmgen/proto/btc/tw/unspent.py | 2 +- mmgen/proto/eth/tw/unspent.py | 2 +- mmgen/tw/addresses.py | 2 +- mmgen/tw/unspent.py | 1 + mmgen/tw/view.py | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mmgen/proto/btc/tw/txhistory.py b/mmgen/proto/btc/tw/txhistory.py index f5b5847d..830e2774 100755 --- a/mmgen/proto/btc/tw/txhistory.py +++ b/mmgen/proto/btc/tw/txhistory.py @@ -246,7 +246,7 @@ class BitcoinTwTxHistory(BitcoinTwView, TwTxHistory, BitcoinTwRPC): hdr_lbl = 'transaction history' desc = 'transaction history' item_desc = 'transaction' - no_data_errmsg = 'No transactions in tracking wallet!' + item_desc_pl = 'transactions' prompt_fs_in = [ 'Sort options: [t]xid, [a]mt, total a[m]t, [A]ge, block[n]um, [r]everse', 'Column options: toggle [D]ays/date/confs/block, tx[i]d, [T]otal amt', diff --git a/mmgen/proto/btc/tw/unspent.py b/mmgen/proto/btc/tw/unspent.py index 9df8e242..24e94067 100755 --- a/mmgen/proto/btc/tw/unspent.py +++ b/mmgen/proto/btc/tw/unspent.py @@ -46,7 +46,7 @@ class BitcoinTwUnspentOutputs(BitcoinTwView, TwUnspentOutputs): hdr_lbl = 'unspent outputs' desc = 'unspent outputs' item_desc = 'unspent output' - no_data_errmsg = 'No unspent outputs in tracking wallet!' + item_desc_pl = 'unspent outputs' dump_fn_pfx = 'listunspent' prompt_fs_in = [ 'Sort options: [t]xid, [a]mount, [A]ge, a[d]dr, [M]mgen addr, [r]everse', diff --git a/mmgen/proto/eth/tw/unspent.py b/mmgen/proto/eth/tw/unspent.py index 97244abf..6f77e961 100755 --- a/mmgen/proto/eth/tw/unspent.py +++ b/mmgen/proto/eth/tw/unspent.py @@ -35,7 +35,7 @@ class EthereumTwUnspentOutputs(EthereumTwView, TwUnspentOutputs): desc = 'account balances' item_desc = 'account' dump_fn_pfx = 'balances' - no_data_errmsg = 'No accounts in tracking wallet!' + item_desc_pl = 'accounts' def get_column_widths(self, data, *, wide, interactive): # min screen width: 80 cols diff --git a/mmgen/tw/addresses.py b/mmgen/tw/addresses.py index 6dfdebc7..e8a96ab3 100755 --- a/mmgen/tw/addresses.py +++ b/mmgen/tw/addresses.py @@ -25,6 +25,7 @@ class TwAddresses(TwView): hdr_lbl = 'tracking wallet addresses' desc = 'address list' item_desc = 'address' + item_desc_pl = 'addresses' sort_key = 'twmmid' update_widths_on_age_toggle = True print_output_types = ('detail',) @@ -33,7 +34,6 @@ class TwAddresses(TwView): showempty = True showused = 1 # tristate: 0:no, 1:yes, 2:all all_labels = False - no_data_errmsg = 'No addresses in tracking wallet!' mod_subpath = 'tw.addresses' has_age = False has_used = False diff --git a/mmgen/tw/unspent.py b/mmgen/tw/unspent.py index 2777b4e7..6f9beb44 100755 --- a/mmgen/tw/unspent.py +++ b/mmgen/tw/unspent.py @@ -39,6 +39,7 @@ class TwUnspentOutputs(TwView): has_age = False can_group = False show_mmid = True + item_desc_pl = 'addresses' no_rpcdata_errmsg = """ No spendable outputs found! Import addresses with balances into your watch-only wallet using 'mmgen-addrimport' and then re-run this program. diff --git a/mmgen/tw/view.py b/mmgen/tw/view.py index 66818508..b73e2a21 100755 --- a/mmgen/tw/view.py +++ b/mmgen/tw/view.py @@ -286,7 +286,7 @@ class TwView(MMGenObject, metaclass=AsyncInit): self.disp_data = list(self.filter_data()) if not self.data: - die(1, self.no_data_errmsg) + die(1, f'No {self.item_desc_pl} in tracking wallet!') self.do_sort(key=sort_key, reverse=reverse_sort)