Exemplo n.º 1
0
async def _show_page(page: int, page_count: int, content):
    content = Scrollpage(content[page], page, page_count)
    if page + 1 == page_count:
        await ConfirmDialog(content)
    else:
        content.render()
        await animate_swipe()
Exemplo n.º 2
0
async def _show_page(page: int, page_count: int, content):
    content = Scrollpage(content[page], page, page_count)
    if page + 1 == page_count:
        if await ConfirmDialog(content) != CONFIRMED:
            raise wire.ActionCancelled("Action cancelled")
    else:
        content.render()
        await animate_swipe()
Exemplo n.º 3
0
    async def page_renderer(page: int, page_count: int, pages: list):
        # for some reason page index can be equal to page count
        if page >= page_count:
            page = page_count - 1

        content = Scrollpage(pages[page], page, page_count)
        if page + 1 >= page_count:
            return await confirmation_wrapper(content)
        else:
            content.render()
            await animate_swipe()
Exemplo n.º 4
0
async def show_proposal_page(page: int, page_count: int, pages: list, title: str):
    text = Text(title, ui.ICON_SEND, icon_color=ui.PURPLE)
    text.bold("Proposal {}: ".format(page + 1))
    text.mono(*split_proposal(pages[page]))
    content = Scrollpage(text, page, page_count)

    if page + 1 >= page_count:
        confirm = await ConfirmDialog(content)
        if confirm == CANCELLED:
            raise wire.ActionCancelled("Cancelled")
    else:
        content.render()
        await animate_swipe()
Exemplo n.º 5
0
async def show_mnemonic_page(page: int, page_count: int, pages: list):
    if __debug__:
        debug.reset_current_words = [word for _, word in pages[page]]

    lines = ["%2d. %s" % (wi + 1, word) for wi, word in pages[page]]
    text = Text("Recovery seed", ui.ICON_RESET)
    text.mono(*lines)
    content = Scrollpage(text, page, page_count)

    if page + 1 == page_count:
        await HoldToConfirmDialog(content)
    else:
        content.render()
        await animate_swipe()
Exemplo n.º 6
0
async def show_voter_page(page: int, page_count: int, pages: list):
    lines = [
        "{:2d}. {}".format(wi + 1, helpers.eos_name_to_string(producer))
        for wi, producer in pages[page]
    ]
    text = Text("Vote for producers", ui.ICON_CONFIRM, icon_color=ui.GREEN)
    text.mono(*lines)
    content = Scrollpage(text, page, page_count)

    if page + 1 == page_count:
        if await ConfirmDialog(content) != CONFIRMED:
            raise wire.ActionCancelled("Action cancelled")
    else:
        content.render()
        await animate_swipe()
Exemplo n.º 7
0
async def show_lines_page(page: int, page_count: int, pages: list,
                          header: str):
    if header == "Arbitrary data":
        text = Text(header, ui.ICON_WIPE, icon_color=ui.RED)
    else:
        text = Text(header, ui.ICON_CONFIRM, icon_color=ui.GREEN)
    text.mono(*pages[page])

    content = Scrollpage(text, page, page_count)
    if page + 1 == page_count:
        if await ConfirmDialog(content) != CONFIRMED:
            raise wire.ActionCancelled("Action cancelled")
    else:
        content.render()
        await animate_swipe()
Exemplo n.º 8
0
async def show_mnemonic_page(page, page_count, mnemonic):
    from trezor.ui.button import Button
    from trezor.ui.text import Text
    from trezor.ui.scroll import Scrollpage, animate_swipe

    lines = ['%d. %s' % (wi + 1, word) for wi, word in mnemonic[page]]
    scroll_page = Scrollpage(
        Text('Recovery seed setup', ui.ICON_RESET, ui.MONO, lines), page,
        page_count)
    ui.display.clear()
    scroll_page.render()

    if page + 1 == page_count:
        await Button(ui.grid(4, n_x=1),
                     "I'm done",
                     normal_style=ui.BTN_CONFIRM,
                     active_style=ui.BTN_CONFIRM_ACTIVE)
        ui.display.clear()
    else:
        await animate_swipe()