tw.view: new item_desc_pl attribute

This commit is contained in:
The MMGen Project 2025-05-26 09:39:11 +00:00
commit 2d70cc9257
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 6 additions and 5 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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