my_raw_input() -> line_input()
This commit is contained in:
parent
fb29994067
commit
1245dc1026
7 changed files with 23 additions and 23 deletions
|
|
@ -139,7 +139,7 @@ class EthereumMMGenTX:
|
|||
|
||||
def select_unspent(self,unspent):
|
||||
while True:
|
||||
reply = my_raw_input('Enter an account to spend from: ').strip()
|
||||
reply = line_input('Enter an account to spend from: ').strip()
|
||||
if reply:
|
||||
if not is_int(reply):
|
||||
msg('Account number must be an integer')
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ def _get_random_data_from_user(uchars,desc):
|
|||
if g.debug:
|
||||
msg(f'USER ENTROPY (user input + keystroke timings):\n{ret}')
|
||||
|
||||
my_raw_input('User random data successfully acquired. Press ENTER to continue: ')
|
||||
line_input('User random data successfully acquired. Press ENTER to continue: ')
|
||||
|
||||
return ret.encode()
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ def add_user_random(rand_bytes,desc):
|
|||
|
||||
def get_hash_preset_from_user(hp=g.dfl_hash_preset,desc='data'):
|
||||
while True:
|
||||
ret = my_raw_input(
|
||||
ret = line_input(
|
||||
f'Enter hash preset for {desc},\n' +
|
||||
f'or hit ENTER to accept the default value ({hp!r}): ' )
|
||||
if ret:
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ Actions: [q]uit view, [p]rint to file, pager [v]iew, [w]ide view, add [l]abel:
|
|||
self.cols = g.terminal_width or get_terminal_size().width
|
||||
if self.cols >= g.min_screen_width:
|
||||
break
|
||||
my_raw_input(
|
||||
line_input(
|
||||
'Screen too narrow to display the tracking wallet\n'
|
||||
+ f'Please resize your screen to at least {g.min_screen_width} characters and hit ENTER ' )
|
||||
|
||||
|
|
@ -405,7 +405,7 @@ Actions: [q]uit view, [p]rint to file, pager [v]iew, [w]ide view, add [l]abel:
|
|||
def get_idx_from_user(self,action):
|
||||
msg('')
|
||||
while True:
|
||||
ret = my_raw_input(f'Enter {self.item_desc} number (or RETURN to return to main menu): ')
|
||||
ret = line_input(f'Enter {self.item_desc} number (or RETURN to return to main menu): ')
|
||||
if ret == '': return (None,None) if action == 'a_lbl_add' else None
|
||||
n = get_obj(AddrIdx,n=ret,silent=True)
|
||||
if not n or n < 1 or n > len(self.unspent):
|
||||
|
|
@ -415,7 +415,7 @@ Actions: [q]uit view, [p]rint to file, pager [v]iew, [w]ide view, add [l]abel:
|
|||
cur_lbl = self.unspent[n-1].label
|
||||
msg('Current label: {}'.format(cur_lbl.hl() if cur_lbl else '(none)'))
|
||||
while True:
|
||||
s = my_raw_input("Enter label text (or 'q' to return to main menu): ")
|
||||
s = line_input("Enter label text (or 'q' to return to main menu): ")
|
||||
if s == 'q':
|
||||
return None,None
|
||||
elif s == '':
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ class MMGenTX:
|
|||
m = ('Add a comment to transaction?','Edit transaction comment?')[bool(self.label)]
|
||||
if keypress_confirm(m,default_yes=False):
|
||||
while True:
|
||||
s = MMGenTxLabel(my_raw_input('Comment: ',insert_txt=self.label))
|
||||
s = MMGenTxLabel(line_input('Comment: ',insert_txt=self.label))
|
||||
if not s:
|
||||
ymsg('Warning: comment is empty')
|
||||
lbl_save = self.label
|
||||
|
|
@ -656,7 +656,7 @@ class MMGenTX:
|
|||
if opt.yes:
|
||||
msg(prompt)
|
||||
return abs_fee
|
||||
tx_fee = my_raw_input(self.usr_fee_prompt)
|
||||
tx_fee = line_input(self.usr_fee_prompt)
|
||||
desc = 'User-selected'
|
||||
|
||||
async def get_fee_from_user(self,have_estimate_fail=[]):
|
||||
|
|
@ -751,7 +751,7 @@ class MMGenTX:
|
|||
def select_unspent(self,unspent):
|
||||
prompt = 'Enter a range or space-separated list of outputs to spend: '
|
||||
while True:
|
||||
reply = my_raw_input(prompt).strip()
|
||||
reply = line_input(prompt).strip()
|
||||
if reply:
|
||||
selected = get_obj(AddrIdxList, fmt_str=','.join(reply.split()) )
|
||||
if selected:
|
||||
|
|
@ -1553,7 +1553,7 @@ class MMGenTX:
|
|||
while True:
|
||||
if init_reply == None:
|
||||
m = 'Choose an output to deduct the fee from (Hit ENTER for the change output): '
|
||||
reply = my_raw_input(m) or 'c'
|
||||
reply = line_input(m) or 'c'
|
||||
else:
|
||||
reply,init_reply = init_reply,None
|
||||
if chg_idx == None and not is_int(reply):
|
||||
|
|
|
|||
|
|
@ -559,7 +559,7 @@ def confirm_or_raise(message,q,expect='YES',exit_msg='Exiting at user request'):
|
|||
msg(message.strip())
|
||||
a = f'{q} ' if q[0].isupper() else f'Are you sure you want to {q}?\n'
|
||||
b = f'Type uppercase {expect!r} to confirm: '
|
||||
if my_raw_input(a+b).strip() != expect:
|
||||
if line_input(a+b).strip() != expect:
|
||||
raise UserNonConfirmation(exit_msg)
|
||||
|
||||
def write_data_to_file( outfile,data,desc='data',
|
||||
|
|
@ -667,7 +667,7 @@ def write_data_to_file( outfile,data,desc='data',
|
|||
do_file(outfile,ask_write_prompt)
|
||||
|
||||
def get_words_from_user(prompt):
|
||||
words = my_raw_input(prompt, echo=opt.echo_passphrase).split()
|
||||
words = line_input(prompt, echo=opt.echo_passphrase).split()
|
||||
dmsg('Sanitized input: [{}]'.format(' '.join(words)))
|
||||
return words
|
||||
|
||||
|
|
@ -706,7 +706,7 @@ def get_lines_from_file(fn,desc='',trim_comments=False,quiet=False,silent=False)
|
|||
return ret
|
||||
|
||||
def get_data_from_user(desc='data'): # user input MUST be UTF-8
|
||||
data = my_raw_input(f'Enter {desc}: ',echo=opt.echo_passphrase)
|
||||
data = line_input(f'Enter {desc}: ',echo=opt.echo_passphrase)
|
||||
dmsg(f'User input: [{data}]')
|
||||
return data
|
||||
|
||||
|
|
@ -767,9 +767,9 @@ class pwfile_reuse_warning(oneshot_warning):
|
|||
def __init__(self,fn):
|
||||
oneshot_warning.__init__(self,div=fn,fmt_args=[fn],reverse=True)
|
||||
|
||||
def my_raw_input(prompt,echo=True,insert_txt=''):
|
||||
def line_input(prompt,echo=True,insert_txt=''):
|
||||
|
||||
assert prompt,'calling my_raw_input() with an empty prompt not allowed due to readline issues'
|
||||
assert prompt,'calling line_input() with an empty prompt not allowed due to readline issues'
|
||||
|
||||
def init_readline():
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ class WalletEnc(Wallet):
|
|||
('accept the default','reuse the old')[self.op=='pwchg_new'],
|
||||
hp )
|
||||
while True:
|
||||
ret = my_raw_input(prompt)
|
||||
ret = line_input(prompt)
|
||||
if ret:
|
||||
if ret in g.hash_presets:
|
||||
return ret
|
||||
|
|
@ -732,7 +732,7 @@ class MMGenWallet(WalletEnc):
|
|||
'to reuse the label {}'.format(old_lbl.hl(encl="''")) if old_lbl else
|
||||
'for no label' )
|
||||
while True:
|
||||
ret = my_raw_input(prompt)
|
||||
ret = line_input(prompt)
|
||||
if ret:
|
||||
lbl = get_obj(MMGenWalletLabel,s=ret)
|
||||
if lbl:
|
||||
|
|
@ -1180,7 +1180,7 @@ harder to find, you're advised to choose a much larger file size than this.
|
|||
min_fsize = d.target_data_len + d.hincog_offset
|
||||
msg(self.msg['choose_file_size'].format(min_fsize))
|
||||
while True:
|
||||
fsize = parse_bytespec(my_raw_input('Enter file size: '))
|
||||
fsize = parse_bytespec(line_input('Enter file size: '))
|
||||
if fsize >= min_fsize:
|
||||
break
|
||||
msg(f'File size must be an integer no less than {min_fsize}')
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ def tt_license():
|
|||
ymsg('Press "w" to test the pager, then "c" to continue')
|
||||
do_license_msg()
|
||||
|
||||
def tt_my_raw_input():
|
||||
cmsg('Testing my_raw_input():')
|
||||
def tt_line_input():
|
||||
cmsg('Testing line_input():')
|
||||
msg(fmt("""
|
||||
At the Ready? prompt type and hold down "y".
|
||||
Then Enter some text, followed by held-down ENTER.
|
||||
|
|
@ -64,7 +64,7 @@ def tt_my_raw_input():
|
|||
on screen or entered text.
|
||||
"""))
|
||||
get_char_raw('Ready? ',num_chars=1)
|
||||
reply = my_raw_input('\nEnter text: ')
|
||||
reply = line_input('\nEnter text: ')
|
||||
confirm(f'Did you enter the text {reply!r}?')
|
||||
|
||||
def tt_get_char(raw=False,one_char=False,sleep=0,immed_chars=''):
|
||||
|
|
@ -128,7 +128,7 @@ def tt_urand():
|
|||
ymsg(f'WARNING: Avg. time precision of only {avg_prec} decimal points. User entropy quality is degraded!')
|
||||
else:
|
||||
msg(f'Average time precision: {avg_prec} decimal points - OK')
|
||||
my_raw_input('Press ENTER to continue: ')
|
||||
line_input('Press ENTER to continue: ')
|
||||
|
||||
def tt_txview():
|
||||
cmsg('Testing tx.view_with_prompt() (try each viewing option)')
|
||||
|
|
@ -151,7 +151,7 @@ tt_start()
|
|||
tt_get_terminal_size()
|
||||
tt_color()
|
||||
tt_license()
|
||||
tt_my_raw_input()
|
||||
tt_line_input()
|
||||
tt_urand()
|
||||
tt_txview()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue