minor cleanups

This commit is contained in:
The MMGen Project 2024-03-10 14:43:33 +00:00
commit cd23bf20d4
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
8 changed files with 17 additions and 13 deletions

View file

@ -332,9 +332,9 @@ class MnemonicEntry:
i_add = ' (user-configured)'
else:
em = self.choose_entry_mode()
i_add = '.'
i_add = ''
msg('\r' + f'Using {cyan(em.name.upper())} entry mode{i_add}')
msg('\r' + f'Using entry mode {cyan(em.name.upper())}{i_add}')
self.em = em
if not self.usr_dfl_entry_mode:

View file

@ -27,7 +27,6 @@ class New(Base,TxBase.New):
fee_fail_fs = 'Network fee estimation failed'
no_chg_msg = 'Warning: Transaction leaves account with zero balance'
usr_fee_prompt = 'Enter transaction fee or gas price: '
hexdata_type = 'hex'
def __init__(self,*args,**kwargs):

View file

@ -23,7 +23,6 @@ from .completed import Completed,TokenCompleted
class Unsigned(Completed,TxBase.Unsigned):
desc = 'unsigned transaction'
hexdata_type = 'json'
def parse_txfile_serialized_data(self):
d = json.loads(self.serialized)

View file

@ -73,7 +73,10 @@ class wallet(wallet):
bc = baseconv('b6d')
self._print_seed_type()
seed_bitlen = self._choose_seedlen([ n*8 for n in sorted(bc.seedlen_map) ])
nDierolls = bc.seedlen_map[seed_bitlen // 8]
message = """

View file

@ -34,6 +34,8 @@ class wallet(wallet):
from ..ui import get_data_from_user
return get_data_from_user( self.cfg, desc )
self._print_seed_type()
mn_len = self._choose_seedlen(self.mn_lens)
from ..mn_entry import mn_entry

View file

@ -31,6 +31,12 @@ class wallet(wallet):
s.bitlen,
self.ext )
def _print_seed_type(self):
msg('{} {}'.format(
blue(f'{capfirst(self.base_type or self.type)} type:'),
yellow(self.mn_type)
))
def _choose_seedlen(self,ok_lens):
from ..term import get_char
@ -43,11 +49,6 @@ class wallet(wallet):
msg_r(('\r','\n')[self.cfg.test_suite] + ' '*len(prompt) + '\r')
return ok_lens[int(r)-1]
msg('{} {}'.format(
blue(f'{capfirst(self.base_type or self.type)} type:'),
yellow(self.mn_type)
))
while True:
usr_len = choose_len()
prompt = self.choose_seedlen_confirm.format(usr_len)

View file

@ -1049,7 +1049,7 @@ if __name__ == '__main__':
if cfg.pause:
set_restore_term_at_exit()
from mmgen.exception import TestSuiteException,TestSuiteFatalException,TestSuiteSpawnedScriptException
from mmgen.exception import TestSuiteSpawnedScriptException
try:
tr = CmdTestRunner(data_dir,trash_dir)
@ -1061,7 +1061,7 @@ if __name__ == '__main__':
if tr.daemon_started:
stop_test_daemons(network_id)
tr.warn_skipped()
die(1,'\ntest.py exiting at user request')
die(1,yellow('\ntest.py exiting at user request'))
except TestSuiteSpawnedScriptException as e:
# if spawned script is not running under exec_wrapper, output brief error msg:
if os.getenv('MMGEN_EXEC_WRAPPER'):

View file

@ -376,7 +376,7 @@ class CmdTestInput(CmdTestBase):
'Type a number.*: ',
('\n' if enter_for_dfl else str(mne.entry_modes.index(entry_mode)+1)),
regex = True )
t.expect('Using (.+) entry mode',regex=True)
t.expect('Using entry mode (\S+)',regex=True)
mode = strip_ansi_escapes(t.p.match.group(1)).lower()
assert mode == mne.em.name.lower(), f'{mode} != {mne.em.name.lower()}'
stealth_mnemonic_entry(t,mne,mn,entry_mode=entry_mode,pad_entry=pad_entry)
@ -402,7 +402,7 @@ class CmdTestInput(CmdTestBase):
from mmgen.mn_entry import mn_entry
mne = mn_entry( cfg, fmt, entry_mode )
t.expect('Type a number.*: ',str(mne.entry_modes.index(entry_mode)+1),regex=True)
t.expect('Using (.+) entry mode',regex=True)
t.expect('Using entry mode (\S+)',regex=True)
mode = strip_ansi_escapes(t.p.match.group(1)).lower()
assert mode == mne.em.name.lower(), f'{mode} != {mne.em.name.lower()}'
stealth_mnemonic_entry(t,mne,mn,entry_mode=entry_mode)