Browse Source

tw.view: prompt -> prompt_fs

The MMGen Project 2 years ago
parent
commit
28251369d1

+ 3 - 10
mmgen/proto/btc/tw/addresses.py

@@ -22,19 +22,12 @@ from .rpc import BitcoinTwRPC
 class BitcoinTwAddresses(TwAddresses,BitcoinTwRPC):
 
 	has_age = True
-	prompt = """
+	prompt_fs = """
 Sort options: [a]mt, [A]ge, [M]mgen addr, [r]everse
 Column options: toggle [D]ays/date/confs/block
 Filters: show [E]mpty addrs, [u]sed addrs, all [L]abels
-View/Print: pager [v]iew, [w]ide view, [p]rint
-Actions: [q]uit view, r[e]draw, add [l]abel:
-"""
-	prompt_scroll = """
-Sort options: [a]mt, [A]ge, [M]mgen addr, [r]everse
-Column options: toggle [D]ays/date/confs/block
-Filters: show [E]mpty addrs, [u]sed addrs, all [L]abels
-Scrolling: k=up, j=down, b=pgup, f=pgdown, g=top, G=bottom
-Actions: [w]ide view, [q]uit, [p]rint, r[e]draw, add [l]abel:
+View/Print: pager [v]iew, [w]ide pager view, [p]rint{s}
+Actions: [q]uit menu, r[e]draw, add [l]abel:
 """
 	key_mappings = {
 		'a':'s_amt',

+ 4 - 5
mmgen/proto/btc/tw/prune.py

@@ -17,13 +17,12 @@ from .addresses import BitcoinTwAddresses
 
 class BitcoinTwAddressesPrune(BitcoinTwAddresses,TwAddressesPrune):
 
-	prompt = """
-Sort options: [a]mt, [A]ge, [M]mid, [r]everse
+	prompt_fs = """
+Sort options: [a]mt, [A]ge, [M]mgen addr, [r]everse
 Column options: toggle [D]ays/date/confs/block
 Filters: show [E]mpty addrs, [U]sed addrs, all [L]abels
-View/Print: pager [v]iew, [w]ide view
-Actions: [q]uit pruning, r[e]draw,
-Pruning: [p]rune, [u]nprune, [c]lear prune list:
+View/Actions: pager [v]iew, [w]ide view, r[e]draw{s}
+Pruning: [q]uit pruning, [p]rune, [u]nprune, [c]lear prune list:
 """
 	key_mappings = {
 		'a':'s_amt',

+ 5 - 12
mmgen/proto/btc/tw/txhistory.py

@@ -230,18 +230,11 @@ class BitcoinTwTxHistory(TwTxHistory,BitcoinTwRPC):
 	desc = 'transaction history'
 	item_desc = 'transaction'
 	no_data_errmsg = 'No transactions in tracking wallet!'
-	prompt = """
-Sorting: [t]xid, [a]mt, total a[m]t, [A]ge, block[n]um, [r]everse
-Column opts: toggle [D]ays/date/confs/block, tx[i]d, [T]otal amt
-View/Print: pager [v]iew, full [V]iew, screen [p]rint, full [P]rint
-Filters/Actions: show [u]nconfirmed, [q]uit view, r[e]draw:
-"""
-	prompt_scroll = """
-Sorting: [t]xid, [a]mt, total a[m]t, [A]ge, block[n]um, [r]everse
-Column opts: toggle [D]ays/date/confs/block, tx[i]d, [T]otal amt
-View/Print: full [V]iew, screen [p]rint, full [P]rint
-Scrolling: k=up, j=down, b=pgup, f=pgdown, g=top, G=bottom
-Filters/Actions: show [u]nconfirmed, [q]uit view, r[e]draw:
+	prompt_fs = """
+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/Print: pager [v]iew, full pager [V]iew, [p]rint, full [P]rint{s}
+Filters/Actions: show [u]nconfirmed, [q]uit menu, r[e]draw:
 """
 	key_mappings = {
 		'A':'s_age',

+ 5 - 12
mmgen/proto/btc/tw/unspent.py

@@ -29,18 +29,11 @@ class BitcoinTwUnspentOutputs(TwUnspentOutputs):
 	item_desc = 'unspent output'
 	no_data_errmsg = 'No unspent outputs in tracking wallet!'
 	dump_fn_pfx = 'listunspent'
-	prompt_fs = 'Total to spend, excluding fees: {} {}\n\n'
-	prompt = """
-Sort options: [t]xid, [a]mount, a[d]dr, [A]ge, [r]everse, [M]mid
-Display options: toggle [D]ays/date, show gr[o]up, show [m]mid
-View options: pager [v]iew, [w]ide view
-Actions: [q]uit view, [p]rint, r[e]draw, add [l]abel:
-"""
-	prompt_scroll = """
-Sort options: [t]xid, [a]mount, a[d]dr, [A]ge, [r]everse, [M]mid
-Display options: toggle [D]ays/date, show gr[o]up, show [m]mid
-Scrolling: k=up, j=down, b=pgup, f=pgdown, g=top, G=bottom
-View/Actions: [w]ide view, [q]uit, [p]rint, r[e]draw, add [l]abel:
+	prompt_fs = """
+Sort options: [t]xid, [a]mount, [A]ge, a[d]dr, [M]mgen addr, [r]everse
+Column options: toggle [D]ays/date/confs/block, gr[o]up, show [m]mgen addr
+View options: pager [v]iew, [w]ide pager view{s}
+Actions: [q]uit menu, [p]rint, r[e]draw, add [l]abel:
 """
 	key_mappings = {
 		't':'s_txid',

+ 4 - 11
mmgen/proto/eth/tw/addresses.py

@@ -21,18 +21,11 @@ from .rpc import EthereumTwRPC
 class EthereumTwAddresses(TwAddresses,EthereumTwView,EthereumTwRPC):
 
 	has_age = False
-	prompt = """
+	prompt_fs = """
 Sort options: [a]mt, [M]mgen addr, [r]everse
-Filters: show [E]mpty addrs, all [L]abels
-View/Print: pager [v]iew, [w]ide view, [p]rint
-Actions: [q]uit view, r[e]draw, [D]elete addr, add [l]abel:
-"""
-	prompt_scroll = """
-Sort options: [a]mt, [M]mgen addr, [r]everse
-Filters: show [E]mpty addrs, all [L]abels
-View/Print: [w]ide view, [p]rint
-Scrolling: k=up, j=down, b=pgup, f=pgdown, g=top, G=bottom
-Actions: [q]uit view, r[e]draw, [D]elete addr, add [l]abel:
+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:
 """
 	key_mappings = {
 		'a':'s_amt',

+ 4 - 12
mmgen/proto/eth/tw/unspent.py

@@ -45,18 +45,11 @@ class EthereumTwUnspentOutputs(EthereumTwView,TwUnspentOutputs):
 	desc    = 'account balances'
 	item_desc = 'account'
 	dump_fn_pfx = 'balances'
-	prompt = """
-Sort options: [a]mount, a[d]dress, [r]everse, [M]mgen addr
+	prompt_fs = """
+Sort options: [a]mount, a[d]dr, [M]mgen addr, [r]everse
 Display options: show [m]mgen addr, r[e]draw screen
-View options: [q]uit view, [p]rint to file, [v]iew, [w]ide view
-Actions: [D]elete addr, add [l]abel, [R]efresh balance:
-"""
-	prompt_scroll = """
-Sort options: [a]mount, a[d]dress, [r]everse, [M]mgen addr
-Display options: show [m]mgen addr, r[e]draw screen
-View options: [q]uit view, [p]rint to file, [w]ide view
-Scrolling: k=up, j=down, b=pgup, f=pgdown, g=top, G=bottom
-Actions: [D]elete addr, add [l]abel, [R]efresh balance:
+View/Print: pager [v]iew, [w]ide pager view, [p]rint to file{s}
+Actions: [q]uit menu, [D]elete addr, add [l]abel, [R]efresh balance:
 """
 	key_mappings = {
 		'a':'s_amt',
@@ -121,7 +114,6 @@ Actions: [D]elete addr, add [l]abel, [R]efresh balance:
 
 class EthereumTokenTwUnspentOutputs(EthereumTwUnspentOutputs):
 
-	prompt_fs = 'Total to spend: {} {}\n\n'
 	has_amt2 = True
 
 	async def __init__(self,proto,*args,**kwargs):

+ 3 - 3
mmgen/tw/view.py

@@ -497,14 +497,14 @@ class TwView(MMGenObject,metaclass=AsyncInit):
 
 		def make_prompt(scroll):
 			if scroll:
-				del self.key_mappings['v']
 				for k in self.scroll_keys['vi']:
 					assert k not in self.key_mappings, f'{k!r} is in key_mappings'
 				self.key_mappings.update(self.scroll_keys['vi'])
 				self.key_mappings.update(self.scroll_keys[g.platform])
-				return self.prompt_scroll.strip()
+				s = '\nScrolling: k=up, j=down, b=pgup, f=pgdown, g=top, G=bottom'
 			else:
-				return self.prompt.strip()
+				s = ''
+			return self.prompt_fs.strip().format(s=s)
 
 		from ..term import get_term,get_char,get_char_raw
 

+ 1 - 1
test/test_py_d/ts_chainsplit.py

@@ -91,7 +91,7 @@ class TestSuiteChainsplit(TestSuiteRegtest):
 			'--outdir='+self.tmpdir,
 			'--tx-fees=0.0001,0.0003',
 			sid+':S:1',sid+':S:2'])
-		t.expect(r'\[q\]uit view, .*?:.','q', regex=True)
+		t.expect(r'\[q\]uit menu, .*?:.','q', regex=True)
 		t.expect('outputs to spend: ','1\n')
 
 		for tx in ('timelocked','split'):

+ 1 - 1
test/test_py_d/ts_regtest.py

@@ -1413,7 +1413,7 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
 		t.expect(r'add \[l\]abel:.','l',regex=True)
 		t.expect(r"Enter unspent.*return to main menu\):.",output+'\n',regex=True)
 		t.expect(r"Enter label text.*:.",comment+'\n',regex=True)
-		t.expect(r'\[q\]uit view, .*?:.','q',regex=True)
+		t.expect(r'\[q\]uit menu, .*?:.','q',regex=True)
 		return t
 
 	def _alice_listaddresses_interactive(self,expect=(),expect_menu=()):

+ 1 - 1
test/test_py_d/ts_shared.py

@@ -53,7 +53,7 @@ class TestSuiteShared(object):
 
 		txdo = (caller or self.test_name)[:4] == 'txdo'
 
-		expect_pat = r'\[q\]uit view, .*?:.'
+		expect_pat = r'\[q\]uit menu, .*?:.'
 		delete_pat = r'Enter account number .*:.'
 		confirm_pat = r'Is this what you want.*:.'