From 28251369d12606fd3202ec55a59b7b5ffa1c4f38 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 11 Dec 2022 12:12:06 +0000 Subject: [PATCH] tw.view: prompt -> prompt_fs --- mmgen/proto/btc/tw/addresses.py | 13 +++---------- mmgen/proto/btc/tw/prune.py | 9 ++++----- mmgen/proto/btc/tw/txhistory.py | 17 +++++------------ mmgen/proto/btc/tw/unspent.py | 17 +++++------------ mmgen/proto/eth/tw/addresses.py | 15 ++++----------- mmgen/proto/eth/tw/unspent.py | 16 ++++------------ mmgen/tw/view.py | 6 +++--- test/test_py_d/ts_chainsplit.py | 2 +- test/test_py_d/ts_regtest.py | 2 +- test/test_py_d/ts_shared.py | 2 +- 10 files changed, 31 insertions(+), 68 deletions(-) diff --git a/mmgen/proto/btc/tw/addresses.py b/mmgen/proto/btc/tw/addresses.py index a08c0a0b..c8dc1209 100755 --- a/mmgen/proto/btc/tw/addresses.py +++ b/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', diff --git a/mmgen/proto/btc/tw/prune.py b/mmgen/proto/btc/tw/prune.py index 2fdd4eaf..78bb054e 100755 --- a/mmgen/proto/btc/tw/prune.py +++ b/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', diff --git a/mmgen/proto/btc/tw/txhistory.py b/mmgen/proto/btc/tw/txhistory.py index 03ec1ec7..653fb8d0 100755 --- a/mmgen/proto/btc/tw/txhistory.py +++ b/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', diff --git a/mmgen/proto/btc/tw/unspent.py b/mmgen/proto/btc/tw/unspent.py index 7ddf93d7..1a03cb2e 100755 --- a/mmgen/proto/btc/tw/unspent.py +++ b/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', diff --git a/mmgen/proto/eth/tw/addresses.py b/mmgen/proto/eth/tw/addresses.py index 15a72973..e3f6c002 100755 --- a/mmgen/proto/eth/tw/addresses.py +++ b/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', diff --git a/mmgen/proto/eth/tw/unspent.py b/mmgen/proto/eth/tw/unspent.py index 2e1aff59..7a0316a1 100755 --- a/mmgen/proto/eth/tw/unspent.py +++ b/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): diff --git a/mmgen/tw/view.py b/mmgen/tw/view.py index 5084df2a..aa3c67ff 100755 --- a/mmgen/tw/view.py +++ b/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 diff --git a/test/test_py_d/ts_chainsplit.py b/test/test_py_d/ts_chainsplit.py index 28ae367b..cdb15a68 100755 --- a/test/test_py_d/ts_chainsplit.py +++ b/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'): diff --git a/test/test_py_d/ts_regtest.py b/test/test_py_d/ts_regtest.py index c3a2dcd2..c3d3e815 100755 --- a/test/test_py_d/ts_regtest.py +++ b/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=()): diff --git a/test/test_py_d/ts_shared.py b/test/test_py_d/ts_shared.py index 8e40cd24..07a02418 100755 --- a/test/test_py_d/ts_shared.py +++ b/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.*:.'