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

refactor(core): move show_progress to UiFeatures

This commit is contained in:
obrusvit 2024-10-31 23:19:37 +01:00
parent 160e6be4b9
commit 83e0b23ad1
12 changed files with 204 additions and 268 deletions

View File

@ -248,6 +248,34 @@ extern "C" fn new_show_lockscreen(n_args: usize, args: *const Obj, kwargs: *mut
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_progress(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let description: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
let indeterminate: bool = kwargs.get_or(Qstr::MP_QSTR_indeterminate, false)?;
let title: Option<TString> = kwargs
.get(Qstr::MP_QSTR_title)
.and_then(Obj::try_into_option)
.unwrap_or(None);
let layout = ModelUI::show_progress(description, indeterminate, title)?;
Ok(LayoutObj::new_root(layout)?.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_progress_coinjoin(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 indeterminate: bool = kwargs.get_or(Qstr::MP_QSTR_indeterminate, false)?;
let time_ms: u32 = kwargs.get_or(Qstr::MP_QSTR_time_ms, 0)?;
let skip_first_paint: bool = kwargs.get_or(Qstr::MP_QSTR_skip_first_paint, false)?;
let obj = ModelUI::show_progress_coinjoin(title, indeterminate, time_ms, 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()?;
@ -497,6 +525,28 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// """Homescreen for locked device."""
Qstr::MP_QSTR_show_lockscreen => obj_fn_kw!(0, new_show_lockscreen).as_obj(),
/// def show_progress(
/// *,
/// description: str,
/// indeterminate: bool = False,
/// title: str | None = None,
/// ) -> LayoutObj[UiResult]:
/// """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
/// make sure the initial description has at least that amount of lines."""
Qstr::MP_QSTR_show_progress => obj_fn_kw!(0, new_show_progress).as_obj(),
/// def show_progress_coinjoin(
/// *,
/// title: str,
/// indeterminate: bool = False,
/// time_ms: int = 0,
/// skip_first_paint: bool = False,
/// ) -> LayoutObj[UiResult]:
/// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
/// time_ms timeout is passed."""
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).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

@ -1164,50 +1164,6 @@ extern "C" fn new_show_group_share_success(
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_progress(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let description: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
let indeterminate: bool = kwargs.get_or(Qstr::MP_QSTR_indeterminate, false)?;
let title: Option<TString> = kwargs
.get(Qstr::MP_QSTR_title)
.and_then(Obj::try_into_option)
.unwrap_or(None);
let (title, description) = if let Some(title) = title {
(title, description)
} else {
(description, "".into())
};
Ok(LayoutObj::new(Progress::new(title, indeterminate, description))?.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_progress_coinjoin(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 indeterminate: bool = kwargs.get_or(Qstr::MP_QSTR_indeterminate, false)?;
let time_ms: u32 = kwargs.get_or(Qstr::MP_QSTR_time_ms, 0)?;
let skip_first_paint: bool = kwargs.get_or(Qstr::MP_QSTR_skip_first_paint, false)?;
// The second type parameter is actually not used in `new()` but we need to
// provide it.
let progress = CoinJoinProgress::<Never>::new(title, indeterminate)?;
let obj = if time_ms > 0 && indeterminate {
let timeout = Timeout::new(time_ms);
LayoutObj::new((timeout, progress.map(|_msg| None)))?
} else {
LayoutObj::new(progress)?
};
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_confirm_fido(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
#[cfg(feature = "universal_fw")]
return flow::confirm_fido::new_confirm_fido(n_args, args, kwargs);
@ -1512,28 +1468,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// """Shown after successfully finishing a group."""
Qstr::MP_QSTR_show_group_share_success => obj_fn_kw!(0, new_show_group_share_success).as_obj(),
/// def show_progress(
/// *,
/// title: str,
/// indeterminate: bool = False,
/// description: str = "",
/// ) -> LayoutObj[UiResult]:
/// """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
/// make sure the initial description has at least that amount of lines."""
Qstr::MP_QSTR_show_progress => obj_fn_kw!(0, new_show_progress).as_obj(),
/// def show_progress_coinjoin(
/// *,
/// title: str,
/// indeterminate: bool = False,
/// time_ms: int = 0,
/// skip_first_paint: bool = False,
/// ) -> LayoutObj[UiResult]:
/// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
/// time_ms timeout is passed."""
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).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

@ -6,10 +6,7 @@ use crate::{
translations::TR,
ui::{
component::{
connect::Connect,
swipe_detect::SwipeSettings,
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs},
CachedJpeg,
connect::Connect, swipe_detect::SwipeSettings, text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs}, CachedJpeg, ComponentExt, Never, Timeout
},
geometry::Direction,
layout::{
@ -22,8 +19,9 @@ use crate::{
use super::{
component::{
check_homescreen_format, Bip39Input, Frame, Homescreen, Lockscreen, MnemonicKeyboard,
PinKeyboard, SelectWordCount, Slip39Input, SwipeContent, SwipeUpScreen, VerticalMenu,
check_homescreen_format, Bip39Input, CoinJoinProgress, Frame, Homescreen, Lockscreen,
MnemonicKeyboard, PinKeyboard, Progress, SelectWordCount, Slip39Input, SwipeContent,
SwipeUpScreen, VerticalMenu,
},
flow::{self, new_confirm_action_simple, ConfirmActionMenu, ConfirmActionStrings},
theme, ModelMercuryFeatures,
@ -222,6 +220,40 @@ impl UIFeaturesFirmware for ModelMercuryFeatures {
Ok(layout)
}
fn show_progress(
description: TString<'static>,
indeterminate: bool,
title: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error> {
let (title, description) = if let Some(title) = title {
(title, description)
} else {
(description, "".into())
};
let layout = RootComponent::new(Progress::new(title, indeterminate, description));
Ok(layout)
}
fn show_progress_coinjoin(
title: TString<'static>,
indeterminate: bool,
time_ms: u32,
skip_first_paint: bool,
) -> Result<Gc<LayoutObj>, Error> {
let progress = CoinJoinProgress::<Never>::new(title, indeterminate)?;
let obj = if time_ms > 0 && indeterminate {
let timeout = Timeout::new(time_ms);
LayoutObj::new((timeout, progress.map(|_msg| None)))?
} else {
LayoutObj::new(progress)?
};
if skip_first_paint {
obj.skip_first_paint();
}
Ok(obj)
}
fn show_wait_text(text: TString<'static>) -> Result<impl LayoutMaybeTrace, Error> {
let layout = RootComponent::new(Connect::new(text, theme::FG, theme::BG));
Ok(layout)

View File

@ -1327,50 +1327,6 @@ extern "C" fn new_show_group_share_success(
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_progress(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let description: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
let indeterminate: bool = kwargs.get_or(Qstr::MP_QSTR_indeterminate, false)?;
let title: Option<TString> = kwargs
.get(Qstr::MP_QSTR_title)
.and_then(Obj::try_into_option)
.unwrap_or(None);
let mut progress = Progress::new(indeterminate, description);
if let Some(title) = title {
progress = progress.with_title(title);
};
let obj = LayoutObj::new(progress)?;
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_progress_coinjoin(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 indeterminate: bool = kwargs.get_or(Qstr::MP_QSTR_indeterminate, false)?;
let time_ms: u32 = kwargs.get_or(Qstr::MP_QSTR_time_ms, 0)?;
let skip_first_paint: bool = kwargs.get_or(Qstr::MP_QSTR_skip_first_paint, false)?;
// The second type parameter is actually not used in `new()` but we need to
// provide it.
let progress = CoinJoinProgress::new(title, indeterminate);
let obj = if time_ms > 0 && indeterminate {
let timeout = Timeout::new(time_ms);
LayoutObj::new((timeout, progress.map(|_msg| None)))?
} else {
LayoutObj::new(progress)?
};
if skip_first_paint {
obj.skip_first_paint();
}
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
#[no_mangle]
pub static mp_module_trezorui2: Module = obj_module! {
/// from trezor import utils
@ -1647,26 +1603,4 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// ) -> LayoutObj[int]:
/// """Shown after successfully finishing a group."""
Qstr::MP_QSTR_show_group_share_success => obj_fn_kw!(0, new_show_group_share_success).as_obj(),
/// def show_progress(
/// *,
/// description: str,
/// indeterminate: bool = False,
/// title: str | None = None,
/// ) -> LayoutObj[UiResult]:
/// """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
/// make sure the initial description has at least that amount of lines."""
Qstr::MP_QSTR_show_progress => obj_fn_kw!(0, new_show_progress).as_obj(),
/// def show_progress_coinjoin(
/// *,
/// title: str,
/// indeterminate: bool = False,
/// time_ms: int = 0,
/// skip_first_paint: bool = False,
/// ) -> LayoutObj[UiResult]:
/// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
/// time_ms timeout is passed."""
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
};

View File

@ -7,7 +7,9 @@ use crate::{
translations::TR,
ui::{
component::{
connect::Connect, text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt}, Component, ComponentExt, Label, LineBreaking, Paginate, Timeout
connect::Connect,
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt},
Component, ComponentExt, Empty, Label, LineBreaking, Paginate, Timeout,
},
layout::{
obj::{LayoutMaybeTrace, LayoutObj, RootComponent},
@ -19,8 +21,9 @@ use crate::{
use super::{
component::{
ButtonDetails, ButtonPage, ConfirmHomescreen, Frame, Homescreen, Lockscreen,
PassphraseEntry, PinEntry, ScrollableFrame, SimpleChoice, WordlistEntry, WordlistType,
ButtonDetails, ButtonPage, CoinJoinProgress, ConfirmHomescreen, Frame, Homescreen,
Lockscreen, PassphraseEntry, PinEntry, Progress, ScrollableFrame, SimpleChoice,
WordlistEntry, WordlistType,
},
theme, ModelTRFeatures,
};
@ -245,6 +248,39 @@ impl UIFeaturesFirmware for ModelTRFeatures {
Ok(layout)
}
fn show_progress(
description: TString<'static>,
indeterminate: bool,
title: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error> {
let mut progress = Progress::new(indeterminate, description);
if let Some(title) = title {
progress = progress.with_title(title);
};
let layout = RootComponent::new(progress);
Ok(layout)
}
fn show_progress_coinjoin(
title: TString<'static>,
indeterminate: bool,
time_ms: u32,
skip_first_paint: bool,
) -> Result<Gc<LayoutObj>, Error> {
let progress = CoinJoinProgress::new(title, indeterminate);
let obj = if time_ms > 0 && indeterminate {
let timeout = Timeout::new(time_ms);
LayoutObj::new((timeout, progress.map(|_msg| None)))?
} else {
LayoutObj::new(progress)?
};
if skip_first_paint {
obj.skip_first_paint();
}
Ok(obj)
}
fn show_wait_text(text: TString<'static>) -> Result<impl LayoutMaybeTrace, Error> {
let layout = RootComponent::new(Connect::new(text, theme::FG, theme::BG));
Ok(layout)

View File

@ -1304,51 +1304,6 @@ extern "C" fn new_show_remaining_shares(n_args: usize, args: *const Obj, kwargs:
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_progress(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
let description: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
let indeterminate: bool = kwargs.get_or(Qstr::MP_QSTR_indeterminate, false)?;
let title: Option<TString> = kwargs
.get(Qstr::MP_QSTR_title)
.and_then(Obj::try_into_option)
.unwrap_or(None);
let (title, description) = if let Some(title) = title {
(title, description)
} else {
(description, "".into())
};
let obj = LayoutObj::new(Progress::new(title, indeterminate, description))?;
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn new_show_progress_coinjoin(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 indeterminate: bool = kwargs.get_or(Qstr::MP_QSTR_indeterminate, false)?;
let time_ms: u32 = kwargs.get_or(Qstr::MP_QSTR_time_ms, 0)?;
let skip_first_paint: bool = kwargs.get_or(Qstr::MP_QSTR_skip_first_paint, false)?;
// The second type parameter is actually not used in `new()` but we need to
// provide it.
let progress = CoinJoinProgress::<Never>::new(title, indeterminate)?;
let obj = if time_ms > 0 && indeterminate {
let timeout = Timeout::new(time_ms);
LayoutObj::new((timeout, progress.map(|_msg| None)))?
} else {
LayoutObj::new(progress)?
};
if skip_first_paint {
obj.skip_first_paint();
}
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
#[no_mangle]
pub static mp_module_trezorui2: Module = obj_module! {
/// from trezor import utils
@ -1631,28 +1586,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// ) -> LayoutObj[UiResult]:
/// """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(),
/// def show_progress(
/// *,
/// description: str,
/// indeterminate: bool = False,
/// title: str | None = None,
/// ) -> LayoutObj[UiResult]:
/// """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
/// make sure the initial description has at least that amount of lines."""
Qstr::MP_QSTR_show_progress => obj_fn_kw!(0, new_show_progress).as_obj(),
/// def show_progress_coinjoin(
/// *,
/// title: str,
/// indeterminate: bool = False,
/// time_ms: int = 0,
/// skip_first_paint: bool = False,
/// ) -> LayoutObj[UiResult]:
/// """Show progress loader for coinjoin. Returns CANCELLED after a specified time when
/// time_ms timeout is passed."""
Qstr::MP_QSTR_show_progress_coinjoin => obj_fn_kw!(0, new_show_progress_coinjoin).as_obj(),
};
#[cfg(test)]

View File

@ -6,10 +6,7 @@ use crate::{
translations::TR,
ui::{
component::{
connect::Connect,
image::BlendedImage,
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt},
ComponentExt, Empty, Jpeg, Label, Timeout,
connect::Connect, image::BlendedImage, text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt}, ComponentExt, Empty, Jpeg, Label, Never, Timeout
},
layout::{
obj::{LayoutMaybeTrace, LayoutObj, RootComponent},
@ -21,9 +18,7 @@ use crate::{
use super::{
component::{
check_homescreen_format, Bip39Input, Button, ButtonMsg, ButtonPage, ButtonStyleSheet,
CancelConfirmMsg, Dialog, Frame, Homescreen, IconDialog, Lockscreen, MnemonicKeyboard,
PassphraseKeyboard, PinKeyboard, SelectWordCount, SetBrightnessDialog, Slip39Input,
check_homescreen_format, Bip39Input, Button, ButtonMsg, ButtonPage, ButtonStyleSheet, CancelConfirmMsg, CoinJoinProgress, Dialog, Frame, Homescreen, IconDialog, Lockscreen, MnemonicKeyboard, PassphraseKeyboard, PinKeyboard, Progress, SelectWordCount, SetBrightnessDialog, Slip39Input
},
theme, ModelTTFeatures,
};
@ -273,6 +268,40 @@ impl UIFeaturesFirmware for ModelTTFeatures {
Ok(layout)
}
fn show_progress(
description: TString<'static>,
indeterminate: bool,
title: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error> {
let (title, description) = if let Some(title) = title {
(title, description)
} else {
(description, "".into())
};
let layout = RootComponent::new(Progress::new(title, indeterminate, description));
Ok(layout)
}
fn show_progress_coinjoin(
title: TString<'static>,
indeterminate: bool,
time_ms: u32,
skip_first_paint: bool,
) -> Result<Gc<LayoutObj>, Error> {
let progress = CoinJoinProgress::<Never>::new(title, indeterminate)?;
let obj = if time_ms > 0 && indeterminate {
let timeout = Timeout::new(time_ms);
LayoutObj::new((timeout, progress.map(|_msg| None)))?
} else {
LayoutObj::new(progress)?
};
if skip_first_paint {
obj.skip_first_paint();
}
Ok(obj)
}
fn show_wait_text(text: TString<'static>) -> Result<impl LayoutMaybeTrace, Error> {
let layout = RootComponent::new(Connect::new(text, theme::FG, theme::BG));
Ok(layout)

View File

@ -86,5 +86,18 @@ pub trait UIFeaturesFirmware {
coinjoin_authorized: bool,
) -> Result<impl LayoutMaybeTrace, Error>;
fn show_progress(
description: TString<'static>,
indeterminate: bool,
title: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error>;
fn show_progress_coinjoin(
title: TString<'static>,
indeterminate: bool,
time_ms: u32,
skip_first_paint: bool,
) -> Result<Gc<LayoutObj>, Error>; // TODO: return LayoutMaybeTrace
fn show_wait_text(text: TString<'static>) -> Result<impl LayoutMaybeTrace, Error>;
}

View File

@ -300,30 +300,6 @@ def show_group_share_success(
"""Shown after successfully finishing a group."""
# rust/src/ui/model_mercury/layout.rs
def show_progress(
*,
title: str,
indeterminate: bool = False,
description: str = "",
) -> LayoutObj[UiResult]:
"""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
make sure the initial description has at least that amount of lines."""
# rust/src/ui/model_mercury/layout.rs
def show_progress_coinjoin(
*,
title: str,
indeterminate: bool = False,
time_ms: int = 0,
skip_first_paint: bool = False,
) -> LayoutObj[UiResult]:
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
time_ms timeout is passed."""
# rust/src/ui/model_mercury/layout.rs
def tutorial() -> LayoutObj[UiResult]:
"""Show user how to interact with the device."""
@ -1029,27 +1005,3 @@ def show_remaining_shares(
pages: Iterable[tuple[str, str]],
) -> LayoutObj[UiResult]:
"""Shows SLIP39 state after info button is pressed on `confirm_recovery`."""
# rust/src/ui/model_tt/layout.rs
def show_progress(
*,
description: str,
indeterminate: bool = False,
title: str | None = None,
) -> LayoutObj[UiResult]:
"""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
make sure the initial description has at least that amount of lines."""
# rust/src/ui/model_tt/layout.rs
def show_progress_coinjoin(
*,
title: str,
indeterminate: bool = False,
time_ms: int = 0,
skip_first_paint: bool = False,
) -> LayoutObj[UiResult]:
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
time_ms timeout is passed."""

View File

@ -216,6 +216,30 @@ def show_lockscreen(
"""Homescreen for locked device."""
# rust/src/ui/api/firmware_upy.rs
def show_progress(
*,
description: str,
indeterminate: bool = False,
title: str | None = None,
) -> LayoutObj[UiResult]:
"""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
make sure the initial description has at least that amount of lines."""
# rust/src/ui/api/firmware_upy.rs
def show_progress_coinjoin(
*,
title: str,
indeterminate: bool = False,
time_ms: int = 0,
skip_first_paint: bool = False,
) -> LayoutObj[UiResult]:
"""Show progress loader for coinjoin. Returns CANCELLED after a specified time when
time_ms timeout is passed."""
# rust/src/ui/api/firmware_upy.rs
def show_wait_text(message: str, /) -> LayoutObj[None]:
"""Show single-line text in the middle of the screen."""

View File

@ -1,7 +1,6 @@
from typing import TYPE_CHECKING
import storage.cache as storage_cache
import trezorui2
import trezorui_api
from trezor import TR, ui
@ -114,7 +113,7 @@ class Busyscreen(HomescreenBase):
def __init__(self, delay_ms: int) -> None:
skip = storage_cache.homescreen_shown is self.RENDER_INDICATOR
super().__init__(
layout=trezorui2.show_progress_coinjoin(
layout=trezorui_api.show_progress_coinjoin(
title=TR.coinjoin__waiting_for_others,
indeterminate=True,
time_ms=delay_ms,

View File

@ -1,4 +1,4 @@
import trezorui2
import trezorui_api
from trezor import TR, config, ui, utils
@ -30,7 +30,7 @@ def progress(
description = TR.progress__please_wait # def_arg
return ui.ProgressLayout(
layout=trezorui2.show_progress(
layout=trezorui_api.show_progress(
description=description,
title=title,
indeterminate=indeterminate,
@ -44,7 +44,7 @@ def bitcoin_progress(message: str) -> ui.ProgressLayout:
def coinjoin_progress(message: str) -> ui.ProgressLayout:
return ui.ProgressLayout(
layout=trezorui2.show_progress_coinjoin(title=message, indeterminate=False)
layout=trezorui_api.show_progress_coinjoin(title=message, indeterminate=False)
)