mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-09 16:18:10 +00:00
docs(core): add method signatures for LayoutObj to mocks (fixes #2672)
This commit is contained in:
parent
1ed366b743
commit
dc9a735393
@ -8,7 +8,7 @@ static void _librust_qstrs(void) {
|
|||||||
MP_QSTR_CANCELLED;
|
MP_QSTR_CANCELLED;
|
||||||
MP_QSTR_CONFIRMED;
|
MP_QSTR_CONFIRMED;
|
||||||
MP_QSTR_INFO;
|
MP_QSTR_INFO;
|
||||||
MP_QSTR_Layout;
|
MP_QSTR_LayoutObj;
|
||||||
MP_QSTR_MESSAGE_NAME;
|
MP_QSTR_MESSAGE_NAME;
|
||||||
MP_QSTR_MESSAGE_WIRE_TYPE;
|
MP_QSTR_MESSAGE_WIRE_TYPE;
|
||||||
MP_QSTR_Msg;
|
MP_QSTR_Msg;
|
||||||
|
@ -238,7 +238,7 @@ impl LayoutObj {
|
|||||||
|
|
||||||
fn obj_type() -> &'static Type {
|
fn obj_type() -> &'static Type {
|
||||||
static TYPE: Type = obj_type! {
|
static TYPE: Type = obj_type! {
|
||||||
name: Qstr::MP_QSTR_Layout,
|
name: Qstr::MP_QSTR_LayoutObj,
|
||||||
locals: &obj_dict!(obj_map! {
|
locals: &obj_dict!(obj_map! {
|
||||||
Qstr::MP_QSTR_attach_timer_fn => obj_fn_2!(ui_layout_attach_timer_fn).as_obj(),
|
Qstr::MP_QSTR_attach_timer_fn => obj_fn_2!(ui_layout_attach_timer_fn).as_obj(),
|
||||||
Qstr::MP_QSTR_touch_event => obj_fn_var!(4, 4, ui_layout_touch_event).as_obj(),
|
Qstr::MP_QSTR_touch_event => obj_fn_var!(4, 4, ui_layout_touch_event).as_obj(),
|
||||||
|
@ -1594,6 +1594,73 @@ extern "C" fn draw_welcome_screen() -> Obj {
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static mp_module_trezorui2: Module = obj_module! {
|
pub static mp_module_trezorui2: Module = obj_module! {
|
||||||
|
/// from trezor import utils
|
||||||
|
///
|
||||||
|
/// T = TypeVar("T")
|
||||||
|
///
|
||||||
|
/// class LayoutObj(Generic[T]):
|
||||||
|
/// """Representation of a Rust-based layout object.
|
||||||
|
/// see `trezor::ui::layout::obj::LayoutObj`.
|
||||||
|
/// """
|
||||||
|
///
|
||||||
|
/// def attach_timer_fn(self, fn: Callable[[int, int], None]) -> None:
|
||||||
|
/// """Attach a timer setter function.
|
||||||
|
///
|
||||||
|
/// The layout object can call the timer setter with two arguments,
|
||||||
|
/// `token` and `deadline`. When `deadline` is reached, the layout object
|
||||||
|
/// expects a callback to `self.timer(token)`.
|
||||||
|
/// """
|
||||||
|
///
|
||||||
|
/// if utils.USE_TOUCH:
|
||||||
|
/// def touch_event(self, event: int, x: int, y: int) -> T | None:
|
||||||
|
/// """Receive a touch event `event` at coordinates `x`, `y`."""
|
||||||
|
///
|
||||||
|
/// if utils.USE_BUTTON:
|
||||||
|
/// def button_event(self, event: int, button: int) -> T | None:
|
||||||
|
/// """Receive a button event `event` for button `button`."""
|
||||||
|
///
|
||||||
|
/// def progress_event(self, value: int, description: str) -> T | None:
|
||||||
|
/// """Receive a progress event."""
|
||||||
|
///
|
||||||
|
/// def usb_event(self, connected: bool) -> T | None:
|
||||||
|
/// """Receive a USB connect/disconnect event."""
|
||||||
|
///
|
||||||
|
/// def timer(self, token: int) -> T | None:
|
||||||
|
/// """Callback for the timer set by `attach_timer_fn`.
|
||||||
|
///
|
||||||
|
/// This function should be called by the executor after the corresponding
|
||||||
|
/// deadline is reached.
|
||||||
|
/// """
|
||||||
|
///
|
||||||
|
/// def paint(self) -> bool:
|
||||||
|
/// """Paint the layout object on screen.
|
||||||
|
///
|
||||||
|
/// Will only paint updated parts of the layout as required.
|
||||||
|
/// Returns True if any painting actually happened.
|
||||||
|
/// """
|
||||||
|
///
|
||||||
|
/// def request_complete_repaint(self) -> None:
|
||||||
|
/// """Request a complete repaint of the screen.
|
||||||
|
///
|
||||||
|
/// Does not repaint the screen, a subsequent call to `paint()` is required.
|
||||||
|
/// """
|
||||||
|
///
|
||||||
|
/// if __debug__:
|
||||||
|
/// def trace(self, tracer: Callable[[str], None]) -> None:
|
||||||
|
/// """Generate a JSON trace of the layout object.
|
||||||
|
///
|
||||||
|
/// The JSON can be emitted as a sequence of calls to `tracer`, each of
|
||||||
|
/// which is not necessarily a valid JSON chunk. The caller must
|
||||||
|
/// reassemble the chunks to get a sensible result.
|
||||||
|
/// """
|
||||||
|
///
|
||||||
|
/// def bounds(self) -> None:
|
||||||
|
/// """Paint bounds of individual components on screen."""
|
||||||
|
///
|
||||||
|
/// def page_count(self) -> int:
|
||||||
|
/// """Return the number of pages in the layout object."""
|
||||||
|
///
|
||||||
|
/// mock:global
|
||||||
Qstr::MP_QSTR___name__ => Qstr::MP_QSTR_trezorui2.to_obj(),
|
Qstr::MP_QSTR___name__ => Qstr::MP_QSTR_trezorui2.to_obj(),
|
||||||
|
|
||||||
/// CONFIRMED: object
|
/// CONFIRMED: object
|
||||||
@ -1627,7 +1694,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// hold_danger: bool = False,
|
/// hold_danger: bool = False,
|
||||||
/// reverse: bool = False,
|
/// reverse: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Confirm action."""
|
/// """Confirm action."""
|
||||||
Qstr::MP_QSTR_confirm_action => obj_fn_kw!(0, new_confirm_action).as_obj(),
|
Qstr::MP_QSTR_confirm_action => obj_fn_kw!(0, new_confirm_action).as_obj(),
|
||||||
|
|
||||||
@ -1636,7 +1703,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// items: Iterable[str | tuple[bool, str]],
|
/// items: Iterable[str | tuple[bool, str]],
|
||||||
/// verb: str | None = None,
|
/// verb: str | None = None,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Confirm formatted text that has been pre-split in python. For tuples
|
/// """Confirm formatted text that has been pre-split in python. For tuples
|
||||||
/// the first component is a bool indicating whether this part is emphasized."""
|
/// the first component is a bool indicating whether this part is emphasized."""
|
||||||
Qstr::MP_QSTR_confirm_emphasized => obj_fn_kw!(0, new_confirm_emphasized).as_obj(),
|
Qstr::MP_QSTR_confirm_emphasized => obj_fn_kw!(0, new_confirm_emphasized).as_obj(),
|
||||||
@ -1645,7 +1712,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// title: str,
|
/// title: str,
|
||||||
/// image: bytes,
|
/// image: bytes,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Confirm homescreen."""
|
/// """Confirm homescreen."""
|
||||||
Qstr::MP_QSTR_confirm_homescreen => obj_fn_kw!(0, new_confirm_homescreen).as_obj(),
|
Qstr::MP_QSTR_confirm_homescreen => obj_fn_kw!(0, new_confirm_homescreen).as_obj(),
|
||||||
|
|
||||||
@ -1658,7 +1725,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// verb: str | None = None,
|
/// verb: str | None = None,
|
||||||
/// verb_cancel: str | None = None,
|
/// verb_cancel: str | None = None,
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Confirm byte sequence data."""
|
/// """Confirm byte sequence data."""
|
||||||
Qstr::MP_QSTR_confirm_blob => obj_fn_kw!(0, new_confirm_blob).as_obj(),
|
Qstr::MP_QSTR_confirm_blob => obj_fn_kw!(0, new_confirm_blob).as_obj(),
|
||||||
|
|
||||||
@ -1668,7 +1735,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// data: str | bytes,
|
/// data: str | bytes,
|
||||||
/// description: str | None,
|
/// description: str | None,
|
||||||
/// extra: str | None,
|
/// extra: str | None,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Confirm address. Similar to `confirm_blob` but has corner info button
|
/// """Confirm address. Similar to `confirm_blob` but has corner info button
|
||||||
/// and allows left swipe which does the same thing as the button."""
|
/// and allows left swipe which does the same thing as the button."""
|
||||||
Qstr::MP_QSTR_confirm_address => obj_fn_kw!(0, new_confirm_address).as_obj(),
|
Qstr::MP_QSTR_confirm_address => obj_fn_kw!(0, new_confirm_address).as_obj(),
|
||||||
@ -1678,7 +1745,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// items: list[tuple[str | None, str | bytes | None, bool]],
|
/// items: list[tuple[str | None, str | bytes | None, bool]],
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Confirm list of key-value pairs. The third component in the tuple should be True if
|
/// """Confirm list of key-value pairs. The third component in the tuple should be True if
|
||||||
/// the value is to be rendered as binary with monospace font, False otherwise."""
|
/// the value is to be rendered as binary with monospace font, False otherwise."""
|
||||||
Qstr::MP_QSTR_confirm_properties => obj_fn_kw!(0, new_confirm_properties).as_obj(),
|
Qstr::MP_QSTR_confirm_properties => obj_fn_kw!(0, new_confirm_properties).as_obj(),
|
||||||
@ -1687,7 +1754,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// title: str,
|
/// title: str,
|
||||||
/// button: str,
|
/// button: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Confirm TOS before device setup."""
|
/// """Confirm TOS before device setup."""
|
||||||
Qstr::MP_QSTR_confirm_reset_device => obj_fn_kw!(0, new_confirm_reset_device).as_obj(),
|
Qstr::MP_QSTR_confirm_reset_device => obj_fn_kw!(0, new_confirm_reset_device).as_obj(),
|
||||||
|
|
||||||
@ -1698,7 +1765,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// account: str | None,
|
/// account: str | None,
|
||||||
/// path: str | None,
|
/// path: str | None,
|
||||||
/// xpubs: list[tuple[str, str]],
|
/// xpubs: list[tuple[str, str]],
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Show address details - QR code, account, path, cosigner xpubs."""
|
/// """Show address details - QR code, account, path, cosigner xpubs."""
|
||||||
Qstr::MP_QSTR_show_address_details => obj_fn_kw!(0, new_show_address_details).as_obj(),
|
Qstr::MP_QSTR_show_address_details => obj_fn_kw!(0, new_show_address_details).as_obj(),
|
||||||
|
|
||||||
@ -1708,7 +1775,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// account: str | None,
|
/// account: str | None,
|
||||||
/// fee_rate: str | None,
|
/// fee_rate: str | None,
|
||||||
/// fee_rate_title: str = "Fee rate:",
|
/// fee_rate_title: str = "Fee rate:",
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Show metadata when for outgoing transaction."""
|
/// """Show metadata when for outgoing transaction."""
|
||||||
Qstr::MP_QSTR_show_spending_details => obj_fn_kw!(0, new_show_spending_details).as_obj(),
|
Qstr::MP_QSTR_show_spending_details => obj_fn_kw!(0, new_show_spending_details).as_obj(),
|
||||||
|
|
||||||
@ -1722,7 +1789,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// verb_cancel: str | None = None,
|
/// verb_cancel: str | None = None,
|
||||||
/// info_button: bool = False,
|
/// info_button: bool = False,
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Confirm value. Merge of confirm_total and confirm_output."""
|
/// """Confirm value. Merge of confirm_total and confirm_output."""
|
||||||
Qstr::MP_QSTR_confirm_value => obj_fn_kw!(0, new_confirm_value).as_obj(),
|
Qstr::MP_QSTR_confirm_value => obj_fn_kw!(0, new_confirm_value).as_obj(),
|
||||||
|
|
||||||
@ -1731,7 +1798,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// items: list[tuple[str, str]],
|
/// items: list[tuple[str, str]],
|
||||||
/// info_button: bool = False,
|
/// info_button: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Transaction summary. Always hold to confirm."""
|
/// """Transaction summary. Always hold to confirm."""
|
||||||
Qstr::MP_QSTR_confirm_total => obj_fn_kw!(0, new_confirm_total).as_obj(),
|
Qstr::MP_QSTR_confirm_total => obj_fn_kw!(0, new_confirm_total).as_obj(),
|
||||||
|
|
||||||
@ -1741,7 +1808,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// sign: int,
|
/// sign: int,
|
||||||
/// amount_change: str,
|
/// amount_change: str,
|
||||||
/// amount_new: str,
|
/// amount_new: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Decrease or increase amount for given address."""
|
/// """Decrease or increase amount for given address."""
|
||||||
Qstr::MP_QSTR_confirm_modify_output => obj_fn_kw!(0, new_confirm_modify_output).as_obj(),
|
Qstr::MP_QSTR_confirm_modify_output => obj_fn_kw!(0, new_confirm_modify_output).as_obj(),
|
||||||
|
|
||||||
@ -1752,7 +1819,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// user_fee_change: str,
|
/// user_fee_change: str,
|
||||||
/// total_fee_new: str,
|
/// total_fee_new: str,
|
||||||
/// fee_rate_amount: str | None, # ignored
|
/// fee_rate_amount: str | None, # ignored
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Decrease or increase transaction fee."""
|
/// """Decrease or increase transaction fee."""
|
||||||
Qstr::MP_QSTR_confirm_modify_fee => obj_fn_kw!(0, new_confirm_modify_fee).as_obj(),
|
Qstr::MP_QSTR_confirm_modify_fee => obj_fn_kw!(0, new_confirm_modify_fee).as_obj(),
|
||||||
|
|
||||||
@ -1762,7 +1829,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// app_name: str,
|
/// app_name: str,
|
||||||
/// icon_name: str | None,
|
/// icon_name: str | None,
|
||||||
/// accounts: list[str | None],
|
/// accounts: list[str | None],
|
||||||
/// ) -> int | object:
|
/// ) -> LayoutObj[int | object]:
|
||||||
/// """FIDO confirmation.
|
/// """FIDO confirmation.
|
||||||
///
|
///
|
||||||
/// Returns page index in case of confirmation and CANCELLED otherwise.
|
/// Returns page index in case of confirmation and CANCELLED otherwise.
|
||||||
@ -1776,7 +1843,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// allow_cancel: bool = False,
|
/// allow_cancel: bool = False,
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Error modal. No buttons shown when `button` is empty string."""
|
/// """Error modal. No buttons shown when `button` is empty string."""
|
||||||
Qstr::MP_QSTR_show_error => obj_fn_kw!(0, new_show_error).as_obj(),
|
Qstr::MP_QSTR_show_error => obj_fn_kw!(0, new_show_error).as_obj(),
|
||||||
|
|
||||||
@ -1787,7 +1854,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// allow_cancel: bool = False,
|
/// allow_cancel: bool = False,
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Warning modal. No buttons shown when `button` is empty string."""
|
/// """Warning modal. No buttons shown when `button` is empty string."""
|
||||||
Qstr::MP_QSTR_show_warning => obj_fn_kw!(0, new_show_warning).as_obj(),
|
Qstr::MP_QSTR_show_warning => obj_fn_kw!(0, new_show_warning).as_obj(),
|
||||||
|
|
||||||
@ -1798,7 +1865,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// allow_cancel: bool = False,
|
/// allow_cancel: bool = False,
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Success modal. No buttons shown when `button` is empty string."""
|
/// """Success modal. No buttons shown when `button` is empty string."""
|
||||||
Qstr::MP_QSTR_show_success => obj_fn_kw!(0, new_show_success).as_obj(),
|
Qstr::MP_QSTR_show_success => obj_fn_kw!(0, new_show_success).as_obj(),
|
||||||
|
|
||||||
@ -1809,11 +1876,11 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// allow_cancel: bool = False,
|
/// allow_cancel: bool = False,
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Info modal. No buttons shown when `button` is empty string."""
|
/// """Info modal. No buttons shown when `button` is empty string."""
|
||||||
Qstr::MP_QSTR_show_info => obj_fn_kw!(0, new_show_info).as_obj(),
|
Qstr::MP_QSTR_show_info => obj_fn_kw!(0, new_show_info).as_obj(),
|
||||||
|
|
||||||
/// def show_mismatch() -> object:
|
/// def show_mismatch() -> LayoutObj[object]:
|
||||||
/// """Warning modal, receiving address mismatch."""
|
/// """Warning modal, receiving address mismatch."""
|
||||||
Qstr::MP_QSTR_show_mismatch => obj_fn_0!(new_show_mismatch).as_obj(),
|
Qstr::MP_QSTR_show_mismatch => obj_fn_0!(new_show_mismatch).as_obj(),
|
||||||
|
|
||||||
@ -1822,7 +1889,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str | None,
|
/// title: str | None,
|
||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// button: str = "",
|
/// button: str = "",
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Simple dialog with text and one button."""
|
/// """Simple dialog with text and one button."""
|
||||||
Qstr::MP_QSTR_show_simple => obj_fn_kw!(0, new_show_simple).as_obj(),
|
Qstr::MP_QSTR_show_simple => obj_fn_kw!(0, new_show_simple).as_obj(),
|
||||||
|
|
||||||
@ -1832,7 +1899,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// button: str,
|
/// button: str,
|
||||||
/// info_button: str,
|
/// info_button: str,
|
||||||
/// items: Iterable[tuple[int, str]],
|
/// items: Iterable[tuple[int, str]],
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Confirm given items but with third button. Always single page
|
/// """Confirm given items but with third button. Always single page
|
||||||
/// without scrolling."""
|
/// without scrolling."""
|
||||||
Qstr::MP_QSTR_confirm_with_info => obj_fn_kw!(0, new_confirm_with_info).as_obj(),
|
Qstr::MP_QSTR_confirm_with_info => obj_fn_kw!(0, new_confirm_with_info).as_obj(),
|
||||||
@ -1842,7 +1909,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// button: str,
|
/// button: str,
|
||||||
/// items: Iterable[tuple[int, str]],
|
/// items: Iterable[tuple[int, str]],
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Confirm long content with the possibility to go back from any page.
|
/// """Confirm long content with the possibility to go back from any page.
|
||||||
/// Meant to be used with confirm_with_info."""
|
/// Meant to be used with confirm_with_info."""
|
||||||
Qstr::MP_QSTR_confirm_more => obj_fn_kw!(0, new_confirm_more).as_obj(),
|
Qstr::MP_QSTR_confirm_more => obj_fn_kw!(0, new_confirm_more).as_obj(),
|
||||||
@ -1851,7 +1918,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// max_rounds: str,
|
/// max_rounds: str,
|
||||||
/// max_feerate: str,
|
/// max_feerate: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Confirm coinjoin authorization."""
|
/// """Confirm coinjoin authorization."""
|
||||||
Qstr::MP_QSTR_confirm_coinjoin => obj_fn_kw!(0, new_confirm_coinjoin).as_obj(),
|
Qstr::MP_QSTR_confirm_coinjoin => obj_fn_kw!(0, new_confirm_coinjoin).as_obj(),
|
||||||
|
|
||||||
@ -1861,7 +1928,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// subprompt: str,
|
/// subprompt: str,
|
||||||
/// allow_cancel: bool = True,
|
/// allow_cancel: bool = True,
|
||||||
/// wrong_pin: bool = False,
|
/// wrong_pin: bool = False,
|
||||||
/// ) -> str | object:
|
/// ) -> LayoutObj[str | object]:
|
||||||
/// """Request pin on device."""
|
/// """Request pin on device."""
|
||||||
Qstr::MP_QSTR_request_pin => obj_fn_kw!(0, new_request_pin).as_obj(),
|
Qstr::MP_QSTR_request_pin => obj_fn_kw!(0, new_request_pin).as_obj(),
|
||||||
|
|
||||||
@ -1869,21 +1936,21 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// prompt: str,
|
/// prompt: str,
|
||||||
/// max_len: int,
|
/// max_len: int,
|
||||||
/// ) -> str | object:
|
/// ) -> LayoutObj[str | object]:
|
||||||
/// """Passphrase input keyboard."""
|
/// """Passphrase input keyboard."""
|
||||||
Qstr::MP_QSTR_request_passphrase => obj_fn_kw!(0, new_request_passphrase).as_obj(),
|
Qstr::MP_QSTR_request_passphrase => obj_fn_kw!(0, new_request_passphrase).as_obj(),
|
||||||
|
|
||||||
/// def request_bip39(
|
/// def request_bip39(
|
||||||
/// *,
|
/// *,
|
||||||
/// prompt: str,
|
/// prompt: str,
|
||||||
/// ) -> str:
|
/// ) -> LayoutObj[str]:
|
||||||
/// """BIP39 word input keyboard."""
|
/// """BIP39 word input keyboard."""
|
||||||
Qstr::MP_QSTR_request_bip39 => obj_fn_kw!(0, new_request_bip39).as_obj(),
|
Qstr::MP_QSTR_request_bip39 => obj_fn_kw!(0, new_request_bip39).as_obj(),
|
||||||
|
|
||||||
/// def request_slip39(
|
/// def request_slip39(
|
||||||
/// *,
|
/// *,
|
||||||
/// prompt: str,
|
/// prompt: str,
|
||||||
/// ) -> str:
|
/// ) -> LayoutObj[str]:
|
||||||
/// """SLIP39 word input keyboard."""
|
/// """SLIP39 word input keyboard."""
|
||||||
Qstr::MP_QSTR_request_slip39 => obj_fn_kw!(0, new_request_slip39).as_obj(),
|
Qstr::MP_QSTR_request_slip39 => obj_fn_kw!(0, new_request_slip39).as_obj(),
|
||||||
|
|
||||||
@ -1892,7 +1959,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// description: str,
|
/// description: str,
|
||||||
/// words: Iterable[str],
|
/// words: Iterable[str],
|
||||||
/// ) -> int:
|
/// ) -> LayoutObj[int]:
|
||||||
/// """Select mnemonic word from three possibilities - seed check after backup. The
|
/// """Select mnemonic word from three possibilities - seed check after backup. The
|
||||||
/// iterable must be of exact size. Returns index in range `0..3`."""
|
/// iterable must be of exact size. Returns index in range `0..3`."""
|
||||||
Qstr::MP_QSTR_select_word => obj_fn_kw!(0, new_select_word).as_obj(),
|
Qstr::MP_QSTR_select_word => obj_fn_kw!(0, new_select_word).as_obj(),
|
||||||
@ -1901,7 +1968,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// *,
|
/// *,
|
||||||
/// title: str,
|
/// title: str,
|
||||||
/// pages: Iterable[str],
|
/// pages: Iterable[str],
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Show mnemonic for backup. Expects the words pre-divided into individual pages."""
|
/// """Show mnemonic for backup. Expects the words pre-divided into individual pages."""
|
||||||
Qstr::MP_QSTR_show_share_words => obj_fn_kw!(0, new_show_share_words).as_obj(),
|
Qstr::MP_QSTR_show_share_words => obj_fn_kw!(0, new_show_share_words).as_obj(),
|
||||||
|
|
||||||
@ -1912,7 +1979,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// min_count: int,
|
/// min_count: int,
|
||||||
/// max_count: int,
|
/// max_count: int,
|
||||||
/// description: Callable[[int], str] | None = None,
|
/// description: Callable[[int], str] | None = None,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Number input with + and - buttons, description, and info button."""
|
/// """Number input with + and - buttons, description, and info button."""
|
||||||
Qstr::MP_QSTR_request_number => obj_fn_kw!(0, new_request_number).as_obj(),
|
Qstr::MP_QSTR_request_number => obj_fn_kw!(0, new_request_number).as_obj(),
|
||||||
|
|
||||||
@ -1922,7 +1989,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// items: Iterable[str],
|
/// items: Iterable[str],
|
||||||
/// active: int,
|
/// active: int,
|
||||||
/// button: str,
|
/// button: str,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Checklist of backup steps. Active index is highlighted, previous items have check
|
/// """Checklist of backup steps. Active index is highlighted, previous items have check
|
||||||
/// mark next to them."""
|
/// mark next to them."""
|
||||||
Qstr::MP_QSTR_show_checklist => obj_fn_kw!(0, new_show_checklist).as_obj(),
|
Qstr::MP_QSTR_show_checklist => obj_fn_kw!(0, new_show_checklist).as_obj(),
|
||||||
@ -1934,28 +2001,28 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// button: str,
|
/// button: str,
|
||||||
/// dry_run: bool,
|
/// dry_run: bool,
|
||||||
/// info_button: bool = False,
|
/// info_button: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Device recovery homescreen."""
|
/// """Device recovery homescreen."""
|
||||||
Qstr::MP_QSTR_confirm_recovery => obj_fn_kw!(0, new_confirm_recovery).as_obj(),
|
Qstr::MP_QSTR_confirm_recovery => obj_fn_kw!(0, new_confirm_recovery).as_obj(),
|
||||||
|
|
||||||
/// def select_word_count(
|
/// def select_word_count(
|
||||||
/// *,
|
/// *,
|
||||||
/// dry_run: bool,
|
/// dry_run: bool,
|
||||||
/// ) -> int | str: # TT returns int
|
/// ) -> LayoutObj[int | str]: # TT returns int
|
||||||
/// """Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
/// """Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
||||||
Qstr::MP_QSTR_select_word_count => obj_fn_kw!(0, new_select_word_count).as_obj(),
|
Qstr::MP_QSTR_select_word_count => obj_fn_kw!(0, new_select_word_count).as_obj(),
|
||||||
|
|
||||||
/// def show_group_share_success(
|
/// def show_group_share_success(
|
||||||
/// *,
|
/// *,
|
||||||
/// lines: Iterable[str]
|
/// lines: Iterable[str]
|
||||||
/// ) -> int:
|
/// ) -> LayoutObj[int]:
|
||||||
/// """Shown after successfully finishing a group."""
|
/// """Shown after successfully finishing a group."""
|
||||||
Qstr::MP_QSTR_show_group_share_success => obj_fn_kw!(0, new_show_group_share_success).as_obj(),
|
Qstr::MP_QSTR_show_group_share_success => obj_fn_kw!(0, new_show_group_share_success).as_obj(),
|
||||||
|
|
||||||
/// def show_remaining_shares(
|
/// def show_remaining_shares(
|
||||||
/// *,
|
/// *,
|
||||||
/// pages: Iterable[tuple[str, str]],
|
/// pages: Iterable[tuple[str, str]],
|
||||||
/// ) -> int:
|
/// ) -> LayoutObj[int]:
|
||||||
/// """Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
|
/// """Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
|
||||||
Qstr::MP_QSTR_show_remaining_shares => obj_fn_kw!(0, new_show_remaining_shares).as_obj(),
|
Qstr::MP_QSTR_show_remaining_shares => obj_fn_kw!(0, new_show_remaining_shares).as_obj(),
|
||||||
|
|
||||||
@ -1964,7 +2031,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// title: str,
|
/// title: str,
|
||||||
/// indeterminate: bool = False,
|
/// indeterminate: bool = False,
|
||||||
/// description: str = "",
|
/// description: str = "",
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Show progress loader. Please note that the number of lines reserved on screen for
|
/// """Show progress loader. Please note that the number of lines reserved on screen for
|
||||||
/// description is determined at construction time. If you want multiline descriptions
|
/// description is determined at construction time. If you want multiline descriptions
|
||||||
/// make sure the initial description has at least that amount of lines."""
|
/// make sure the initial description has at least that amount of lines."""
|
||||||
@ -1976,7 +2043,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// indeterminate: bool = False,
|
/// indeterminate: bool = False,
|
||||||
/// time_ms: int = 0,
|
/// time_ms: int = 0,
|
||||||
/// skip_first_paint: bool = False,
|
/// skip_first_paint: bool = False,
|
||||||
/// ) -> object:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
/// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
||||||
/// time_ms timeout is passed."""
|
/// time_ms timeout is passed."""
|
||||||
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
|
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
|
||||||
@ -1988,7 +2055,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// notification: str | None,
|
/// notification: str | None,
|
||||||
/// notification_level: int = 0,
|
/// notification_level: int = 0,
|
||||||
/// skip_first_paint: bool,
|
/// skip_first_paint: bool,
|
||||||
/// ) -> CANCELLED:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Idle homescreen."""
|
/// """Idle homescreen."""
|
||||||
Qstr::MP_QSTR_show_homescreen => obj_fn_kw!(0, new_show_homescreen).as_obj(),
|
Qstr::MP_QSTR_show_homescreen => obj_fn_kw!(0, new_show_homescreen).as_obj(),
|
||||||
|
|
||||||
@ -1997,11 +2064,11 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// label: str | None,
|
/// label: str | None,
|
||||||
/// bootscreen: bool,
|
/// bootscreen: bool,
|
||||||
/// skip_first_paint: bool,
|
/// skip_first_paint: bool,
|
||||||
/// ) -> CANCELLED:
|
/// ) -> LayoutObj[object]:
|
||||||
/// """Homescreen for locked device."""
|
/// """Homescreen for locked device."""
|
||||||
Qstr::MP_QSTR_show_lockscreen => obj_fn_kw!(0, new_show_lockscreen).as_obj(),
|
Qstr::MP_QSTR_show_lockscreen => obj_fn_kw!(0, new_show_lockscreen).as_obj(),
|
||||||
|
|
||||||
/// def draw_welcome_screen() -> None:
|
/// def draw_welcome_screen() -> LayoutObj[None]:
|
||||||
/// """Show logo icon with the model name at the bottom and return."""
|
/// """Show logo icon with the model name at the bottom and return."""
|
||||||
Qstr::MP_QSTR_draw_welcome_screen => obj_fn_0!(draw_welcome_screen).as_obj(),
|
Qstr::MP_QSTR_draw_welcome_screen => obj_fn_0!(draw_welcome_screen).as_obj(),
|
||||||
};
|
};
|
||||||
|
@ -365,6 +365,56 @@ def show_lockscreen(
|
|||||||
# rust/src/ui/model_tr/layout.rs
|
# rust/src/ui/model_tr/layout.rs
|
||||||
def draw_welcome_screen() -> None:
|
def draw_welcome_screen() -> None:
|
||||||
"""Show logo icon with the model name at the bottom and return."""
|
"""Show logo icon with the model name at the bottom and return."""
|
||||||
|
from trezor import utils
|
||||||
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
|
||||||
|
# rust/src/ui/model_tt/layout.rs
|
||||||
|
class LayoutObj(Generic[T]):
|
||||||
|
"""Representation of a Rust-based layout object.
|
||||||
|
see `trezor::ui::layout::obj::LayoutObj`.
|
||||||
|
"""
|
||||||
|
def attach_timer_fn(self, fn: Callable[[int, int], None]) -> None:
|
||||||
|
"""Attach a timer setter function.
|
||||||
|
The layout object can call the timer setter with two arguments,
|
||||||
|
`token` and `deadline`. When `deadline` is reached, the layout object
|
||||||
|
expects a callback to `self.timer(token)`.
|
||||||
|
"""
|
||||||
|
if utils.USE_TOUCH:
|
||||||
|
def touch_event(self, event: int, x: int, y: int) -> T | None:
|
||||||
|
"""Receive a touch event `event` at coordinates `x`, `y`."""
|
||||||
|
if utils.USE_BUTTON:
|
||||||
|
def button_event(self, event: int, button: int) -> T | None:
|
||||||
|
"""Receive a button event `event` for button `button`."""
|
||||||
|
def progress_event(self, value: int, description: str) -> T | None:
|
||||||
|
"""Receive a progress event."""
|
||||||
|
def usb_event(self, connected: bool) -> T | None:
|
||||||
|
"""Receive a USB connect/disconnect event."""
|
||||||
|
def timer(self, token: int) -> T | None:
|
||||||
|
"""Callback for the timer set by `attach_timer_fn`.
|
||||||
|
This function should be called by the executor after the corresponding
|
||||||
|
deadline is reached.
|
||||||
|
"""
|
||||||
|
def paint(self) -> bool:
|
||||||
|
"""Paint the layout object on screen.
|
||||||
|
Will only paint updated parts of the layout as required.
|
||||||
|
Returns True if any painting actually happened.
|
||||||
|
"""
|
||||||
|
def request_complete_repaint(self) -> None:
|
||||||
|
"""Request a complete repaint of the screen.
|
||||||
|
Does not repaint the screen, a subsequent call to `paint()` is required.
|
||||||
|
"""
|
||||||
|
if __debug__:
|
||||||
|
def trace(self, tracer: Callable[[str], None]) -> None:
|
||||||
|
"""Generate a JSON trace of the layout object.
|
||||||
|
The JSON can be emitted as a sequence of calls to `tracer`, each of
|
||||||
|
which is not necessarily a valid JSON chunk. The caller must
|
||||||
|
reassemble the chunks to get a sensible result.
|
||||||
|
"""
|
||||||
|
def bounds(self) -> None:
|
||||||
|
"""Paint bounds of individual components on screen."""
|
||||||
|
def page_count(self) -> int:
|
||||||
|
"""Return the number of pages in the layout object."""
|
||||||
CONFIRMED: object
|
CONFIRMED: object
|
||||||
CANCELLED: object
|
CANCELLED: object
|
||||||
INFO: object
|
INFO: object
|
||||||
@ -396,7 +446,7 @@ def confirm_action(
|
|||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
hold_danger: bool = False,
|
hold_danger: bool = False,
|
||||||
reverse: bool = False,
|
reverse: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Confirm action."""
|
"""Confirm action."""
|
||||||
|
|
||||||
|
|
||||||
@ -406,7 +456,7 @@ def confirm_emphasized(
|
|||||||
title: str,
|
title: str,
|
||||||
items: Iterable[str | tuple[bool, str]],
|
items: Iterable[str | tuple[bool, str]],
|
||||||
verb: str | None = None,
|
verb: str | None = None,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Confirm formatted text that has been pre-split in python. For tuples
|
"""Confirm formatted text that has been pre-split in python. For tuples
|
||||||
the first component is a bool indicating whether this part is emphasized."""
|
the first component is a bool indicating whether this part is emphasized."""
|
||||||
|
|
||||||
@ -416,7 +466,7 @@ def confirm_homescreen(
|
|||||||
*,
|
*,
|
||||||
title: str,
|
title: str,
|
||||||
image: bytes,
|
image: bytes,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Confirm homescreen."""
|
"""Confirm homescreen."""
|
||||||
|
|
||||||
|
|
||||||
@ -430,7 +480,7 @@ def confirm_blob(
|
|||||||
verb: str | None = None,
|
verb: str | None = None,
|
||||||
verb_cancel: str | None = None,
|
verb_cancel: str | None = None,
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Confirm byte sequence data."""
|
"""Confirm byte sequence data."""
|
||||||
|
|
||||||
|
|
||||||
@ -441,7 +491,7 @@ def confirm_address(
|
|||||||
data: str | bytes,
|
data: str | bytes,
|
||||||
description: str | None,
|
description: str | None,
|
||||||
extra: str | None,
|
extra: str | None,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Confirm address. Similar to `confirm_blob` but has corner info button
|
"""Confirm address. Similar to `confirm_blob` but has corner info button
|
||||||
and allows left swipe which does the same thing as the button."""
|
and allows left swipe which does the same thing as the button."""
|
||||||
|
|
||||||
@ -452,7 +502,7 @@ def confirm_properties(
|
|||||||
title: str,
|
title: str,
|
||||||
items: list[tuple[str | None, str | bytes | None, bool]],
|
items: list[tuple[str | None, str | bytes | None, bool]],
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Confirm list of key-value pairs. The third component in the tuple should be True if
|
"""Confirm list of key-value pairs. The third component in the tuple should be True if
|
||||||
the value is to be rendered as binary with monospace font, False otherwise."""
|
the value is to be rendered as binary with monospace font, False otherwise."""
|
||||||
|
|
||||||
@ -462,7 +512,7 @@ def confirm_reset_device(
|
|||||||
*,
|
*,
|
||||||
title: str,
|
title: str,
|
||||||
button: str,
|
button: str,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Confirm TOS before device setup."""
|
"""Confirm TOS before device setup."""
|
||||||
|
|
||||||
|
|
||||||
@ -474,7 +524,7 @@ def show_address_details(
|
|||||||
account: str | None,
|
account: str | None,
|
||||||
path: str | None,
|
path: str | None,
|
||||||
xpubs: list[tuple[str, str]],
|
xpubs: list[tuple[str, str]],
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Show address details - QR code, account, path, cosigner xpubs."""
|
"""Show address details - QR code, account, path, cosigner xpubs."""
|
||||||
|
|
||||||
|
|
||||||
@ -485,7 +535,7 @@ def show_spending_details(
|
|||||||
account: str | None,
|
account: str | None,
|
||||||
fee_rate: str | None,
|
fee_rate: str | None,
|
||||||
fee_rate_title: str = "Fee rate:",
|
fee_rate_title: str = "Fee rate:",
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Show metadata when for outgoing transaction."""
|
"""Show metadata when for outgoing transaction."""
|
||||||
|
|
||||||
|
|
||||||
@ -500,7 +550,7 @@ def confirm_value(
|
|||||||
verb_cancel: str | None = None,
|
verb_cancel: str | None = None,
|
||||||
info_button: bool = False,
|
info_button: bool = False,
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Confirm value. Merge of confirm_total and confirm_output."""
|
"""Confirm value. Merge of confirm_total and confirm_output."""
|
||||||
|
|
||||||
|
|
||||||
@ -510,7 +560,7 @@ def confirm_total(
|
|||||||
title: str,
|
title: str,
|
||||||
items: list[tuple[str, str]],
|
items: list[tuple[str, str]],
|
||||||
info_button: bool = False,
|
info_button: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Transaction summary. Always hold to confirm."""
|
"""Transaction summary. Always hold to confirm."""
|
||||||
|
|
||||||
|
|
||||||
@ -521,7 +571,7 @@ def confirm_modify_output(
|
|||||||
sign: int,
|
sign: int,
|
||||||
amount_change: str,
|
amount_change: str,
|
||||||
amount_new: str,
|
amount_new: str,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Decrease or increase amount for given address."""
|
"""Decrease or increase amount for given address."""
|
||||||
|
|
||||||
|
|
||||||
@ -533,7 +583,7 @@ def confirm_modify_fee(
|
|||||||
user_fee_change: str,
|
user_fee_change: str,
|
||||||
total_fee_new: str,
|
total_fee_new: str,
|
||||||
fee_rate_amount: str | None, # ignored
|
fee_rate_amount: str | None, # ignored
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Decrease or increase transaction fee."""
|
"""Decrease or increase transaction fee."""
|
||||||
|
|
||||||
|
|
||||||
@ -544,7 +594,7 @@ def confirm_fido(
|
|||||||
app_name: str,
|
app_name: str,
|
||||||
icon_name: str | None,
|
icon_name: str | None,
|
||||||
accounts: list[str | None],
|
accounts: list[str | None],
|
||||||
) -> int | object:
|
) -> LayoutObj[int | object]:
|
||||||
"""FIDO confirmation.
|
"""FIDO confirmation.
|
||||||
Returns page index in case of confirmation and CANCELLED otherwise.
|
Returns page index in case of confirmation and CANCELLED otherwise.
|
||||||
"""
|
"""
|
||||||
@ -558,7 +608,7 @@ def show_error(
|
|||||||
description: str = "",
|
description: str = "",
|
||||||
allow_cancel: bool = False,
|
allow_cancel: bool = False,
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Error modal. No buttons shown when `button` is empty string."""
|
"""Error modal. No buttons shown when `button` is empty string."""
|
||||||
|
|
||||||
|
|
||||||
@ -570,7 +620,7 @@ def show_warning(
|
|||||||
description: str = "",
|
description: str = "",
|
||||||
allow_cancel: bool = False,
|
allow_cancel: bool = False,
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Warning modal. No buttons shown when `button` is empty string."""
|
"""Warning modal. No buttons shown when `button` is empty string."""
|
||||||
|
|
||||||
|
|
||||||
@ -582,7 +632,7 @@ def show_success(
|
|||||||
description: str = "",
|
description: str = "",
|
||||||
allow_cancel: bool = False,
|
allow_cancel: bool = False,
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Success modal. No buttons shown when `button` is empty string."""
|
"""Success modal. No buttons shown when `button` is empty string."""
|
||||||
|
|
||||||
|
|
||||||
@ -594,12 +644,12 @@ def show_info(
|
|||||||
description: str = "",
|
description: str = "",
|
||||||
allow_cancel: bool = False,
|
allow_cancel: bool = False,
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Info modal. No buttons shown when `button` is empty string."""
|
"""Info modal. No buttons shown when `button` is empty string."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tt/layout.rs
|
# rust/src/ui/model_tt/layout.rs
|
||||||
def show_mismatch() -> object:
|
def show_mismatch() -> LayoutObj[object]:
|
||||||
"""Warning modal, receiving address mismatch."""
|
"""Warning modal, receiving address mismatch."""
|
||||||
|
|
||||||
|
|
||||||
@ -609,7 +659,7 @@ def show_simple(
|
|||||||
title: str | None,
|
title: str | None,
|
||||||
description: str = "",
|
description: str = "",
|
||||||
button: str = "",
|
button: str = "",
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Simple dialog with text and one button."""
|
"""Simple dialog with text and one button."""
|
||||||
|
|
||||||
|
|
||||||
@ -620,7 +670,7 @@ def confirm_with_info(
|
|||||||
button: str,
|
button: str,
|
||||||
info_button: str,
|
info_button: str,
|
||||||
items: Iterable[tuple[int, str]],
|
items: Iterable[tuple[int, str]],
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Confirm given items but with third button. Always single page
|
"""Confirm given items but with third button. Always single page
|
||||||
without scrolling."""
|
without scrolling."""
|
||||||
|
|
||||||
@ -631,7 +681,7 @@ def confirm_more(
|
|||||||
title: str,
|
title: str,
|
||||||
button: str,
|
button: str,
|
||||||
items: Iterable[tuple[int, str]],
|
items: Iterable[tuple[int, str]],
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Confirm long content with the possibility to go back from any page.
|
"""Confirm long content with the possibility to go back from any page.
|
||||||
Meant to be used with confirm_with_info."""
|
Meant to be used with confirm_with_info."""
|
||||||
|
|
||||||
@ -641,7 +691,7 @@ def confirm_coinjoin(
|
|||||||
*,
|
*,
|
||||||
max_rounds: str,
|
max_rounds: str,
|
||||||
max_feerate: str,
|
max_feerate: str,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Confirm coinjoin authorization."""
|
"""Confirm coinjoin authorization."""
|
||||||
|
|
||||||
|
|
||||||
@ -652,7 +702,7 @@ def request_pin(
|
|||||||
subprompt: str,
|
subprompt: str,
|
||||||
allow_cancel: bool = True,
|
allow_cancel: bool = True,
|
||||||
wrong_pin: bool = False,
|
wrong_pin: bool = False,
|
||||||
) -> str | object:
|
) -> LayoutObj[str | object]:
|
||||||
"""Request pin on device."""
|
"""Request pin on device."""
|
||||||
|
|
||||||
|
|
||||||
@ -661,7 +711,7 @@ def request_passphrase(
|
|||||||
*,
|
*,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
max_len: int,
|
max_len: int,
|
||||||
) -> str | object:
|
) -> LayoutObj[str | object]:
|
||||||
"""Passphrase input keyboard."""
|
"""Passphrase input keyboard."""
|
||||||
|
|
||||||
|
|
||||||
@ -669,7 +719,7 @@ def request_passphrase(
|
|||||||
def request_bip39(
|
def request_bip39(
|
||||||
*,
|
*,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
) -> str:
|
) -> LayoutObj[str]:
|
||||||
"""BIP39 word input keyboard."""
|
"""BIP39 word input keyboard."""
|
||||||
|
|
||||||
|
|
||||||
@ -677,7 +727,7 @@ def request_bip39(
|
|||||||
def request_slip39(
|
def request_slip39(
|
||||||
*,
|
*,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
) -> str:
|
) -> LayoutObj[str]:
|
||||||
"""SLIP39 word input keyboard."""
|
"""SLIP39 word input keyboard."""
|
||||||
|
|
||||||
|
|
||||||
@ -687,7 +737,7 @@ def select_word(
|
|||||||
title: str,
|
title: str,
|
||||||
description: str,
|
description: str,
|
||||||
words: Iterable[str],
|
words: Iterable[str],
|
||||||
) -> int:
|
) -> LayoutObj[int]:
|
||||||
"""Select mnemonic word from three possibilities - seed check after backup. The
|
"""Select mnemonic word from three possibilities - seed check after backup. The
|
||||||
iterable must be of exact size. Returns index in range `0..3`."""
|
iterable must be of exact size. Returns index in range `0..3`."""
|
||||||
|
|
||||||
@ -697,7 +747,7 @@ def show_share_words(
|
|||||||
*,
|
*,
|
||||||
title: str,
|
title: str,
|
||||||
pages: Iterable[str],
|
pages: Iterable[str],
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Show mnemonic for backup. Expects the words pre-divided into individual pages."""
|
"""Show mnemonic for backup. Expects the words pre-divided into individual pages."""
|
||||||
|
|
||||||
|
|
||||||
@ -709,7 +759,7 @@ def request_number(
|
|||||||
min_count: int,
|
min_count: int,
|
||||||
max_count: int,
|
max_count: int,
|
||||||
description: Callable[[int], str] | None = None,
|
description: Callable[[int], str] | None = None,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Number input with + and - buttons, description, and info button."""
|
"""Number input with + and - buttons, description, and info button."""
|
||||||
|
|
||||||
|
|
||||||
@ -720,7 +770,7 @@ def show_checklist(
|
|||||||
items: Iterable[str],
|
items: Iterable[str],
|
||||||
active: int,
|
active: int,
|
||||||
button: str,
|
button: str,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Checklist of backup steps. Active index is highlighted, previous items have check
|
"""Checklist of backup steps. Active index is highlighted, previous items have check
|
||||||
mark next to them."""
|
mark next to them."""
|
||||||
|
|
||||||
@ -733,7 +783,7 @@ def confirm_recovery(
|
|||||||
button: str,
|
button: str,
|
||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
info_button: bool = False,
|
info_button: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Device recovery homescreen."""
|
"""Device recovery homescreen."""
|
||||||
|
|
||||||
|
|
||||||
@ -741,7 +791,7 @@ def confirm_recovery(
|
|||||||
def select_word_count(
|
def select_word_count(
|
||||||
*,
|
*,
|
||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
) -> int | str: # TT returns int
|
) -> LayoutObj[int | str]: # TT returns int
|
||||||
"""Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
"""Select mnemonic word count from (12, 18, 20, 24, 33)."""
|
||||||
|
|
||||||
|
|
||||||
@ -749,7 +799,7 @@ def select_word_count(
|
|||||||
def show_group_share_success(
|
def show_group_share_success(
|
||||||
*,
|
*,
|
||||||
lines: Iterable[str]
|
lines: Iterable[str]
|
||||||
) -> int:
|
) -> LayoutObj[int]:
|
||||||
"""Shown after successfully finishing a group."""
|
"""Shown after successfully finishing a group."""
|
||||||
|
|
||||||
|
|
||||||
@ -757,7 +807,7 @@ def show_group_share_success(
|
|||||||
def show_remaining_shares(
|
def show_remaining_shares(
|
||||||
*,
|
*,
|
||||||
pages: Iterable[tuple[str, str]],
|
pages: Iterable[tuple[str, str]],
|
||||||
) -> int:
|
) -> LayoutObj[int]:
|
||||||
"""Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
|
"""Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
|
||||||
|
|
||||||
|
|
||||||
@ -767,7 +817,7 @@ def show_progress(
|
|||||||
title: str,
|
title: str,
|
||||||
indeterminate: bool = False,
|
indeterminate: bool = False,
|
||||||
description: str = "",
|
description: str = "",
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Show progress loader. Please note that the number of lines reserved on screen for
|
"""Show progress loader. Please note that the number of lines reserved on screen for
|
||||||
description is determined at construction time. If you want multiline descriptions
|
description is determined at construction time. If you want multiline descriptions
|
||||||
make sure the initial description has at least that amount of lines."""
|
make sure the initial description has at least that amount of lines."""
|
||||||
@ -780,7 +830,7 @@ def show_progress_coinjoin(
|
|||||||
indeterminate: bool = False,
|
indeterminate: bool = False,
|
||||||
time_ms: int = 0,
|
time_ms: int = 0,
|
||||||
skip_first_paint: bool = False,
|
skip_first_paint: bool = False,
|
||||||
) -> object:
|
) -> LayoutObj[object]:
|
||||||
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
|
||||||
time_ms timeout is passed."""
|
time_ms timeout is passed."""
|
||||||
|
|
||||||
@ -793,7 +843,7 @@ def show_homescreen(
|
|||||||
notification: str | None,
|
notification: str | None,
|
||||||
notification_level: int = 0,
|
notification_level: int = 0,
|
||||||
skip_first_paint: bool,
|
skip_first_paint: bool,
|
||||||
) -> CANCELLED:
|
) -> LayoutObj[object]:
|
||||||
"""Idle homescreen."""
|
"""Idle homescreen."""
|
||||||
|
|
||||||
|
|
||||||
@ -803,10 +853,10 @@ def show_lockscreen(
|
|||||||
label: str | None,
|
label: str | None,
|
||||||
bootscreen: bool,
|
bootscreen: bool,
|
||||||
skip_first_paint: bool,
|
skip_first_paint: bool,
|
||||||
) -> CANCELLED:
|
) -> LayoutObj[object]:
|
||||||
"""Homescreen for locked device."""
|
"""Homescreen for locked device."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tt/layout.rs
|
# rust/src/ui/model_tt/layout.rs
|
||||||
def draw_welcome_screen() -> None:
|
def draw_welcome_screen() -> LayoutObj[None]:
|
||||||
"""Show logo icon with the model name at the bottom and return."""
|
"""Show logo icon with the model name at the bottom and return."""
|
||||||
|
Loading…
Reference in New Issue
Block a user