1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-25 04:25:42 +00:00

refactor(core): consistent naming for UI traits

[no changelog]
This commit is contained in:
obrusvit 2024-12-17 12:28:07 +01:00 committed by Vít Obrusník
parent 0e1696b3ed
commit 7e1f160dba
25 changed files with 167 additions and 169 deletions

View File

@ -2,8 +2,9 @@ use crate::{
strutil::hexlify,
trezorhal::secbool::secbool,
ui::{
ui_features::{ModelUI, UIFeaturesBootloader},
ui_bootloader::BootloaderUI,
util::{from_c_array, from_c_str},
ModelUI,
},
};

View File

@ -1,7 +1,7 @@
//! Reexporting the `screens` module according to the
//! current feature (Trezor model)
use crate::ui::ui_features::{ModelUI, UIFeaturesCommon};
use crate::ui::{CommonUI, ModelUI};
use crate::ui::shape;

View File

@ -21,10 +21,10 @@ use crate::{
result::{CANCELLED, CONFIRMED, INFO},
util::{upy_disable_animation, RecoveryType},
},
ui_features::ModelUI,
ui_features_fw::{
UIFeaturesFirmware, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
ui_firmware::{
FirmwareUI, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
},
ModelUI,
},
};
use heapless::Vec;

View File

@ -4,4 +4,4 @@ pub mod common_c;
pub mod bootloader_c;
#[cfg(feature = "micropython")]
pub mod firmware_upy;
pub mod firmware_micropython;

View File

@ -3,7 +3,7 @@ use crate::{
micropython::{
ffi, macros::obj_type, obj::Obj, qstr::Qstr, simple_type::SimpleTypeObj, typ::Type, util,
},
ui::{ui_features::ModelUI, UIFeaturesCommon},
ui::{CommonUI, ModelUI},
};
/*

View File

@ -16,9 +16,8 @@ use crate::{
geometry::{Direction, Rect},
layout::base::{Layout, LayoutState},
shape::{render_on_display, ConcreteRenderer, Renderer, ScopedRenderer},
ui_features::ModelUI,
util::animation_disabled,
UIFeaturesCommon,
CommonUI, ModelUI,
},
};

View File

@ -37,8 +37,7 @@ use crate::{
},
display,
event::USBEvent,
ui_features::ModelUI,
UIFeaturesCommon,
CommonUI, ModelUI,
},
};
@ -97,7 +96,7 @@ impl<T> ComponentMaybeTrace for T where T: Component + ComponentMsgObj + MaybeTr
pub struct RootComponent<T, M>
where
T: Component,
M: UIFeaturesCommon,
M: CommonUI,
{
inner: T,
returned_value: Option<Result<Obj, Error>>,
@ -107,7 +106,7 @@ where
impl<T, M> RootComponent<T, M>
where
T: ComponentMaybeTrace,
M: UIFeaturesCommon,
M: CommonUI,
{
pub fn new(component: T) -> Self {
Self {

View File

@ -8,9 +8,7 @@ use crate::ui::event::ButtonEvent;
use crate::ui::event::TouchEvent;
use crate::ui::{
component::{Component, Event, EventCtx, Never},
display,
ui_features::ModelUI,
UIFeaturesCommon,
display, CommonUI, ModelUI,
};
use num_traits::ToPrimitive;

View File

@ -24,8 +24,23 @@ pub mod model_tr;
#[cfg(feature = "model_tt")]
pub mod model_tt;
pub mod ui_features;
#[cfg(feature = "bootloader")]
pub mod ui_bootloader;
pub mod ui_common;
#[cfg(feature = "micropython")]
pub mod ui_features_fw;
pub mod ui_firmware;
pub use ui_features::UIFeaturesCommon;
pub use ui_common::CommonUI;
#[cfg(all(
feature = "model_mercury",
not(feature = "model_tr"),
not(feature = "model_tt")
))]
pub type ModelUI = crate::ui::model_mercury::UIMercury;
#[cfg(all(feature = "model_tr", not(feature = "model_tt")))]
pub type ModelUI = crate::ui::model_tr::UIModelTR;
#[cfg(feature = "model_tt")]
pub type ModelUI = crate::ui::model_tt::UIModelTT;

View File

@ -26,10 +26,10 @@ use super::{
},
GREEN_LIGHT, GREY,
},
ModelMercuryFeatures,
UIMercury,
};
use crate::ui::{ui_features::UIFeaturesBootloader, UIFeaturesCommon};
use crate::ui::{ui_bootloader::BootloaderUI, CommonUI};
use crate::ui::{
display::{toif::Toif, LOADER_MAX},
@ -53,10 +53,10 @@ pub type BootloaderString = String<128>;
const RECONNECT_MESSAGE: &str = "PLEASE RECONNECT\nTHE DEVICE";
const SCREEN: Rect = ModelMercuryFeatures::SCREEN;
const SCREEN: Rect = UIMercury::SCREEN;
const PROGRESS_TEXT_ORIGIN: Point = Point::new(2, 28);
impl ModelMercuryFeatures {
impl UIMercury {
fn screen_progress(
text: &str,
progress: u16,
@ -122,7 +122,7 @@ impl ModelMercuryFeatures {
}
}
impl UIFeaturesBootloader for ModelMercuryFeatures {
impl BootloaderUI for UIMercury {
fn screen_welcome() {
let mut frame = Welcome::new();
show(&mut frame, true);

View File

@ -1,4 +1,4 @@
use super::{geometry::Rect, UIFeaturesCommon};
use super::{geometry::Rect, CommonUI};
use crate::ui::model_mercury::theme::backlight;
#[cfg(feature = "bootloader")]
@ -7,18 +7,18 @@ pub mod component;
pub mod constant;
pub mod theme;
#[cfg(feature = "micropython")]
pub mod component_msg_obj;
pub mod cshape;
#[cfg(feature = "micropython")]
pub mod flow;
#[cfg(feature = "micropython")]
pub mod layout;
pub mod screens;
#[cfg(feature = "micropython")]
pub mod ui_features_fw;
pub mod ui_firmware;
pub struct ModelMercuryFeatures;
pub struct UIMercury;
impl UIFeaturesCommon for ModelMercuryFeatures {
impl CommonUI for UIMercury {
#[cfg(feature = "backlight")]
fn fadein() {
crate::ui::display::fade_backlight_duration(backlight::get_backlight_normal(), 150);

View File

@ -25,10 +25,10 @@ use crate::{
obj::{LayoutMaybeTrace, LayoutObj, RootComponent},
util::{PropsList, RecoveryType},
},
ui_features::ModelUI,
ui_features_fw::{
UIFeaturesFirmware, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
ui_firmware::{
FirmwareUI, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
},
ModelUI,
},
};
@ -42,10 +42,10 @@ use super::{
self, new_confirm_action_simple, ConfirmActionExtra, ConfirmActionMenuStrings,
ConfirmActionStrings, ConfirmBlobParams, ShowInfoParams,
},
theme, ModelMercuryFeatures,
theme, UIMercury,
};
impl UIFeaturesFirmware for ModelMercuryFeatures {
impl FirmwareUI for UIMercury {
fn confirm_action(
title: TString<'static>,
action: Option<TString<'static>>,

View File

@ -21,7 +21,7 @@ use super::{
bootloader::{BLD_BG, BLD_FG, ICON_ALERT, ICON_SPINNER, ICON_SUCCESS},
ICON_ARM_LEFT, ICON_ARM_RIGHT, TEXT_BOLD, TEXT_NORMAL,
},
ModelTRFeatures,
UIModelTR,
};
use crate::ui::{
@ -34,7 +34,7 @@ mod intro;
mod menu;
mod welcome;
use crate::ui::ui_features::UIFeaturesBootloader;
use crate::ui::ui_bootloader::BootloaderUI;
use intro::Intro;
use menu::Menu;
use welcome::Welcome;
@ -47,7 +47,7 @@ impl ReturnToC for ConfirmMsg {
}
}
impl ModelTRFeatures {
impl UIModelTR {
fn screen_progress(
text: &str,
text2: &str,
@ -92,7 +92,7 @@ impl ModelTRFeatures {
}
}
impl UIFeaturesBootloader for ModelTRFeatures {
impl BootloaderUI for UIModelTR {
fn screen_welcome() {
let mut frame = Welcome::new();
show(&mut frame, true);

View File

@ -1,22 +1,22 @@
use super::{geometry::Rect, UIFeaturesCommon};
use super::{geometry::Rect, CommonUI};
#[cfg(feature = "bootloader")]
pub mod bootloader;
pub mod common_messages;
pub mod component;
#[cfg(feature = "micropython")]
pub mod component_msg_obj;
pub mod constant;
pub mod cshape;
#[cfg(feature = "micropython")]
pub mod layout;
mod screens;
pub mod theme;
pub struct ModelTRFeatures {}
pub struct UIModelTR {}
#[cfg(feature = "micropython")]
pub mod ui_features_fw;
pub mod ui_firmware;
impl UIFeaturesCommon for ModelTRFeatures {
impl CommonUI for UIModelTR {
const SCREEN: Rect = constant::SCREEN;
fn screen_fatal_error(title: &str, msg: &str, footer: &str) {

View File

@ -30,10 +30,10 @@ use crate::{
component::{ButtonActions, ButtonLayout, Page},
constant,
},
ui_features::ModelUI,
ui_features_fw::{
UIFeaturesFirmware, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
ui_firmware::{
FirmwareUI, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
},
ModelUI,
},
};
@ -43,12 +43,12 @@ use super::{
FlowPages, Frame, Homescreen, Lockscreen, NumberInput, PassphraseEntry, PinEntry, Progress,
ScrollableFrame, ShareWords, ShowMore, SimpleChoice, WordlistEntry, WordlistType,
},
theme, ModelTRFeatures,
theme, UIModelTR,
};
use heapless::Vec;
impl UIFeaturesFirmware for ModelTRFeatures {
impl FirmwareUI for UIModelTR {
fn confirm_action(
title: TString<'static>,
action: Option<TString<'static>>,

View File

@ -26,10 +26,10 @@ use super::{
},
FG,
},
ModelTTFeatures,
UIModelTT,
};
use crate::ui::{ui_features::UIFeaturesBootloader, UIFeaturesCommon};
use crate::ui::{ui_bootloader::BootloaderUI, CommonUI};
use crate::ui::{
display::toif::Toif,
@ -56,9 +56,9 @@ pub type BootloaderString = String<128>;
const RECONNECT_MESSAGE: &str = "PLEASE RECONNECT\nTHE DEVICE";
const SCREEN: Rect = ModelTTFeatures::SCREEN;
const SCREEN: Rect = UIModelTT::SCREEN;
impl ModelTTFeatures {
impl UIModelTT {
fn screen_progress(
text: &str,
progress: u16,
@ -133,7 +133,7 @@ impl ModelTTFeatures {
}
}
impl UIFeaturesBootloader for ModelTTFeatures {
impl BootloaderUI for UIModelTT {
fn screen_welcome() {
let mut frame = Welcome::new();
show(&mut frame, true);

View File

@ -1,4 +1,4 @@
use super::{geometry::Rect, UIFeaturesCommon};
use super::{geometry::Rect, CommonUI};
#[cfg(feature = "bootloader")]
pub mod bootloader;
@ -9,21 +9,21 @@ pub mod theme;
#[cfg(feature = "backlight")]
use crate::ui::model_tt::theme::backlight;
pub mod cshape;
#[cfg(feature = "micropython")]
pub mod layout;
pub mod component_msg_obj;
pub mod cshape;
use crate::ui::{
layout::simplified::show,
model_tt::component::{ErrorScreen, WelcomeScreen},
};
pub struct ModelTTFeatures;
pub struct UIModelTT;
#[cfg(feature = "micropython")]
pub mod ui_features_fw;
pub mod ui_firmware;
impl UIFeaturesCommon for ModelTTFeatures {
impl CommonUI for UIModelTT {
#[cfg(feature = "backlight")]
fn fadein() {
crate::ui::display::fade_backlight_duration(backlight::get_backlight_normal(), 150);

View File

@ -25,10 +25,10 @@ use crate::{
obj::{LayoutMaybeTrace, LayoutObj, RootComponent},
util::{ConfirmBlob, PropsList, RecoveryType},
},
ui_features::ModelUI,
ui_features_fw::{
UIFeaturesFirmware, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
ui_firmware::{
FirmwareUI, MAX_CHECKLIST_ITEMS, MAX_GROUP_SHARE_LINES, MAX_WORD_QUIZ_ITEMS,
},
ModelUI,
},
};
@ -40,10 +40,10 @@ use super::{
PassphraseKeyboard, PinKeyboard, Progress, SelectWordCount, SetBrightnessDialog,
ShareWords, SimplePage, Slip39Input,
},
theme, ModelTTFeatures,
theme, UIModelTT,
};
impl UIFeaturesFirmware for ModelTTFeatures {
impl FirmwareUI for UIModelTT {
fn confirm_action(
title: TString<'static>,
action: Option<TString<'static>>,

View File

@ -1,38 +1,8 @@
use crate::ui::geometry::Rect;
#[cfg(feature = "bootloader")]
use crate::trezorhal::secbool::secbool;
pub trait UIFeaturesCommon {
fn fadein() {}
fn fadeout() {}
fn backlight_on() {}
fn get_backlight_none() -> u8 {
0
}
fn get_backlight_normal() -> u8 {
0
}
fn get_backlight_low() -> u8 {
0
}
fn get_backlight_dim() -> u8 {
0
}
fn get_backlight_max() -> u8 {
0
}
const SCREEN: Rect;
fn screen_fatal_error(title: &str, msg: &str, footer: &str);
fn screen_boot_stage_2();
}
#[cfg(feature = "bootloader")]
pub trait UIFeaturesBootloader {
pub trait BootloaderUI {
fn screen_welcome();
fn screen_install_success(restart_seconds: u8, initial_setup: bool, complete_draw: bool);
@ -79,16 +49,3 @@ pub trait UIFeaturesBootloader {
wait: i32,
);
}
#[cfg(all(
feature = "model_mercury",
not(feature = "model_tr"),
not(feature = "model_tt")
))]
pub type ModelUI = crate::ui::model_mercury::ModelMercuryFeatures;
#[cfg(all(feature = "model_tr", not(feature = "model_tt")))]
pub type ModelUI = crate::ui::model_tr::ModelTRFeatures;
#[cfg(feature = "model_tt")]
pub type ModelUI = crate::ui::model_tt::ModelTTFeatures;

View File

@ -0,0 +1,29 @@
use crate::ui::geometry::Rect;
pub trait CommonUI {
fn fadein() {}
fn fadeout() {}
fn backlight_on() {}
fn get_backlight_none() -> u8 {
0
}
fn get_backlight_normal() -> u8 {
0
}
fn get_backlight_low() -> u8 {
0
}
fn get_backlight_dim() -> u8 {
0
}
fn get_backlight_max() -> u8 {
0
}
const SCREEN: Rect;
fn screen_fatal_error(title: &str, msg: &str, footer: &str);
fn screen_boot_stage_2();
}

View File

@ -15,7 +15,7 @@ pub const MAX_CHECKLIST_ITEMS: usize = 3;
pub const MAX_WORD_QUIZ_ITEMS: usize = 3;
pub const MAX_GROUP_SHARE_LINES: usize = 4;
pub trait UIFeaturesFirmware {
pub trait FirmwareUI {
#[allow(clippy::too_many_arguments)]
fn confirm_action(
title: TString<'static>,

View File

@ -3,7 +3,7 @@ from trezor import utils
T = TypeVar("T")
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
class LayoutObj(Generic[T]):
"""Representation of a Rust-based layout object.
see `trezor::ui::layout::obj::LayoutObj`.
@ -61,7 +61,7 @@ class LayoutObj(Generic[T]):
"""Calls drop on contents of the root component."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
class UiResult:
"""Result of a UI operation."""
pass
@ -70,17 +70,17 @@ CANCELLED: UiResult
INFO: UiResult
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def check_homescreen_format(data: bytes) -> bool:
"""Check homescreen format and dimensions."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def disable_animation(disable: bool) -> None:
"""Disable animations, debug builds only."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_action(
*,
title: str,
@ -98,7 +98,7 @@ def confirm_action(
"""Confirm action."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_address(
*,
title: str,
@ -111,7 +111,7 @@ def confirm_address(
"""Confirm address."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_blob(
*,
title: str,
@ -133,7 +133,7 @@ def confirm_blob(
"""Confirm byte sequence data."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_blob_intro(
*,
title: str,
@ -148,7 +148,7 @@ def confirm_blob_intro(
which can then be confirmed using confirm_blob."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_coinjoin(
*,
max_rounds: str,
@ -157,7 +157,7 @@ def confirm_coinjoin(
"""Confirm coinjoin authorization."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_emphasized(
*,
title: str,
@ -168,7 +168,7 @@ def confirm_emphasized(
the first component is a bool indicating whether this part is emphasized."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_fido(
*,
title: str,
@ -181,7 +181,7 @@ def confirm_fido(
"""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_firmware_update(
*,
description: str,
@ -190,7 +190,7 @@ def confirm_firmware_update(
"""Ask whether to update firmware, optionally show fingerprint."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_homescreen(
*,
title: str,
@ -199,7 +199,7 @@ def confirm_homescreen(
"""Confirm homescreen."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_modify_fee(
*,
title: str,
@ -211,7 +211,7 @@ def confirm_modify_fee(
"""Decrease or increase transaction fee."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_modify_output(
*,
sign: int,
@ -221,7 +221,7 @@ def confirm_modify_output(
"""Decrease or increase output amount."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_more(
*,
title: str,
@ -233,7 +233,7 @@ def confirm_more(
Meant to be used with confirm_with_info on model TT and TR."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_properties(
*,
title: str,
@ -244,12 +244,12 @@ def confirm_properties(
the value is to be rendered as binary with monospace font, False otherwise."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_reset_device(recovery: bool) -> LayoutObj[UiResult]:
"""Confirm TOS before creating wallet creation or wallet recovery."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_summary(
*,
amount: str,
@ -265,7 +265,7 @@ def confirm_summary(
"""Confirm summary of a transaction."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_value(
*,
title: str,
@ -283,7 +283,7 @@ def confirm_value(
"""Confirm value. Merge of confirm_total and confirm_output."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def confirm_with_info(
*,
title: str,
@ -297,7 +297,7 @@ def confirm_with_info(
context menu."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def continue_recovery_homepage(
*,
text: str,
@ -310,7 +310,7 @@ def continue_recovery_homepage(
"""Device recovery homescreen."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def flow_confirm_output(
*,
title: str | None,
@ -335,7 +335,7 @@ def flow_confirm_output(
"""Confirm the recipient, (optionally) confirm the amount and (optionally) confirm the summary and present a Hold to Sign page."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def flow_confirm_set_new_pin(
*,
title: str,
@ -344,7 +344,7 @@ def flow_confirm_set_new_pin(
"""Confirm new PIN setup with an option to cancel action."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def flow_get_address(
*,
address: str | bytes,
@ -364,7 +364,7 @@ def flow_get_address(
"""Get address / receive funds."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def multiple_pages_texts(
*,
title: str,
@ -374,12 +374,12 @@ def multiple_pages_texts(
"""Show multiple texts, each on its own page. TR specific."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def prompt_backup() -> LayoutObj[UiResult]:
"""Strongly recommend user to do a backup."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def request_bip39(
*,
prompt: str,
@ -389,7 +389,7 @@ def request_bip39(
"""BIP39 word input keyboard."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def request_slip39(
*,
prompt: str,
@ -399,7 +399,7 @@ def request_slip39(
"""SLIP39 word input keyboard."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def request_number(
*,
title: str,
@ -413,7 +413,7 @@ def request_number(
description."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def request_pin(
*,
prompt: str,
@ -424,7 +424,7 @@ def request_pin(
"""Request pin on device."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def request_passphrase(
*,
prompt: str,
@ -433,7 +433,7 @@ def request_passphrase(
"""Passphrase input keyboard."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def select_word(
*,
title: str,
@ -444,7 +444,7 @@ def select_word(
iterable must be of exact size. Returns index in range `0..3`."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def select_word_count(
*,
recovery_type: RecoveryType,
@ -453,12 +453,12 @@ def select_word_count(
For unlocking a repeated backup, select from 20 or 33."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def set_brightness(*, current: int | None = None) -> LayoutObj[UiResult]:
"""Show the brightness configuration dialog."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_address_details(
*,
qr_title: str,
@ -472,7 +472,7 @@ def show_address_details(
"""Show address details - QR code, account, path, cosigner xpubs."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_checklist(
*,
title: str,
@ -484,7 +484,7 @@ def show_checklist(
mark next to them. Limited to 3 items."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_danger(
*,
title: str,
@ -495,7 +495,7 @@ def show_danger(
"""Warning modal that makes it easier to cancel than to continue."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_error(
*,
title: str,
@ -507,7 +507,7 @@ def show_error(
"""Error modal. No buttons shown when `button` is empty string."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_group_share_success(
*,
lines: Iterable[str],
@ -515,7 +515,7 @@ def show_group_share_success(
"""Shown after successfully finishing a group."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_homescreen(
*,
label: str | None,
@ -527,7 +527,7 @@ def show_homescreen(
"""Idle homescreen."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_info(
*,
title: str,
@ -538,7 +538,7 @@ def show_info(
"""Info screen."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_info_with_cancel(
*,
title: str,
@ -549,7 +549,7 @@ def show_info_with_cancel(
"""Show metadata for outgoing transaction."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_lockscreen(
*,
label: str | None,
@ -560,12 +560,12 @@ def show_lockscreen(
"""Homescreen for locked device."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_mismatch(*, title: str) -> LayoutObj[UiResult]:
"""Warning of receiving address mismatch."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_progress(
*,
description: str,
@ -577,7 +577,7 @@ def show_progress(
make sure the initial description has at least that amount of lines."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_progress_coinjoin(
*,
title: str,
@ -589,7 +589,7 @@ def show_progress_coinjoin(
time_ms timeout is passed."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_remaining_shares(
*,
pages: Iterable[tuple[str, str]],
@ -597,7 +597,7 @@ def show_remaining_shares(
"""Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_share_words(
*,
words: Iterable[str],
@ -606,7 +606,7 @@ def show_share_words(
"""Show mnemonic for backup."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_share_words_mercury(
*,
words: Iterable[str],
@ -619,7 +619,7 @@ def show_share_words_mercury(
confirmation screen."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_simple(
*,
text: str,
@ -629,7 +629,7 @@ def show_simple(
"""Simple dialog with text. TT: optional button."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_success(
*,
title: str,
@ -641,12 +641,12 @@ def show_success(
"""Success modal. No buttons shown when `button` is empty string."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_wait_text(message: str, /) -> LayoutObj[None]:
"""Show single-line text in the middle of the screen."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def show_warning(
*,
title: str,
@ -659,12 +659,12 @@ def show_warning(
"""Warning modal. TT: No buttons shown when `button` is empty string. TR: middle button and centered text."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
def tutorial() -> LayoutObj[UiResult]:
"""Show user how to interact with the device."""
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
class BacklightLevels:
"""Backlight levels. Values dynamically update based on user settings."""
MAX: ClassVar[int]
@ -674,7 +674,7 @@ class BacklightLevels:
NONE: ClassVar[int]
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
class AttachType:
INITIAL: ClassVar[int]
RESUME: ClassVar[int]
@ -684,7 +684,7 @@ class AttachType:
SWIPE_RIGHT: ClassVar[int]
# rust/src/ui/api/firmware_upy.rs
# rust/src/ui/api/firmware_micropython.rs
class LayoutState:
"""Layout state."""
INITIAL: "ClassVar[LayoutState]"