async def request_wordcount(ctx, title: str) -> int: await ctx.call(ButtonRequest(code=MnemonicWordCount), ButtonAck) text = Text(title, ui.ICON_RECOVERY) text.normal("Number of words?") if __debug__: count = await ctx.wait(WordSelector(text), input_signal) count = int(count) # if input_signal was triggered, count is a string else: count = await ctx.wait(WordSelector(text)) return count
async def request_word_count(ctx: wire.Context, dry_run: bool) -> int: await ctx.call(ButtonRequest(code=ButtonRequestType.MnemonicWordCount), ButtonAck) if dry_run: text = Text("Seed check", ui.ICON_RECOVERY) else: text = Text("Recovery mode", ui.ICON_RECOVERY) text.normal("Number of words?") if __debug__: count = await ctx.wait(WordSelector(text), input_signal()) count = int(count) # if input_signal was triggered, count is a string else: count = await ctx.wait(WordSelector(text)) return count
async def request_wordcount(ctx): await ctx.call(ButtonRequest(code=MnemonicWordCount), ButtonAck) text = Text("Device recovery", ui.ICON_RECOVERY) text.normal("Number of words?") count = await ctx.wait(WordSelector(text)) return count
async def request_wordcount(ctx, title: str) -> int: await ctx.call(ButtonRequest(code=MnemonicWordCount), ButtonAck) text = Text(title, ui.ICON_RECOVERY) text.normal("Number of words?") count = await ctx.wait(WordSelector(text)) return count
async def request_wordcount(ctx): await ctx.call(ButtonRequest(code=MnemonicWordCount), ButtonAck) content = Text('Device recovery', ui.ICON_RECOVERY, 'Number of words?') select = WordSelector(content) count = await select return count
async def request_words(ctx, content, code=None, *args, **kwargs): from trezor.ui.word_select import WordSelector from trezor.messages.ButtonRequest import ButtonRequest from trezor.messages.ButtonRequestType import Other from trezor.messages.wire_types import ButtonAck ui.display.clear() dialog = WordSelector(content, *args, **kwargs) dialog.render() if code is None: code = Other await ctx.call(ButtonRequest(code=code), ButtonAck) if __debug__: waiter = loop.wait(signal, dialog) else: waiter = dialog return await waiter
async def request_word_count(ctx: wire.GenericContext, dry_run: bool) -> int: await button_request(ctx, code=ButtonRequestType.MnemonicWordCount) if dry_run: text = Text("Seed check", ui.ICON_RECOVERY) else: text = Text("Recovery mode", ui.ICON_RECOVERY) text.normal("Number of words?") count = await ctx.wait(WordSelector(text)) # WordSelector can return int, or string if the value came from debuglink # ctx.wait has a return type Any # Hence, it is easier to convert the returned value to int explicitly return int(count)