Ejemplo n.º 1
0
    def on_render(self) -> None:
        if not self.repaint:
            return

        if self.dry_run:
            heading = "SEED CHECK"
        else:
            heading = "RECOVERY MODE"
        ui.header_warning(heading, clear=False)

        if not self.subtext:
            ui.display.text_center(ui.WIDTH // 2, 80, self.text, ui.BOLD, ui.FG, ui.BG)
        else:
            ui.display.text_center(ui.WIDTH // 2, 65, self.text, ui.BOLD, ui.FG, ui.BG)
            ui.display.text_center(
                ui.WIDTH // 2, 92, self.subtext, ui.NORMAL, ui.FG, ui.BG
            )

        ui.display.text_center(
            ui.WIDTH // 2, 130, "It is safe to eject Trezor", ui.NORMAL, ui.GREY, ui.BG
        )
        ui.display.text_center(
            ui.WIDTH // 2, 155, "and continue later", ui.NORMAL, ui.GREY, ui.BG
        )

        self.repaint = False
Ejemplo n.º 2
0
    def on_render(self) -> None:
        if not self.repaint:
            return

        image = None
        if not storage.is_initialized():
            label = "Go to trezor.io/start"
        else:
            label = storage_device.get_label() or "My Trezor"
            image = storage_device.get_homescreen()

        if not image:
            image = res.load("apps/homescreen/res/bg.toif")

        if storage.is_initialized() and storage_device.no_backup():
            ui.header_error("SEEDLESS")
        elif storage.is_initialized() and storage_device.unfinished_backup():
            ui.header_error("BACKUP FAILED!")
        elif storage.is_initialized() and storage_device.needs_backup():
            ui.header_warning("NEEDS BACKUP!")
        elif storage.is_initialized() and not config.has_pin():
            ui.header_warning("PIN NOT SET!")
        else:
            ui.display.bar(0, 0, ui.WIDTH, ui.HEIGHT, ui.BG)
        ui.display.avatar(48, 48 - 10, image, ui.WHITE, ui.BLACK)
        ui.display.text_center(ui.WIDTH // 2, 220, label, ui.BOLD, ui.FG,
                               ui.BG)

        self.repaint = False
Ejemplo n.º 3
0
    def on_render(self) -> None:
        # warning bar on top
        if storage.is_initialized() and storage.device.no_backup():
            ui.header_error("SEEDLESS")
        elif storage.is_initialized() and storage.device.unfinished_backup():
            ui.header_error("BACKUP FAILED!")
        elif storage.is_initialized() and storage.device.needs_backup():
            ui.header_warning("NEEDS BACKUP!")
        elif storage.is_initialized() and not config.has_pin():
            ui.header_warning("PIN NOT SET!")
        else:
            ui.display.bar(0, 0, ui.WIDTH, ui.HEIGHT, ui.BG)

        # homescreen with shifted avatar and text on bottom
        ui.display.avatar(48, 48 - 10, self.image, ui.WHITE, ui.BLACK)
        ui.display.text_center(ui.WIDTH // 2, 220, self.label, ui.BOLD, ui.FG, ui.BG)
Ejemplo n.º 4
0
    def do_render(self) -> None:
        # warning bar on top
        if storage.device.is_initialized() and storage.device.no_backup():
            ui.header_error("SEEDLESS")
        elif storage.device.is_initialized(
        ) and storage.device.unfinished_backup():
            ui.header_error("BACKUP FAILED!")
        elif storage.device.is_initialized() and storage.device.needs_backup():
            ui.header_warning("NEEDS BACKUP!")
        elif storage.device.is_initialized() and not config.has_pin():
            ui.header_warning("PIN NOT SET!")
        elif storage.device.get_experimental_features():
            ui.header_warning("EXPERIMENTAL MODE!")
        else:
            ui.display.bar(0, 0, ui.WIDTH, ui.HEIGHT, ui.BG)

        # homescreen with shifted avatar and text on bottom
        # Differs for each model

        # TODO: support homescreen avatar change for R and 1
        if utils.MODEL in ("T", ):
            ui.display.avatar(48, 48 - 10, self.get_image(), ui.WHITE,
                              ui.BLACK)
        elif utils.MODEL in ("R", ):
            icon = "trezor/res/homescreen_model_r.toif"  # 92x92 px
            ui.display.icon(18, 18, ui.res.load(icon), ui.style.FG,
                            ui.style.BG)
        elif utils.MODEL in ("1", ):
            icon = "trezor/res/homescreen_model_1.toif"  # 64x36 px
            ui.display.icon(33, 14, ui.res.load(icon), ui.style.FG,
                            ui.style.BG)

        label_heights = {"1": 60, "R": 120, "T": 220}
        ui.display.text_center(ui.WIDTH // 2, label_heights[utils.MODEL],
                               self.label, ui.BOLD, ui.FG, ui.BG)