ux tweaks

This commit is contained in:
Peter D. Gray 2023-02-07 09:57:43 -05:00
parent 58717e1118
commit 0ea5e8b9e8
No known key found for this signature in database
GPG Key ID: F0E6CC6AFC16CF7B
6 changed files with 19 additions and 21 deletions

@ -1 +1 @@
Subproject commit 97d35f058f504a354fc6df79a8b3db5c91862501
Subproject commit abf88c98b6ee9897b6fcc8ffea0276f07447dd48

View File

@ -790,7 +790,7 @@ async def bsms_signer_round1(*a):
token_int = None
if not shortcut:
prompt = "Press (1) to import token file from SD Card, (2) to input token manually"
prompt += ", (3) for unencrypted BSMS."
prompt += ", (3) for unencrypted BSMS"
escape = "123"
if NFC is not None:
prompt += ", (4) to import via NFC"
@ -811,7 +811,7 @@ async def bsms_signer_round1(*a):
escape = "12"
ch = await ux_show_story(prompt, escape=escape)
if ch == "1":
token_hex = await ux_spinner_edit("", hex_only=True)
token_hex = await ux_spinner_edit("", hex_only=True, max_len=32)
elif ch == "2":
token_int = await ux_input_numbers("", lambda: True)
token_hex = hex(int(token_int))

View File

@ -3,10 +3,8 @@
# multisig.py - support code for multisig signing and p2sh in general.
#
import stash, chains, ustruct, ure, uio, sys, ngu, uos, ujson
from utils import (
xfp2str, str2xfp, swab32, cleanup_deriv_path, keypath_to_str, str_to_keypath, problem_file_line,
export_prompt_builder
)
from utils import xfp2str, str2xfp, swab32, cleanup_deriv_path, keypath_to_str
from utils import str_to_keypath, problem_file_line, export_prompt_builder
from ux import ux_show_story, ux_confirm, ux_dramatic_pause, ux_clear_keys, ux_enter_bip32_index
from files import CardSlot, CardMissingError, needs_microsd
from descriptor import MultisigDescriptor, multisig_descriptor_template
@ -98,7 +96,6 @@ def make_redeem_script(M, nodes, subkey_idx):
pubkeys.append(b'\x21' + copy.pubkey())
del copy
pubkeys.sort()
# serialize redeem script
@ -1177,7 +1174,7 @@ not be accepted by network.
This settings lasts only until power down.
Press (4) to confirm entering this DANGEROUS mode.
Press (4) to confirm entering this DANGEROUS mode.
''', escape='4')
if ch != '4': return

View File

@ -475,7 +475,7 @@ async def ux_input_numbers(val, validate_func):
if len(here) < 32:
here += ch
async def ux_spinner_edit(pw, confirm_exit=True, hex_only=False):
async def ux_spinner_edit(pw, confirm_exit=True, hex_only=False, max_len=100):
# Allow them to pick each digit using "D-pad"
from glob import dis
from display import FontTiny, FontSmall
@ -497,10 +497,12 @@ async def ux_spinner_edit(pw, confirm_exit=True, hex_only=False):
# assert len(set(symbols+letters+Letters+numbers)) == len(my_rng)
if hex_only:
footer1 = "hex mode"
footer1 = "Enter Hexidecimal Number"
footer2 = "58=Change 9=Next 7=Back"
else:
footer1 = "1=Letters 2=Numbers 3=Symbols"
footer2 = "4=SwapCase 0=HELP"
y = 20
pw = bytearray(pw or ('0' if hex_only else 'A'))
@ -538,8 +540,7 @@ async def ux_spinner_edit(pw, confirm_exit=True, hex_only=False):
# pre-render the fixed stuff
dis.clear()
dis.text(None, -10, footer1, FontTiny)
if not hex_only:
dis.text(None, -1, footer2, FontTiny)
dis.text(None, -1, footer2, FontTiny)
dis.save()
# no key-repeat on certain keys
@ -567,7 +568,7 @@ async def ux_spinner_edit(pw, confirm_exit=True, hex_only=False):
if ax == pos:
# draw cursor
if len(pw) < 2 * n_visible:
if not hex_only and (len(pw) < 2 * n_visible):
dis.text(x - 4, y - 19, '0x%02X' % ch, FontTiny)
dis.icon(x - 2, y - 10, 'spin')
@ -605,7 +606,7 @@ async def ux_spinner_edit(pw, confirm_exit=True, hex_only=False):
elif ch == '9': # right
pos += 1
if pos >= len(pw):
if len(pw) < 100 and pw[-3:] != b' ':
if len(pw) < max_len and pw[-3:] != b' ':
# expands with space in normal mode
# expands with 0 in hex_only mode
pw += new_expand

View File

@ -2,12 +2,12 @@
//
// AUTO-generated.
//
// built: 2022-11-14
// version: 5.0.8
// built: 2023-02-03
// version: 5.1.0
//
#include <stdint.h>
// this overrides ports/stm32/fatfs_port.c
uint32_t get_fattime(void) {
return 0x556e2800UL;
return 0x56432820UL;
}

View File

@ -2,12 +2,12 @@
//
// AUTO-generated.
//
// built: 2022-11-14
// version: 5.0.8
// built: 2023-02-02
// version: 5.1.0
//
#include <stdint.h>
// this overrides ports/stm32/fatfs_port.c
uint32_t get_fattime(void) {
return 0x556e2800UL;
return 0x56422820UL;
}