Mk4: export descriptor as simple QR

(cherry picked from commit 85b478346b)
This commit is contained in:
scgbckbone 2024-09-23 19:29:35 +02:00
parent aa154e1d8c
commit 2c7b10e6a2
4 changed files with 10 additions and 9 deletions

View File

@ -17,8 +17,7 @@ This lists the new changes that have not yet been published in a normal release.
## 5.4.1 - 2024-??-??
- tbd
- Enhancement: Export single sig descriptor with simple QR
# Q Specific Changes

View File

@ -134,14 +134,15 @@ be needed for different systems.
yield fp.getvalue()
del fp
async def write_text_file(fname_pattern, body, title, derive, addr_fmt):
async def write_text_file(fname_pattern, body, title, derive, addr_fmt,
force_prompt=False):
# Export data as a text file.
from glob import dis, NFC
from files import CardSlot, CardMissingError, needs_microsd
from ux import import_export_prompt
choice = await import_export_prompt("%s file" % title, is_import=False,
no_qr=(not version.has_qwerty))
force_prompt=force_prompt) # QR offered also on Mk4
if choice == KEY_CANCEL:
return
elif choice == KEY_QR:
@ -590,7 +591,8 @@ async def make_descriptor_wallet_export(addr_type, account_num=0, mode=None, int
)
dis.progress_bar_show(1)
await write_text_file(fname_pattern, body, "Descriptor", derive + "/0/0", addr_type)
await write_text_file(fname_pattern, body, "Descriptor", derive + "/0/0",
addr_type, force_prompt=True)
# EOF

View File

@ -456,7 +456,7 @@ def import_export_prompt_decode(ch):
async def import_export_prompt(what_it_is, is_import=False, no_qr=False,
no_nfc=False, title=None, intro='', footnotes='',
slot_b_only=False):
slot_b_only=False, force_prompt=False):
# Show story allowing user to select source for importing/exporting
# - return either str(mode) OR dict(file_args)
# - KEY_NFC or KEY_QR for those sources
@ -466,7 +466,8 @@ async def import_export_prompt(what_it_is, is_import=False, no_qr=False,
if is_import:
prompt, escape = _import_prompt_builder(what_it_is, no_qr, no_nfc, slot_b_only)
else:
prompt, escape = export_prompt_builder(what_it_is, no_qr, no_nfc)
prompt, escape = export_prompt_builder(what_it_is, no_qr, no_nfc,
force_prompt=force_prompt)
# TODO: detect if we're only asking A or B, when just one card is inserted
# - assume that's what they want to do

View File

@ -639,8 +639,7 @@ def test_export_xpub(use_nfc, acct_num, dev, cap_menu, pick_menu_item, goto_home
def test_generic_descriptor_export(chain, addr_fmt, acct_num, goto_home,
settings_set, need_keypress, expect_acctnum_captured, OK,
pick_menu_item, way, cap_story, cap_menu, int_ext, settings_get,
virtdisk_path, load_export, press_select, skip_if_useless_way):
skip_if_useless_way(way)
virtdisk_path, load_export, press_select):
settings_set('chain', chain)
chain_num = 1 if chain in ["XTN", "XRT"] else 0