Browse Source

tw.view: new `item_desc_pl` attribute

The MMGen Project 6 months ago
parent
commit
2d70cc9257

+ 1 - 1
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',

+ 1 - 1
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',

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 0
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.

+ 1 - 1
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)