1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-26 22:32:33 +00:00

fix(core): imports needed for T1 startup

Now debug build booted on wiped T1 connects to USB and shows square in
top right corner.
This commit is contained in:
Martin Milata 2021-05-17 15:25:14 +02:00
parent 0c46b79ebf
commit c54077a714
3 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1 @@
Import errors on T1 startup.

View File

@ -4,8 +4,6 @@ import storage.cache
import storage.sd_salt import storage.sd_salt
from trezor import config, ui, wire from trezor import config, ui, wire
from trezor.messages import ButtonRequestType from trezor.messages import ButtonRequestType
from trezor.ui.components.tt.pin import CANCELLED, PinDialog
from trezor.ui.components.tt.text import Text
from trezor.ui.popup import Popup from trezor.ui.popup import Popup
from . import button_request from . import button_request
@ -26,6 +24,8 @@ async def request_pin(
attempts_remaining: int | None = None, attempts_remaining: int | None = None,
allow_cancel: bool = True, allow_cancel: bool = True,
) -> str: ) -> str:
from trezor.ui.components.tt.pin import CANCELLED, PinDialog
await button_request(ctx, code=ButtonRequestType.PinEntry) await button_request(ctx, code=ButtonRequestType.PinEntry)
if attempts_remaining is None: if attempts_remaining is None:
@ -55,6 +55,8 @@ async def request_pin_confirm(ctx: wire.Context, *args: Any, **kwargs: Any) -> s
async def pin_mismatch() -> None: async def pin_mismatch() -> None:
from trezor.ui.components.tt.text import Text
text = Text("PIN mismatch", ui.ICON_WRONG, ui.RED) text = Text("PIN mismatch", ui.ICON_WRONG, ui.RED)
text.normal("The PINs you entered", "do not match.") text.normal("The PINs you entered", "do not match.")
text.normal("") text.normal("")

View File

@ -0,0 +1,44 @@
from trezor import ui, wire
from trezor.messages import ButtonRequestType
if False:
from typing import NoReturn, Type, Union
from trezor.messages.ButtonRequest import EnumTypeButtonRequestType
ExceptionType = Union[BaseException, Type[BaseException]]
async def confirm_action(
ctx: wire.GenericContext,
br_type: str,
title: str,
action: str | None = None,
description: str | None = None,
description_param: str | None = None,
description_param_font: int = ui.BOLD,
verb: str | bytes | None = "OK",
verb_cancel: str | bytes | None = "X",
hold: bool = False,
hold_danger: bool = False,
icon: str | None = None,
icon_color: int | None = None,
reverse: bool = False,
larger_vspace: bool = False,
exc: ExceptionType = wire.ActionCancelled,
br_code: EnumTypeButtonRequestType = ButtonRequestType.Other,
) -> None:
raise NotImplementedError
async def show_error_and_raise(
ctx: wire.GenericContext,
br_type: str,
content: str,
header: str = "Error",
subheader: str | None = None,
button: str = "Close",
red: bool = False,
exc: ExceptionType = wire.ActionCancelled,
) -> NoReturn:
raise NotImplementedError