How to use the trezor.ui.display.text function in trezor

To help you get started, we’ve selected a few trezor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trezor / trezor-firmware / src / apps / seed / layout_seed.py View on Github external
def layout_seed(initialize_msg=None):
	# header title
    ui.display.text(10, 30, 'Write down your seed', ui.BOLD, ui.LIGHT_GREEN, ui.BLACK)

    ui.display.text(10, 74, '1.', ui.BOLD, ui.LIGHT_GREEN, ui.BLACK)
    ui.display.text(30, 74, 'auto', ui.BOLD, ui.WHITE, ui.BLACK)

    ui.display.text(10, 104, '2.', ui.BOLD, ui.LIGHT_GREEN, ui.BLACK)
    ui.display.text(30, 104, 'model', ui.BOLD, ui.WHITE, ui.BLACK)

    ui.display.text(10, 134, '3.', ui.BOLD, ui.LIGHT_GREEN, ui.BLACK)
    ui.display.text(30, 134, 'rifle', ui.BOLD, ui.WHITE, ui.BLACK)

    ui.display.text(10, 164, '4.', ui.BOLD, ui.LIGHT_GREEN, ui.BLACK)
    ui.display.text(30, 164, 'digital', ui.BOLD, ui.WHITE, ui.BLACK)

    yield loop.Wait([dispatcher.dispatch(),
                     swipe_to_rotate(),
                     animate_logo()])
github trezor / trezor-firmware / assets / ui-mockup / install_fw.py View on Github external
def fingerprint():
    ui.display.bar(0, 60, 240, 128, ui.BLACK)
    ui.display.text(10, 76, 'Fingerprint:', ui.BOLD, ui.GREY, ui.BLACK)
    ui.display.bar(10, 82, 220, 102, ui.DARK_GREY)
    s = 105
    ui.display.text(15, s, '5764715dbcf8ed88', ui.MONO, ui.GREY, ui.DARK_GREY)
    ui.display.text(15, s + 1 * 23, 'bc0ae1c2f715277f', ui.MONO, ui.GREY, ui.DARK_GREY)
    ui.display.text(15, s + 2 * 23, '22b67f26c15e1f75', ui.MONO, ui.GREY, ui.DARK_GREY)
    ui.display.text(15, s + 3 * 23, '43b2b44913b5c255', ui.MONO, ui.GREY, ui.DARK_GREY)
github trezor / trezor-firmware / src / playground / __init__.py View on Github external
def func(foreground):
        ui.display.text(68, 212, 'TAP TO CONFIRM', 2, foreground, _background)

        f.seek(0)
        ui.display.icon(3, 170, f.read(), _background, foreground)
github trezor / trezor-core / src / trezor / ui / text.py View on Github external
splitw = DASH
            else:
                split = "..."
                splitw = ELLIPSIS
            # find span that fits
            for index in range(len(word) - 1, 0, -1):
                letter = word[index]
                width -= ui.display.text_width(letter, font)
                if offset_x + width + splitw < OFFSET_X_MAX:
                    break
            else:
                index = 0
            span = word[:index]
            # render word span
            ui.display.text(offset_x, offset_y, span, font, fg, bg)
            ui.display.text(offset_x + width, offset_y, split, ui.BOLD, ui.GREY, bg)
            # line break
            if offset_y >= OFFSET_Y_MAX:
                return
            offset_x = TEXT_MARGIN_LEFT
            offset_y += TEXT_LINE_HEIGHT
            # continue with the rest
            word = word[index:]
            width = ui.display.text_width(word, font)

        # render word
        ui.display.text(offset_x, offset_y, word, font, fg, bg)

        if new_lines and has_next_word:
            # line break
            if offset_y >= OFFSET_Y_MAX:
                ui.display.text(offset_x, offset_y, "...", ui.BOLD, ui.GREY, bg)
github trezor / trezor-firmware / assets / ui-mockup / boot_unsigned.py View on Github external
# background frame
ui.display.bar(0, 10, 240, 240 - 50, ui.LIGHT_RED)
ui.display.bar(3, 3, 234, 240 - 54, ui.BLACK)

# header
bl_header('Unsigned firmware!')

# content
ui.display.text(10, 60, 'Fingeprint', ui.NORMAL, ui.WHITE, ui.BLACK)

# fingerprint box
ui.display.bar(10, 76, 220, 105, ui.DARK_GREY)
s = 103
ui.display.text(15, s, '5764715dbcf8ed88', ui.MONO, ui.GREY, ui.DARK_GREY)
ui.display.text(15, s + 1 * 23, 'bc0ae1c2f715277f', ui.MONO, ui.GREY, ui.DARK_GREY)
ui.display.text(15, s + 2 * 23, '22b67f26c15e1f75', ui.MONO, ui.GREY, ui.DARK_GREY)
ui.display.text(15, s + 3 * 23, '43b2b44913b5c255', ui.MONO, ui.GREY, ui.DARK_GREY)

cancel = button.Button((0, 240 - 48, 240, 48), 'Proceed anyway', normal_style=button.CANCEL_BUTTON, active_style=button.CANCEL_BUTTON_ACTIVE)
cancel.render()

while True:
    ui.display.refresh()
github trezor / trezor-firmware / assets / ui-mockup / boot_unsigned.py View on Github external
ui.display.backlight(255)

# background frame
ui.display.bar(0, 10, 240, 240 - 50, ui.LIGHT_RED)
ui.display.bar(3, 3, 234, 240 - 54, ui.BLACK)

# header
bl_header('Unsigned firmware!')

# content
ui.display.text(10, 60, 'Fingeprint', ui.NORMAL, ui.WHITE, ui.BLACK)

# fingerprint box
ui.display.bar(10, 76, 220, 105, ui.DARK_GREY)
s = 103
ui.display.text(15, s, '5764715dbcf8ed88', ui.MONO, ui.GREY, ui.DARK_GREY)
ui.display.text(15, s + 1 * 23, 'bc0ae1c2f715277f', ui.MONO, ui.GREY, ui.DARK_GREY)
ui.display.text(15, s + 2 * 23, '22b67f26c15e1f75', ui.MONO, ui.GREY, ui.DARK_GREY)
ui.display.text(15, s + 3 * 23, '43b2b44913b5c255', ui.MONO, ui.GREY, ui.DARK_GREY)

cancel = button.Button((0, 240 - 48, 240, 48), 'Proceed anyway', normal_style=button.CANCEL_BUTTON, active_style=button.CANCEL_BUTTON_ACTIVE)
cancel.render()

while True:
    ui.display.refresh()
github trezor / trezor-core / src / trezor / ui / mnemonic.py View on Github external
def render(self):
        if self.input.content:
            # content button and backspace
            self.input.render()
            self.back.render()
        else:
            # prompt
            display.bar(0, 8, ui.WIDTH, 60, ui.BG)
            display.text(20, 40, self.prompt, ui.BOLD, ui.GREY, ui.BG)
        # key buttons
        for btn in self.keys:
            btn.render()
github trezor / trezor-firmware / core / src / apps / management / reset_device / layout.py View on Github external
12, 156, second_line_text, ui.NORMAL, ui.FG, ui.BG, ui.WIDTH - 12
                )
            elif self.step is Slip39NumInput.SET_THRESHOLD:
                if self.group_id is None:
                    first_line_text = "For recovery you need"
                    if count == 1:
                        second_line_text = "1 share."
                    elif count == self.input.max_count:
                        second_line_text = "all %s of the shares." % count
                    else:
                        second_line_text = "any %s of the shares." % count
                else:
                    first_line_text = "The required number of "
                    second_line_text = "shares to form Group %s." % (self.group_id + 1)
                ui.display.text(12, 130, first_line_text, ui.NORMAL, ui.FG, ui.BG)
                ui.display.text(
                    12, 156, second_line_text, ui.NORMAL, ui.FG, ui.BG, ui.WIDTH - 12
                )
            elif self.step is Slip39NumInput.SET_GROUPS:
                ui.display.text(
                    12, 130, "A group is made up of", ui.NORMAL, ui.FG, ui.BG
                )
                ui.display.text(
                    12, 156, "recovery shares.", ui.NORMAL, ui.FG, ui.BG, ui.WIDTH - 12
                )
            elif self.step is Slip39NumInput.SET_GROUP_THRESHOLD:
                ui.display.text(
                    12, 130, "The required number of", ui.NORMAL, ui.FG, ui.BG
                )
                ui.display.text(
                    12,
                    156,
github trezor / trezor-firmware / assets / ui-mockup / install_fail.py View on Github external
from trezor.ui import button
from bl_common import bl_header

ui.display.clear()
ui.display.backlight(255)

# background frame
ui.display.bar(0, 10, 240, 240 - 50, ui.LIGHT_RED)
ui.display.bar(3, 3, 234, 240 - 54, ui.BLACK)

# header
bl_header('Install failed')

# content
ui.display.text(10, 53, 'Some error happend', ui.NORMAL, ui.WHITE, ui.BLACK)
ui.display.text(10, 79, 'Sorry, try again maybe?', ui.NORMAL, ui.WHITE, ui.BLACK)

reboot = button.Button((0, 240 - 48, 240, 48), 'Reboot', normal_style=button.DEFAULT_BUTTON, active_style=button.DEFAULT_BUTTON_ACTIVE)
reboot.render()

while True:
    ui.display.refresh()
github trezor / trezor-firmware / assets / ui-mockup / install_ok.py View on Github external
import sys
sys.path.append('../../src')

from trezor import ui
from trezor.ui import button
from bl_common import bl_header

ui.display.clear()
ui.display.backlight(255)

# header
bl_header('Install done')

# content
# content
ui.display.text(10, 53, 'Success!', ui.NORMAL, ui.WHITE, ui.BLACK)
ui.display.text(10, 79, 'Time to reboot', ui.NORMAL, ui.WHITE, ui.BLACK)

reboot = button.Button((0, 240 - 48, 240, 48), 'Reboot', normal_style=button.DEFAULT_BUTTON, active_style=button.DEFAULT_BUTTON_ACTIVE)
reboot.render()

while True:
    ui.display.refresh()