diff --git a/core/embed/rust/src/ui/api/firmware_upy.rs b/core/embed/rust/src/ui/api/firmware_upy.rs index d4f35e60a3..21c44d2dac 100644 --- a/core/embed/rust/src/ui/api/firmware_upy.rs +++ b/core/embed/rust/src/ui/api/firmware_upy.rs @@ -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> = + 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.""" diff --git a/core/embed/rust/src/ui/model_mercury/layout.rs b/core/embed/rust/src/ui/model_mercury/layout.rs index 253eb79689..c0166ccf88 100644 --- a/core/embed/rust/src/ui/model_mercury/layout.rs +++ b/core/embed/rust/src/ui/model_mercury/layout.rs @@ -1284,47 +1284,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> = - 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()?; @@ -1680,27 +1639,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(), diff --git a/core/embed/rust/src/ui/model_mercury/ui_features_fw.rs b/core/embed/rust/src/ui/model_mercury/ui_features_fw.rs index ce2140a1a2..7709e9f526 100644 --- a/core/embed/rust/src/ui/model_mercury/ui_features_fw.rs +++ b/core/embed/rust/src/ui/model_mercury/ui_features_fw.rs @@ -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>, + notification_level: u8, + ) -> Result { + 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 { + let layout = RootComponent::new(Lockscreen::new(label, bootscreen, coinjoin_authorized)); + Ok(layout) + } } diff --git a/core/embed/rust/src/ui/model_tr/layout.rs b/core/embed/rust/src/ui/model_tr/layout.rs index ade62f15ef..d3a0be1c6f 100644 --- a/core/embed/rust/src/ui/model_tr/layout.rs +++ b/core/embed/rust/src/ui/model_tr/layout.rs @@ -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 = - 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 = || { @@ -1741,27 +1700,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(), diff --git a/core/embed/rust/src/ui/model_tr/ui_features_fw.rs b/core/embed/rust/src/ui/model_tr/ui_features_fw.rs index 14614e2792..28ccca196f 100644 --- a/core/embed/rust/src/ui/model_tr/ui_features_fw.rs +++ b/core/embed/rust/src/ui/model_tr/ui_features_fw.rs @@ -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>, + notification_level: u8, + ) -> Result { + 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 { + let layout = RootComponent::new(Lockscreen::new(label, bootscreen, coinjoin_authorized)); + Ok(layout) + } } /// Function to create and call a `ButtonPage` dialog based on paginable content diff --git a/core/embed/rust/src/ui/model_tt/layout.rs b/core/embed/rust/src/ui/model_tt/layout.rs index 8ca14b7dfe..74a6ec9925 100644 --- a/core/embed/rust/src/ui/model_tt/layout.rs +++ b/core/embed/rust/src/ui/model_tt/layout.rs @@ -1378,47 +1378,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> = - 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()?; @@ -1750,27 +1709,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(), diff --git a/core/embed/rust/src/ui/model_tt/ui_features_fw.rs b/core/embed/rust/src/ui/model_tt/ui_features_fw.rs index 16ddee65a2..5f33e6c5fd 100644 --- a/core/embed/rust/src/ui/model_tt/ui_features_fw.rs +++ b/core/embed/rust/src/ui/model_tt/ui_features_fw.rs @@ -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>, + notification_level: u8, + ) -> Result { + 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 { + let layout = RootComponent::new(Lockscreen::new(label, bootscreen, coinjoin_authorized)); + Ok(layout) + } } fn new_show_modal( diff --git a/core/embed/rust/src/ui/ui_features_fw.rs b/core/embed/rust/src/ui/ui_features_fw.rs index 8782142cbf..8e8d4320e8 100644 --- a/core/embed/rust/src/ui/ui_features_fw.rs +++ b/core/embed/rust/src/ui/ui_features_fw.rs @@ -59,10 +59,23 @@ pub trait UIFeaturesFirmware { fn select_word_count(recovery_type: RecoveryType) -> Result; + fn show_homescreen( + label: TString<'static>, + hold: bool, + notification: Option>, + notification_level: u8, + ) -> Result; + fn show_info( title: TString<'static>, description: TString<'static>, button: TString<'static>, time_ms: u32, - ) -> Result, Error>; + ) -> Result, Error>; // TODO: return LayoutMaybeTrace + + fn show_lockscreen( + label: TString<'static>, + bootscreen: bool, + coinjoin_authorized: bool, + ) -> Result; } diff --git a/core/mocks/generated/trezorui2.pyi b/core/mocks/generated/trezorui2.pyi index 0b3b8180e9..fb7c4feba6 100644 --- a/core/mocks/generated/trezorui2.pyi +++ b/core/mocks/generated/trezorui2.pyi @@ -346,29 +346,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.""" @@ -782,29 +759,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.""" @@ -1156,29 +1110,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.""" diff --git a/core/mocks/generated/trezorui_api.pyi b/core/mocks/generated/trezorui_api.pyi index c0340dd7ab..08e88bc2bc 100644 --- a/core/mocks/generated/trezorui_api.pyi +++ b/core/mocks/generated/trezorui_api.pyi @@ -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.""" diff --git a/core/src/trezor/ui/layouts/homescreen.py b/core/src/trezor/ui/layouts/homescreen.py index b8210ca465..03bb5061b4 100644 --- a/core/src/trezor/ui/layouts/homescreen.py +++ b/core/src/trezor/ui/layouts/homescreen.py @@ -56,7 +56,7 @@ class Homescreen(HomescreenBase): level = 0 super().__init__( - layout=trezorui2.show_homescreen( + layout=trezorui_api.show_homescreen( label=label, notification=notification, notification_level=level, @@ -96,7 +96,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,