1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 01:18:28 +00:00

refactor(core): move show_homescreen/lockscreen

This commit is contained in:
obrusvit 2024-10-30 16:53:11 +01:00
parent 88c5466288
commit 634d30b165
11 changed files with 175 additions and 267 deletions

View File

@ -8,6 +8,7 @@ use crate::{
util,
},
strutil::TString,
trezorhal::model,
ui::{
backlight::BACKLIGHT_LEVELS_OBJ,
layout::{
@ -156,7 +157,29 @@ extern "C" fn new_select_word_count(n_args: usize, args: *const Obj, kwargs: *mu
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn show_info(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
extern "C" fn new_show_homescreen(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let label: TString<'static> = kwargs
.get(Qstr::MP_QSTR_label)?
.try_into_option()?
.unwrap_or_else(|| model::FULL_NAME.into());
let notification: Option<TString<'static>> =
kwargs.get(Qstr::MP_QSTR_notification)?.try_into_option()?;
let notification_level: u8 = kwargs.get_or(Qstr::MP_QSTR_notification_level, 0)?;
let hold: bool = kwargs.get(Qstr::MP_QSTR_hold)?.try_into()?;
let skip_first_paint: bool = kwargs.get(Qstr::MP_QSTR_skip_first_paint)?.try_into()?;
let layout = ModelUI::show_homescreen(label, hold, notification, notification_level)?;
let layout_obj = LayoutObj::new_root(layout)?;
if skip_first_paint {
layout_obj.skip_first_paint();
}
Ok(layout_obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_info(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
let description: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
@ -171,6 +194,26 @@ extern "C" fn show_info(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Ob
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_lockscreen(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let label: TString<'static> = kwargs
.get(Qstr::MP_QSTR_label)?
.try_into_option()?
.unwrap_or_else(|| model::FULL_NAME.into());
let bootscreen: bool = kwargs.get(Qstr::MP_QSTR_bootscreen)?.try_into()?;
let coinjoin_authorized: bool = kwargs.get_or(Qstr::MP_QSTR_coinjoin_authorized, false)?;
let skip_first_paint: bool = kwargs.get(Qstr::MP_QSTR_skip_first_paint)?.try_into()?;
let layout = ModelUI::show_lockscreen(label, bootscreen, coinjoin_authorized)?;
let layout_obj = LayoutObj::new_root(layout)?;
if skip_first_paint {
layout_obj.skip_first_paint();
}
Ok(layout_obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
pub extern "C" fn upy_check_homescreen_format(data: Obj) -> Obj {
let block = || {
let buffer = data.try_into()?;
@ -363,6 +406,17 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// For unlocking a repeated backup, select from 20 or 33."""
Qstr::MP_QSTR_select_word_count => obj_fn_kw!(0, new_select_word_count).as_obj(),
/// def show_homescreen(
/// *,
/// label: str | None,
/// hold: bool,
/// notification: str | None,
/// notification_level: int = 0,
/// skip_first_paint: bool,
/// ) -> LayoutObj[UiResult]:
/// """Idle homescreen."""
Qstr::MP_QSTR_show_homescreen => obj_fn_kw!(0, new_show_homescreen).as_obj(),
/// def show_info(
/// *,
/// title: str,
@ -371,7 +425,17 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// time_ms: int = 0,
/// ) -> LayoutObj[UiResult]:
/// """Info screen."""
Qstr::MP_QSTR_show_info => obj_fn_kw!(0, show_info).as_obj(),
Qstr::MP_QSTR_show_info => obj_fn_kw!(0, new_show_info).as_obj(),
/// def show_lockscreen(
/// *,
/// label: str | None,
/// bootscreen: bool,
/// skip_first_paint: bool,
/// coinjoin_authorized: bool = False,
/// ) -> LayoutObj[UiResult]:
/// """Homescreen for locked device."""
Qstr::MP_QSTR_show_lockscreen => obj_fn_kw!(0, new_show_lockscreen).as_obj(),
/// class BacklightLevels:
/// """Backlight levels. Values dynamically update based on user settings."""

View File

@ -1269,47 +1269,6 @@ extern "C" fn new_show_progress_coinjoin(n_args: usize, args: *const Obj, kwargs
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_homescreen(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let label: TString<'static> = kwargs
.get(Qstr::MP_QSTR_label)?
.try_into_option()?
.unwrap_or_else(|| model::FULL_NAME.into());
let notification: Option<TString<'static>> =
kwargs.get(Qstr::MP_QSTR_notification)?.try_into_option()?;
let notification_level: u8 = kwargs.get_or(Qstr::MP_QSTR_notification_level, 0)?;
let hold: bool = kwargs.get(Qstr::MP_QSTR_hold)?.try_into()?;
let skip_first_paint: bool = kwargs.get(Qstr::MP_QSTR_skip_first_paint)?.try_into()?;
let notification = notification.map(|w| (w, notification_level));
let obj = LayoutObj::new(Homescreen::new(label, notification, hold))?;
if skip_first_paint {
obj.skip_first_paint();
}
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_lockscreen(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let label: TString<'static> = kwargs
.get(Qstr::MP_QSTR_label)?
.try_into_option()?
.unwrap_or_else(|| model::FULL_NAME.into());
let bootscreen: bool = kwargs.get(Qstr::MP_QSTR_bootscreen)?.try_into()?;
let coinjoin_authorized: bool = kwargs.get_or(Qstr::MP_QSTR_coinjoin_authorized, false)?;
let skip_first_paint: bool = kwargs.get(Qstr::MP_QSTR_skip_first_paint)?.try_into()?;
let obj = LayoutObj::new(Lockscreen::new(label, bootscreen, coinjoin_authorized))?;
if skip_first_paint {
obj.skip_first_paint();
}
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_wait_text(message: Obj) -> Obj {
let block = || {
let message: TString<'static> = message.try_into()?;
@ -1660,27 +1619,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// time_ms timeout is passed."""
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
/// def show_homescreen(
/// *,
/// label: str | None,
/// hold: bool,
/// notification: str | None,
/// notification_level: int = 0,
/// skip_first_paint: bool,
/// ) -> LayoutObj[UiResult]:
/// """Idle homescreen."""
Qstr::MP_QSTR_show_homescreen => obj_fn_kw!(0, new_show_homescreen).as_obj(),
/// def show_lockscreen(
/// *,
/// label: str | None,
/// bootscreen: bool,
/// skip_first_paint: bool,
/// coinjoin_authorized: bool = False,
/// ) -> LayoutObj[UiResult]:
/// """Homescreen for locked device."""
Qstr::MP_QSTR_show_lockscreen => obj_fn_kw!(0, new_show_lockscreen).as_obj(),
/// def tutorial() -> LayoutObj[UiResult]:
/// """Show user how to interact with the device."""
Qstr::MP_QSTR_tutorial => obj_fn_0!(new_show_tutorial).as_obj(),

View File

@ -20,8 +20,8 @@ use crate::{
use super::{
component::{
Bip39Input, Frame, MnemonicKeyboard, PinKeyboard, SelectWordCount, Slip39Input,
SwipeContent, SwipeUpScreen, VerticalMenu,
Bip39Input, Frame, Homescreen, Lockscreen, MnemonicKeyboard, PinKeyboard, SelectWordCount,
Slip39Input, SwipeContent, SwipeUpScreen, VerticalMenu,
},
flow, theme, ModelMercuryFeatures,
};
@ -142,6 +142,17 @@ impl UIFeaturesFirmware for ModelMercuryFeatures {
Ok(layout)
}
fn show_homescreen(
label: TString<'static>,
hold: bool,
notification: Option<TString<'static>>,
notification_level: u8,
) -> Result<impl LayoutMaybeTrace, Error> {
let notification = notification.map(|w| (w, notification_level));
let layout = RootComponent::new(Homescreen::new(label, notification, hold));
Ok(layout)
}
fn show_info(
title: TString<'static>,
description: TString<'static>,
@ -156,4 +167,13 @@ impl UIFeaturesFirmware for ModelMercuryFeatures {
))?;
Ok(obj)
}
fn show_lockscreen(
label: TString<'static>,
bootscreen: bool,
coinjoin_authorized: bool,
) -> Result<impl LayoutMaybeTrace, Error> {
let layout = RootComponent::new(Lockscreen::new(label, bootscreen, coinjoin_authorized));
Ok(layout)
}
}

View File

@ -1381,47 +1381,6 @@ extern "C" fn new_show_progress_coinjoin(n_args: usize, args: *const Obj, kwargs
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_homescreen(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let label: TString = kwargs
.get(Qstr::MP_QSTR_label)?
.try_into_option()?
.unwrap_or_else(|| model::FULL_NAME.into());
let notification: Option<TString> =
kwargs.get(Qstr::MP_QSTR_notification)?.try_into_option()?;
let notification_level: u8 = kwargs.get_or(Qstr::MP_QSTR_notification_level, 0)?;
let skip_first_paint: bool = kwargs.get(Qstr::MP_QSTR_skip_first_paint)?.try_into()?;
let hold: bool = kwargs.get(Qstr::MP_QSTR_hold)?.try_into()?;
let notification = notification.map(|w| (w, notification_level));
let loader_description = hold.then_some("Locking the device...".into());
let obj = LayoutObj::new(Homescreen::new(label, notification, loader_description))?;
if skip_first_paint {
obj.skip_first_paint();
}
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_lockscreen(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let label: TString = kwargs
.get(Qstr::MP_QSTR_label)?
.try_into_option()?
.unwrap_or_else(|| model::FULL_NAME.into());
let bootscreen: bool = kwargs.get(Qstr::MP_QSTR_bootscreen)?.try_into()?;
let coinjoin_authorized: bool = kwargs.get_or(Qstr::MP_QSTR_coinjoin_authorized, false)?;
let skip_first_paint: bool = kwargs.get(Qstr::MP_QSTR_skip_first_paint)?.try_into()?;
let obj = LayoutObj::new(Lockscreen::new(label, bootscreen, coinjoin_authorized))?;
if skip_first_paint {
obj.skip_first_paint();
}
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_wait_text(message: Obj) -> Obj {
let block = || {
@ -1740,27 +1699,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// time_ms timeout is passed."""
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
/// def show_homescreen(
/// *,
/// label: str | None,
/// hold: bool, # unused on TR
/// notification: str | None,
/// notification_level: int = 0,
/// skip_first_paint: bool,
/// ) -> LayoutObj[UiResult]:
/// """Idle homescreen."""
Qstr::MP_QSTR_show_homescreen => obj_fn_kw!(0, new_show_homescreen).as_obj(),
/// def show_lockscreen(
/// *,
/// label: str | None,
/// bootscreen: bool,
/// skip_first_paint: bool,
/// coinjoin_authorized: bool = False,
/// ) -> LayoutObj[UiResult]:
/// """Homescreen for locked device."""
Qstr::MP_QSTR_show_lockscreen => obj_fn_kw!(0, new_show_lockscreen).as_obj(),
/// def show_wait_text(message: str, /) -> None:
/// """Show single-line text in the middle of the screen."""
Qstr::MP_QSTR_show_wait_text => obj_fn_1!(new_show_wait_text).as_obj(),

View File

@ -20,8 +20,8 @@ use crate::{
use super::{
component::{
ButtonDetails, ButtonPage, Frame, PassphraseEntry, PinEntry, ScrollableFrame, SimpleChoice,
WordlistEntry, WordlistType,
ButtonDetails, ButtonPage, Frame, Homescreen, Lockscreen, PassphraseEntry, PinEntry,
ScrollableFrame, SimpleChoice, WordlistEntry, WordlistType,
},
theme, ModelTRFeatures,
};
@ -189,6 +189,18 @@ impl UIFeaturesFirmware for ModelTRFeatures {
Ok(layout)
}
fn show_homescreen(
label: TString<'static>,
hold: bool,
notification: Option<TString<'static>>,
notification_level: u8,
) -> Result<impl LayoutMaybeTrace, Error> {
let notification = notification.map(|w| (w, notification_level));
let loader_description = hold.then_some("Locking the device...".into());
let layout = RootComponent::new(Homescreen::new(label, notification, loader_description));
Ok(layout)
}
fn show_info(
title: TString<'static>,
description: TString<'static>,
@ -210,6 +222,15 @@ impl UIFeaturesFirmware for ModelTRFeatures {
};
Ok(obj)
}
fn show_lockscreen(
label: TString<'static>,
bootscreen: bool,
coinjoin_authorized: bool,
) -> Result<impl LayoutMaybeTrace, Error> {
let layout = RootComponent::new(Lockscreen::new(label, bootscreen, coinjoin_authorized));
Ok(layout)
}
}
/// Function to create and call a `ButtonPage` dialog based on paginable content

View File

@ -1391,47 +1391,6 @@ extern "C" fn new_show_progress_coinjoin(n_args: usize, args: *const Obj, kwargs
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_homescreen(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let label: TString<'static> = kwargs
.get(Qstr::MP_QSTR_label)?
.try_into_option()?
.unwrap_or_else(|| model::FULL_NAME.into());
let notification: Option<TString<'static>> =
kwargs.get(Qstr::MP_QSTR_notification)?.try_into_option()?;
let notification_level: u8 = kwargs.get_or(Qstr::MP_QSTR_notification_level, 0)?;
let hold: bool = kwargs.get(Qstr::MP_QSTR_hold)?.try_into()?;
let skip_first_paint: bool = kwargs.get(Qstr::MP_QSTR_skip_first_paint)?.try_into()?;
let notification = notification.map(|w| (w, notification_level));
let obj = LayoutObj::new(Homescreen::new(label, notification, hold))?;
if skip_first_paint {
obj.skip_first_paint();
}
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_lockscreen(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let label: TString<'static> = kwargs
.get(Qstr::MP_QSTR_label)?
.try_into_option()?
.unwrap_or_else(|| model::FULL_NAME.into());
let bootscreen: bool = kwargs.get(Qstr::MP_QSTR_bootscreen)?.try_into()?;
let coinjoin_authorized: bool = kwargs.get_or(Qstr::MP_QSTR_coinjoin_authorized, false)?;
let skip_first_paint: bool = kwargs.get(Qstr::MP_QSTR_skip_first_paint)?.try_into()?;
let obj = LayoutObj::new(Lockscreen::new(label, bootscreen, coinjoin_authorized))?;
if skip_first_paint {
obj.skip_first_paint();
}
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_wait_text(message: Obj) -> Obj {
let block = || {
let message: TString<'static> = message.try_into()?;
@ -1762,27 +1721,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// time_ms timeout is passed."""
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
/// def show_homescreen(
/// *,
/// label: str | None,
/// hold: bool,
/// notification: str | None,
/// notification_level: int = 0,
/// skip_first_paint: bool,
/// ) -> LayoutObj[UiResult]:
/// """Idle homescreen."""
Qstr::MP_QSTR_show_homescreen => obj_fn_kw!(0, new_show_homescreen).as_obj(),
/// def show_lockscreen(
/// *,
/// label: str | None,
/// bootscreen: bool,
/// skip_first_paint: bool,
/// coinjoin_authorized: bool = False,
/// ) -> LayoutObj[UiResult]:
/// """Homescreen for locked device."""
Qstr::MP_QSTR_show_lockscreen => obj_fn_kw!(0, new_show_lockscreen).as_obj(),
/// def show_wait_text(message: str, /) -> LayoutObj[None]:
/// """Show single-line text in the middle of the screen."""
Qstr::MP_QSTR_show_wait_text => obj_fn_1!(new_show_wait_text).as_obj(),

View File

@ -6,7 +6,9 @@ use crate::{
translations::TR,
ui::{
component::{
image::BlendedImage, text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt}, ComponentExt, Empty, Label, Timeout
image::BlendedImage,
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt},
ComponentExt, Empty, Label, Timeout,
},
layout::{
obj::{LayoutMaybeTrace, LayoutObj, RootComponent},
@ -19,8 +21,8 @@ use crate::{
use super::{
component::{
Bip39Input, Button, ButtonMsg, ButtonPage, ButtonStyleSheet, CancelConfirmMsg, Dialog,
Frame, IconDialog, MnemonicKeyboard, PassphraseKeyboard, PinKeyboard, SelectWordCount,
Slip39Input,
Frame, Homescreen, IconDialog, Lockscreen, MnemonicKeyboard, PassphraseKeyboard,
PinKeyboard, SelectWordCount, Slip39Input,
},
theme, ModelTTFeatures,
};
@ -184,6 +186,17 @@ impl UIFeaturesFirmware for ModelTTFeatures {
Ok(layout)
}
fn show_homescreen(
label: TString<'static>,
hold: bool,
notification: Option<TString<'static>>,
notification_level: u8,
) -> Result<impl LayoutMaybeTrace, Error> {
let notification = notification.map(|w| (w, notification_level));
let layout = RootComponent::new(Homescreen::new(label, notification, hold));
Ok(layout)
}
fn show_info(
title: TString<'static>,
description: TString<'static>,
@ -214,6 +227,15 @@ impl UIFeaturesFirmware for ModelTTFeatures {
)?;
Ok(obj)
}
fn show_lockscreen(
label: TString<'static>,
bootscreen: bool,
coinjoin_authorized: bool,
) -> Result<impl LayoutMaybeTrace, Error> {
let layout = RootComponent::new(Lockscreen::new(label, bootscreen, coinjoin_authorized));
Ok(layout)
}
}
fn new_show_modal(

View File

@ -59,10 +59,23 @@ pub trait UIFeaturesFirmware {
fn select_word_count(recovery_type: RecoveryType) -> Result<impl LayoutMaybeTrace, Error>;
fn show_homescreen(
label: TString<'static>,
hold: bool,
notification: Option<TString<'static>>,
notification_level: u8,
) -> Result<impl LayoutMaybeTrace, Error>;
fn show_info(
title: TString<'static>,
description: TString<'static>,
button: TString<'static>,
time_ms: u32,
) -> Result<Gc<LayoutObj>, Error>;
) -> Result<Gc<LayoutObj>, Error>; // TODO: return LayoutMaybeTrace
fn show_lockscreen(
label: TString<'static>,
bootscreen: bool,
coinjoin_authorized: bool,
) -> Result<impl LayoutMaybeTrace, Error>;
}

View File

@ -341,29 +341,6 @@ def show_progress_coinjoin(
time_ms timeout is passed."""
# rust/src/ui/model_mercury/layout.rs
def show_homescreen(
*,
label: str | None,
hold: bool,
notification: str | None,
notification_level: int = 0,
skip_first_paint: bool,
) -> LayoutObj[UiResult]:
"""Idle homescreen."""
# rust/src/ui/model_mercury/layout.rs
def show_lockscreen(
*,
label: str | None,
bootscreen: bool,
skip_first_paint: bool,
coinjoin_authorized: bool = False,
) -> LayoutObj[UiResult]:
"""Homescreen for locked device."""
# rust/src/ui/model_mercury/layout.rs
def tutorial() -> LayoutObj[UiResult]:
"""Show user how to interact with the device."""
@ -776,29 +753,6 @@ def show_progress_coinjoin(
time_ms timeout is passed."""
# rust/src/ui/model_tr/layout.rs
def show_homescreen(
*,
label: str | None,
hold: bool, # unused on TR
notification: str | None,
notification_level: int = 0,
skip_first_paint: bool,
) -> LayoutObj[UiResult]:
"""Idle homescreen."""
# rust/src/ui/model_tr/layout.rs
def show_lockscreen(
*,
label: str | None,
bootscreen: bool,
skip_first_paint: bool,
coinjoin_authorized: bool = False,
) -> LayoutObj[UiResult]:
"""Homescreen for locked device."""
# rust/src/ui/model_tr/layout.rs
def show_wait_text(message: str, /) -> None:
"""Show single-line text in the middle of the screen."""
@ -1149,29 +1103,6 @@ def show_progress_coinjoin(
time_ms timeout is passed."""
# rust/src/ui/model_tt/layout.rs
def show_homescreen(
*,
label: str | None,
hold: bool,
notification: str | None,
notification_level: int = 0,
skip_first_paint: bool,
) -> LayoutObj[UiResult]:
"""Idle homescreen."""
# rust/src/ui/model_tt/layout.rs
def show_lockscreen(
*,
label: str | None,
bootscreen: bool,
skip_first_paint: bool,
coinjoin_authorized: bool = False,
) -> LayoutObj[UiResult]:
"""Homescreen for locked device."""
# rust/src/ui/model_tt/layout.rs
def show_wait_text(message: str, /) -> LayoutObj[None]:
"""Show single-line text in the middle of the screen."""

View File

@ -165,6 +165,18 @@ def select_word_count(
For unlocking a repeated backup, select from 20 or 33."""
# rust/src/ui/api/firmware_upy.rs
def show_homescreen(
*,
label: str | None,
hold: bool,
notification: str | None,
notification_level: int = 0,
skip_first_paint: bool,
) -> LayoutObj[UiResult]:
"""Idle homescreen."""
# rust/src/ui/api/firmware_upy.rs
def show_info(
*,
@ -176,6 +188,17 @@ def show_info(
"""Info screen."""
# rust/src/ui/api/firmware_upy.rs
def show_lockscreen(
*,
label: str | None,
bootscreen: bool,
skip_first_paint: bool,
coinjoin_authorized: bool = False,
) -> LayoutObj[UiResult]:
"""Homescreen for locked device."""
# rust/src/ui/api/firmware_upy.rs
class BacklightLevels:
"""Backlight levels. Values dynamically update based on user settings."""

View File

@ -53,7 +53,7 @@ class Homescreen(HomescreenBase):
skip = storage_cache.homescreen_shown is self.RENDER_INDICATOR
super().__init__(
layout=trezorui2.show_homescreen(
layout=trezorui_api.show_homescreen(
label=label,
notification=notification,
notification_level=level,
@ -93,7 +93,7 @@ class Lockscreen(HomescreenBase):
not bootscreen and storage_cache.homescreen_shown is self.RENDER_INDICATOR
)
super().__init__(
layout=trezorui2.show_lockscreen(
layout=trezorui_api.show_lockscreen(
label=label,
bootscreen=bootscreen,
skip_first_paint=skip,