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

        # 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
        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)

        self.repaint = False
Exemplo n.º 2
0
    def on_render(self):
        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
Exemplo n.º 3
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)