mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-30 03:18:20 +00:00
fix(core/ui): T3T1 lints
[no changelog]
This commit is contained in:
parent
5020868c2c
commit
091b51c9c4
@ -61,3 +61,13 @@ where
|
|||||||
self.inner.trace(t)
|
self.inner.trace(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "micropython")]
|
||||||
|
mod micropython {
|
||||||
|
use crate::{error::Error, micropython::obj::Obj, ui::layout::obj::ComponentMsgObj};
|
||||||
|
impl<T: ComponentMsgObj> ComponentMsgObj for super::Border<T> {
|
||||||
|
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
|
self.inner().msg_try_into_obj(msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -67,3 +67,13 @@ impl crate::trace::Trace for Jpeg {
|
|||||||
t.component("Jpeg");
|
t.component("Jpeg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "micropython")]
|
||||||
|
mod micropython {
|
||||||
|
use crate::{error::Error, micropython::obj::Obj, ui::layout::obj::ComponentMsgObj};
|
||||||
|
impl ComponentMsgObj for super::Jpeg {
|
||||||
|
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
|
unreachable!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -189,3 +189,13 @@ impl crate::trace::Trace for Qr {
|
|||||||
t.string("text", self.text.as_str().into());
|
t.string("text", self.text.as_str().into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "micropython")]
|
||||||
|
mod micropython {
|
||||||
|
use crate::{error::Error, micropython::obj::Obj, ui::layout::obj::ComponentMsgObj};
|
||||||
|
impl ComponentMsgObj for super::Qr {
|
||||||
|
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
|
unreachable!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -160,3 +160,13 @@ impl crate::trace::Trace for FormattedText {
|
|||||||
t.bool("fits", matches!(fit.get(), Some(LayoutFit::Fitting { .. })));
|
t.bool("fits", matches!(fit.get(), Some(LayoutFit::Fitting { .. })));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "micropython")]
|
||||||
|
mod micropython {
|
||||||
|
use crate::{error::Error, micropython::obj::Obj, ui::layout::obj::ComponentMsgObj};
|
||||||
|
impl ComponentMsgObj for super::FormattedText {
|
||||||
|
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
|
unreachable!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -709,6 +709,16 @@ impl<'a, T: ParagraphSource<'a>> crate::trace::Trace for Checklist<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "micropython")]
|
||||||
|
mod micropython {
|
||||||
|
use crate::{error::Error, micropython::obj::Obj, ui::layout::obj::ComponentMsgObj};
|
||||||
|
impl<'a, T: super::ParagraphSource<'a>> ComponentMsgObj for super::Checklist<T> {
|
||||||
|
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
|
unreachable!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait VecExt<'a> {
|
pub trait VecExt<'a> {
|
||||||
fn add(&mut self, paragraph: Paragraph<'a>) -> &mut Self;
|
fn add(&mut self, paragraph: Paragraph<'a>) -> &mut Self;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct Timeout {
|
pub struct Timeout {
|
||||||
time_ms: u32,
|
time_ms: u32,
|
||||||
timer: Option<TimerToken>,
|
timer: Option<TimerToken>,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
pub mod base;
|
pub mod base;
|
||||||
mod flow;
|
|
||||||
pub mod page;
|
pub mod page;
|
||||||
mod store;
|
mod store;
|
||||||
|
mod swipe;
|
||||||
|
|
||||||
pub use base::{FlowMsg, FlowState, Swipable};
|
pub use base::{FlowMsg, FlowState, Swipable};
|
||||||
pub use flow::SwipeFlow;
|
|
||||||
pub use page::{IgnoreSwipe, SwipePage};
|
pub use page::{IgnoreSwipe, SwipePage};
|
||||||
pub use store::{flow_store, FlowStore};
|
pub use store::{flow_store, FlowStore};
|
||||||
|
pub use swipe::SwipeFlow;
|
||||||
|
@ -128,7 +128,7 @@ impl<Q: FlowState, S: FlowStore> SwipeFlow<Q, S> {
|
|||||||
if finished {
|
if finished {
|
||||||
self.transition = Transition::None;
|
self.transition = Transition::None;
|
||||||
}
|
}
|
||||||
return result;
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe_child(&mut self, ctx: &mut EventCtx, direction: SwipeDirection) -> Decision<Q> {
|
fn handle_swipe_child(&mut self, ctx: &mut EventCtx, direction: SwipeDirection) -> Decision<Q> {
|
@ -371,7 +371,7 @@ impl crate::trace::Trace for Button {
|
|||||||
ButtonContent::Text(text) => t.string("text", *text),
|
ButtonContent::Text(text) => t.string("text", *text),
|
||||||
ButtonContent::Icon(_) => t.bool("icon", true),
|
ButtonContent::Icon(_) => t.bool("icon", true),
|
||||||
ButtonContent::IconAndText(content) => {
|
ButtonContent::IconAndText(content) => {
|
||||||
t.string("text", content.text.into());
|
t.string("text", content.text);
|
||||||
t.bool("icon", true);
|
t.bool("icon", true);
|
||||||
}
|
}
|
||||||
ButtonContent::IconBlend(_, _, _) => t.bool("icon", true),
|
ButtonContent::IconBlend(_, _, _) => t.bool("icon", true),
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use super::theme;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
strutil::TString,
|
strutil::TString,
|
||||||
ui::{
|
ui::{
|
||||||
@ -11,9 +10,10 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{constant::SPACING, Button, ButtonMsg, ButtonStyleSheet, CancelInfoConfirmMsg, Footer};
|
use super::{theme, Button, ButtonMsg, ButtonStyleSheet, CancelInfoConfirmMsg, Footer};
|
||||||
|
|
||||||
const TITLE_HEIGHT: i16 = 42;
|
const TITLE_HEIGHT: i16 = 42;
|
||||||
|
const BUTTON_EXPAND_BORDER: i16 = 16;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Frame<T> {
|
pub struct Frame<T> {
|
||||||
@ -84,8 +84,8 @@ where
|
|||||||
|
|
||||||
fn with_button(mut self, icon: Icon, msg: CancelInfoConfirmMsg, enabled: bool) -> Self {
|
fn with_button(mut self, icon: Icon, msg: CancelInfoConfirmMsg, enabled: bool) -> Self {
|
||||||
let touch_area = Insets {
|
let touch_area = Insets {
|
||||||
left: self.border.left * 4,
|
left: BUTTON_EXPAND_BORDER,
|
||||||
bottom: self.border.bottom * 4,
|
bottom: BUTTON_EXPAND_BORDER,
|
||||||
..self.border
|
..self.border
|
||||||
};
|
};
|
||||||
self.button = Some(Child::new(
|
self.button = Some(Child::new(
|
||||||
@ -166,8 +166,8 @@ where
|
|||||||
|
|
||||||
fn place(&mut self, bounds: Rect) -> Rect {
|
fn place(&mut self, bounds: Rect) -> Rect {
|
||||||
let (mut header_area, mut content_area) = bounds.split_top(TITLE_HEIGHT);
|
let (mut header_area, mut content_area) = bounds.split_top(TITLE_HEIGHT);
|
||||||
content_area = content_area.inset(Insets::top(SPACING));
|
content_area = content_area.inset(Insets::top(theme::SPACING));
|
||||||
header_area = header_area.inset(Insets::sides(SPACING));
|
header_area = header_area.inset(Insets::sides(theme::SPACING));
|
||||||
|
|
||||||
if let Some(b) = &mut self.button {
|
if let Some(b) = &mut self.button {
|
||||||
let (rest, button_area) = header_area.split_right(TITLE_HEIGHT);
|
let (rest, button_area) = header_area.split_right(TITLE_HEIGHT);
|
||||||
@ -186,7 +186,7 @@ where
|
|||||||
if let Some(footer) = &mut self.footer {
|
if let Some(footer) = &mut self.footer {
|
||||||
// FIXME: spacer at the bottom might be applied also for usage without footer
|
// FIXME: spacer at the bottom might be applied also for usage without footer
|
||||||
// but not for VerticalMenu
|
// but not for VerticalMenu
|
||||||
content_area = content_area.inset(Insets::bottom(SPACING));
|
content_area = content_area.inset(Insets::bottom(theme::SPACING));
|
||||||
let (remaining, footer_area) = content_area.split_bottom(footer.height());
|
let (remaining, footer_area) = content_area.split_bottom(footer.height());
|
||||||
footer.place(footer_area);
|
footer.place(footer_area);
|
||||||
content_area = remaining;
|
content_area = remaining;
|
||||||
|
@ -11,6 +11,9 @@ use crate::{
|
|||||||
|
|
||||||
use super::{theme, Button, ButtonContent, ButtonMsg};
|
use super::{theme, Button, ButtonContent, ButtonMsg};
|
||||||
|
|
||||||
|
const HOLD_DURATION_MS: u32 = 1000;
|
||||||
|
const BUTTON_SIZE: i16 = 110;
|
||||||
|
|
||||||
/// Component requesting an action from a user. Most typically embedded as a
|
/// Component requesting an action from a user. Most typically embedded as a
|
||||||
/// content of a Frame and promptin "Tap to confirm" or "Hold to XYZ".
|
/// content of a Frame and promptin "Tap to confirm" or "Hold to XYZ".
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@ -34,7 +37,7 @@ impl PromptScreen {
|
|||||||
let icon = theme::ICON_SIGN;
|
let icon = theme::ICON_SIGN;
|
||||||
let button = Button::new(ButtonContent::Icon(icon))
|
let button = Button::new(ButtonContent::Icon(icon))
|
||||||
.styled(theme::button_default())
|
.styled(theme::button_default())
|
||||||
.with_long_press(Duration::from_secs(2));
|
.with_long_press(Duration::from_millis(HOLD_DURATION_MS));
|
||||||
Self {
|
Self {
|
||||||
area: Rect::zero(),
|
area: Rect::zero(),
|
||||||
circle_color: theme::GREEN,
|
circle_color: theme::GREEN,
|
||||||
@ -79,7 +82,7 @@ impl Component for PromptScreen {
|
|||||||
self.area = bounds;
|
self.area = bounds;
|
||||||
self.button.place(Rect::snap(
|
self.button.place(Rect::snap(
|
||||||
self.area.center(),
|
self.area.center(),
|
||||||
Offset::uniform(55),
|
Offset::uniform(BUTTON_SIZE),
|
||||||
Alignment2D::CENTER,
|
Alignment2D::CENTER,
|
||||||
));
|
));
|
||||||
bounds
|
bounds
|
||||||
@ -126,7 +129,7 @@ impl Component for PromptScreen {
|
|||||||
.with_thickness(2)
|
.with_thickness(2)
|
||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
self.button.render(target);
|
self.button.render_content(target, self.button.style());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,11 +3,10 @@ use crate::{
|
|||||||
strutil::TString,
|
strutil::TString,
|
||||||
translations::TR,
|
translations::TR,
|
||||||
ui::{
|
ui::{
|
||||||
component::{Component, Event, EventCtx, Paginate},
|
component::{Component, Event, EventCtx, Paginate, Swipe},
|
||||||
constant::SPACING,
|
|
||||||
flow::Swipable,
|
flow::Swipable,
|
||||||
geometry::{Alignment, Alignment2D, Insets, Offset, Rect},
|
geometry::{Alignment, Alignment2D, Insets, Offset, Rect},
|
||||||
model_mercury::component::{Footer, Swipe, SwipeDirection},
|
model_mercury::component::{Footer, SwipeDirection},
|
||||||
shape,
|
shape,
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
},
|
},
|
||||||
@ -65,8 +64,8 @@ impl<'a> Component for ShareWords<'a> {
|
|||||||
fn place(&mut self, bounds: Rect) -> Rect {
|
fn place(&mut self, bounds: Rect) -> Rect {
|
||||||
self.area = bounds;
|
self.area = bounds;
|
||||||
let used_area = bounds
|
let used_area = bounds
|
||||||
.inset(Insets::sides(SPACING))
|
.inset(Insets::sides(theme::SPACING))
|
||||||
.inset(Insets::bottom(SPACING));
|
.inset(Insets::bottom(theme::SPACING));
|
||||||
|
|
||||||
self.area_word = Rect::snap(
|
self.area_word = Rect::snap(
|
||||||
used_area.center(),
|
used_area.center(),
|
||||||
|
@ -90,13 +90,12 @@ impl Component for StatusScreen {
|
|||||||
match self.dismiss_type {
|
match self.dismiss_type {
|
||||||
DismissType::SwipeUp(ref mut swipe) => {
|
DismissType::SwipeUp(ref mut swipe) => {
|
||||||
let swipe_dir = swipe.event(ctx, event);
|
let swipe_dir = swipe.event(ctx, event);
|
||||||
match swipe_dir {
|
if let Some(SwipeDirection::Up) = swipe_dir {
|
||||||
Some(SwipeDirection::Up) => return Some(()),
|
return Some(());
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DismissType::Timeout(ref mut timeout) => {
|
DismissType::Timeout(ref mut timeout) => {
|
||||||
if let Some(_) = timeout.event(ctx, event) {
|
if timeout.event(ctx, event).is_some() {
|
||||||
return Some(());
|
return Some(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ impl VerticalMenu {
|
|||||||
pub fn select_word(words: [TString<'static>; 3]) -> Self {
|
pub fn select_word(words: [TString<'static>; 3]) -> Self {
|
||||||
let mut buttons_vec = VerticalMenuButtons::new();
|
let mut buttons_vec = VerticalMenuButtons::new();
|
||||||
for word in words {
|
for word in words {
|
||||||
let button = Button::with_text(word.into()).styled(theme::button_default());
|
let button = Button::with_text(word).styled(theme::button_default());
|
||||||
unwrap!(buttons_vec.push(button));
|
unwrap!(buttons_vec.push(button));
|
||||||
}
|
}
|
||||||
Self::new(buttons_vec)
|
Self::new(buttons_vec)
|
||||||
|
@ -20,8 +20,3 @@ pub const fn screen() -> Rect {
|
|||||||
Rect::from_top_left_and_size(Point::zero(), SIZE)
|
Rect::from_top_left_and_size(Point::zero(), SIZE)
|
||||||
}
|
}
|
||||||
pub const SCREEN: Rect = screen();
|
pub const SCREEN: Rect = screen();
|
||||||
|
|
||||||
/// Spacing between components (e.g. header and main content) and offsets from
|
|
||||||
/// the side of the screen. Generally applied everywhere except the top side of
|
|
||||||
/// the header. [px]
|
|
||||||
pub const SPACING: i16 = 2;
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
error,
|
error,
|
||||||
micropython::qstr::Qstr,
|
|
||||||
strutil::TString,
|
strutil::TString,
|
||||||
translations::TR,
|
translations::TR,
|
||||||
ui::{
|
ui::{
|
||||||
@ -65,16 +64,17 @@ use crate::{
|
|||||||
ui::layout::obj::LayoutObj,
|
ui::layout::obj::LayoutObj,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
pub extern "C" fn new_confirm_reset_create(
|
pub extern "C" fn new_confirm_reset_create(
|
||||||
n_args: usize,
|
n_args: usize,
|
||||||
args: *const Obj,
|
args: *const Obj,
|
||||||
kwargs: *mut Map,
|
kwargs: *mut Map,
|
||||||
) -> Obj {
|
) -> Obj {
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, ConfirmResetCreate::new) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, ConfirmResetCreate::new_obj) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConfirmResetCreate {
|
impl ConfirmResetCreate {
|
||||||
fn new(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
fn new_obj(_args: &[Obj], _kwargs: &Map) -> Result<Obj, error::Error> {
|
||||||
let title: TString = TR::reset__title_create_wallet.into();
|
let title: TString = TR::reset__title_create_wallet.into();
|
||||||
let par_array: [Paragraph<'static>; 3] = [
|
let par_array: [Paragraph<'static>; 3] = [
|
||||||
Paragraph::new(&theme::TEXT_MAIN_GREY_LIGHT, TR::reset__by_continuing)
|
Paragraph::new(&theme::TEXT_MAIN_GREY_LIGHT, TR::reset__by_continuing)
|
||||||
|
@ -56,16 +56,17 @@ use crate::{
|
|||||||
ui::layout::obj::LayoutObj,
|
ui::layout::obj::LayoutObj,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
pub extern "C" fn new_confirm_reset_recover(
|
pub extern "C" fn new_confirm_reset_recover(
|
||||||
n_args: usize,
|
n_args: usize,
|
||||||
args: *const Obj,
|
args: *const Obj,
|
||||||
kwargs: *mut Map,
|
kwargs: *mut Map,
|
||||||
) -> Obj {
|
) -> Obj {
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, ConfirmResetRecover::new) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, ConfirmResetRecover::new_obj) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConfirmResetRecover {
|
impl ConfirmResetRecover {
|
||||||
fn new(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
fn new_obj(_args: &[Obj], _kwargs: &Map) -> Result<Obj, error::Error> {
|
||||||
let par_array: [Paragraph<'static>; 3] = [
|
let par_array: [Paragraph<'static>; 3] = [
|
||||||
Paragraph::new(&theme::TEXT_MAIN_GREY_LIGHT, TR::reset__by_continuing)
|
Paragraph::new(&theme::TEXT_MAIN_GREY_LIGHT, TR::reset__by_continuing)
|
||||||
.with_bottom_padding(17),
|
.with_bottom_padding(17),
|
||||||
|
@ -126,12 +126,13 @@ use crate::{
|
|||||||
ui::layout::obj::LayoutObj,
|
ui::layout::obj::LayoutObj,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
pub extern "C" fn new_get_address(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
pub extern "C" fn new_get_address(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, GetAddress::new) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, GetAddress::new_obj) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetAddress {
|
impl GetAddress {
|
||||||
fn new(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
fn new_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
||||||
let title: TString = "Receive address".into(); // TODO: address__title_receive_address w/o uppercase
|
let title: TString = "Receive address".into(); // TODO: address__title_receive_address w/o uppercase
|
||||||
let description: Option<TString> =
|
let description: Option<TString> =
|
||||||
kwargs.get(Qstr::MP_QSTR_description)?.try_into_option()?;
|
kwargs.get(Qstr::MP_QSTR_description)?.try_into_option()?;
|
||||||
|
@ -73,12 +73,13 @@ use crate::{
|
|||||||
ui::layout::obj::LayoutObj,
|
ui::layout::obj::LayoutObj,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
pub extern "C" fn new_prompt_backup(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
pub extern "C" fn new_prompt_backup(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, PromptBackup::new) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, PromptBackup::new_obj) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PromptBackup {
|
impl PromptBackup {
|
||||||
fn new(_args: &[Obj], _kwargs: &Map) -> Result<Obj, error::Error> {
|
fn new_obj(_args: &[Obj], _kwargs: &Map) -> Result<Obj, error::Error> {
|
||||||
let title: TString = TR::backup__title_backup_wallet.into();
|
let title: TString = TR::backup__title_backup_wallet.into();
|
||||||
let par_array: [Paragraph<'static>; 1] = [Paragraph::new(
|
let par_array: [Paragraph<'static>; 1] = [Paragraph::new(
|
||||||
&theme::TEXT_MAIN_GREY_LIGHT,
|
&theme::TEXT_MAIN_GREY_LIGHT,
|
||||||
|
@ -8,10 +8,7 @@ use crate::{
|
|||||||
text::paragraphs::{Paragraph, Paragraphs},
|
text::paragraphs::{Paragraph, Paragraphs},
|
||||||
ComponentExt,
|
ComponentExt,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{base::Decision, flow_store, FlowMsg, FlowState, FlowStore, SwipeFlow, SwipePage},
|
||||||
base::Decision, flow_store, FlowMsg, FlowState, FlowStore, IgnoreSwipe, SwipeFlow,
|
|
||||||
SwipePage,
|
|
||||||
},
|
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -63,12 +60,13 @@ impl FlowState for ShowShareWords {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
pub extern "C" fn new_show_share_words(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
pub extern "C" fn new_show_share_words(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, ShowShareWords::new) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, ShowShareWords::new_obj) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ShowShareWords {
|
impl ShowShareWords {
|
||||||
fn new(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
fn new_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
||||||
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
||||||
let share_words_obj: Obj = kwargs.get(Qstr::MP_QSTR_words)?;
|
let share_words_obj: Obj = kwargs.get(Qstr::MP_QSTR_words)?;
|
||||||
let share_words_vec: Vec<TString, 33> = util::iter_into_vec(share_words_obj)?;
|
let share_words_vec: Vec<TString, 33> = util::iter_into_vec(share_words_obj)?;
|
||||||
|
@ -66,15 +66,16 @@ use crate::{
|
|||||||
ui::layout::obj::LayoutObj,
|
ui::layout::obj::LayoutObj,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
pub extern "C" fn new_warning_hi_prio(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
pub extern "C" fn new_warning_hi_prio(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, WarningHiPrio::new) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, WarningHiPrio::new_obj) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WarningHiPrio {
|
impl WarningHiPrio {
|
||||||
const EXTRA_PADDING: i16 = 6;
|
const EXTRA_PADDING: i16 = 6;
|
||||||
|
|
||||||
fn new(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
fn new_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
||||||
let title: TString = kwargs.get_or(Qstr::MP_QSTR_title, TR::words__warning.try_into()?)?;
|
let title: TString = kwargs.get_or(Qstr::MP_QSTR_title, TR::words__warning.into())?;
|
||||||
let description: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
|
let description: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
|
||||||
let value: TString = kwargs.get_or(Qstr::MP_QSTR_value, "".into())?;
|
let value: TString = kwargs.get_or(Qstr::MP_QSTR_value, "".into())?;
|
||||||
let cancel: TString = TR::words__cancel_and_exit.into();
|
let cancel: TString = TR::words__cancel_and_exit.into();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use core::{cmp::Ordering, convert::TryInto};
|
use core::{cmp::Ordering, convert::TryInto};
|
||||||
use heapless::Vec;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
error::Error,
|
error::Error,
|
||||||
@ -17,7 +16,6 @@ use crate::{
|
|||||||
image::BlendedImage,
|
image::BlendedImage,
|
||||||
jpeg::{ImageBuffer, Jpeg},
|
jpeg::{ImageBuffer, Jpeg},
|
||||||
paginated::{PageMsg, Paginate},
|
paginated::{PageMsg, Paginate},
|
||||||
placed::GridPlaced,
|
|
||||||
text::{
|
text::{
|
||||||
op::OpTextLayout,
|
op::OpTextLayout,
|
||||||
paragraphs::{
|
paragraphs::{
|
||||||
@ -26,7 +24,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
TextStyle,
|
TextStyle,
|
||||||
},
|
},
|
||||||
Border, Component, Empty, FormattedText, Label, Never, Qr, Timeout,
|
Border, Component, Empty, FormattedText, Label, Never, Timeout,
|
||||||
},
|
},
|
||||||
display::tjpgd::jpeg_info,
|
display::tjpgd::jpeg_info,
|
||||||
geometry,
|
geometry,
|
||||||
@ -187,7 +185,6 @@ impl ComponentMsgObj for SelectWordCount {
|
|||||||
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
match msg {
|
match msg {
|
||||||
SelectWordCountMsg::Selected(n) => n.try_into(),
|
SelectWordCountMsg::Selected(n) => n.try_into(),
|
||||||
_ => Err(Error::TypeError),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,18 +198,14 @@ impl ComponentMsgObj for VerticalMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ComponentMsgObj for StatusScreen {
|
impl ComponentMsgObj for StatusScreen {
|
||||||
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
match msg {
|
Ok(CONFIRMED.as_obj())
|
||||||
() => Ok(CONFIRMED.as_obj()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComponentMsgObj for PromptScreen {
|
impl ComponentMsgObj for PromptScreen {
|
||||||
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
match msg {
|
Ok(CONFIRMED.as_obj())
|
||||||
() => Ok(CONFIRMED.as_obj()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,12 +236,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComponentMsgObj for Jpeg {
|
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clippy/compiler complains about conflicting implementations
|
// Clippy/compiler complains about conflicting implementations
|
||||||
// TODO move the common impls to a common module
|
// TODO move the common impls to a common module
|
||||||
#[cfg(not(feature = "clippy"))]
|
#[cfg(not(feature = "clippy"))]
|
||||||
@ -261,21 +248,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComponentMsgObj for FormattedText {
|
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, T> ComponentMsgObj for Checklist<T>
|
|
||||||
where
|
|
||||||
T: ParagraphSource<'a>,
|
|
||||||
{
|
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<F> ComponentMsgObj for NumberInputDialog<F>
|
impl<F> ComponentMsgObj for NumberInputDialog<F>
|
||||||
where
|
where
|
||||||
F: Fn(u32) -> TString<'static>,
|
F: Fn(u32) -> TString<'static>,
|
||||||
@ -289,15 +261,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> ComponentMsgObj for Border<T>
|
|
||||||
where
|
|
||||||
T: ComponentMsgObj,
|
|
||||||
{
|
|
||||||
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
|
||||||
self.inner().msg_try_into_obj(msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentMsgObj for Progress {
|
impl ComponentMsgObj for Progress {
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
@ -320,15 +283,6 @@ impl ComponentMsgObj for Lockscreen<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> ComponentMsgObj for (GridPlaced<Paragraphs<T>>, GridPlaced<FormattedText>)
|
|
||||||
where
|
|
||||||
T: ParagraphSource<'a>,
|
|
||||||
{
|
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clippy/compiler complains about conflicting implementations
|
// Clippy/compiler complains about conflicting implementations
|
||||||
#[cfg(not(feature = "clippy"))]
|
#[cfg(not(feature = "clippy"))]
|
||||||
impl<T> ComponentMsgObj for (Timeout, T)
|
impl<T> ComponentMsgObj for (Timeout, T)
|
||||||
@ -340,12 +294,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComponentMsgObj for Qr {
|
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
|
||||||
unreachable!();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> ComponentMsgObj for SimplePage<T>
|
impl<T> ComponentMsgObj for SimplePage<T>
|
||||||
where
|
where
|
||||||
T: ComponentMsgObj + Paginate,
|
T: ComponentMsgObj + Paginate,
|
||||||
@ -596,7 +544,7 @@ extern "C" fn new_confirm_address(n_args: usize, args: *const Obj, kwargs: *mut
|
|||||||
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
||||||
let description: Option<TString> =
|
let description: Option<TString> =
|
||||||
kwargs.get(Qstr::MP_QSTR_description)?.try_into_option()?;
|
kwargs.get(Qstr::MP_QSTR_description)?.try_into_option()?;
|
||||||
let verb: TString = kwargs.get_or(Qstr::MP_QSTR_verb, TR::buttons__confirm.try_into()?)?;
|
let verb: TString = kwargs.get_or(Qstr::MP_QSTR_verb, TR::buttons__confirm.into())?;
|
||||||
let extra: Option<TString> = kwargs.get(Qstr::MP_QSTR_extra)?.try_into_option()?;
|
let extra: Option<TString> = kwargs.get(Qstr::MP_QSTR_extra)?.try_into_option()?;
|
||||||
let data: Obj = kwargs.get(Qstr::MP_QSTR_data)?;
|
let data: Obj = kwargs.get(Qstr::MP_QSTR_data)?;
|
||||||
let chunkify: bool = kwargs.get_or(Qstr::MP_QSTR_chunkify, false)?;
|
let chunkify: bool = kwargs.get_or(Qstr::MP_QSTR_chunkify, false)?;
|
||||||
@ -669,7 +617,7 @@ extern "C" fn new_confirm_homescreen(n_args: usize, args: *const Obj, kwargs: *m
|
|||||||
jpeg = ImageBuffer::from_slice(theme::IMAGE_HOMESCREEN);
|
jpeg = ImageBuffer::from_slice(theme::IMAGE_HOMESCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let None = jpeg_info(jpeg.data()) {
|
if jpeg_info(jpeg.data()).is_none() {
|
||||||
return Err(value_error!("Invalid image."));
|
return Err(value_error!("Invalid image."));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -871,7 +819,7 @@ fn new_show_modal(
|
|||||||
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
||||||
let value: TString = kwargs.get_or(Qstr::MP_QSTR_value, "".into())?;
|
let value: TString = kwargs.get_or(Qstr::MP_QSTR_value, "".into())?;
|
||||||
let description: TString = kwargs.get_or(Qstr::MP_QSTR_description, "".into())?;
|
let description: TString = kwargs.get_or(Qstr::MP_QSTR_description, "".into())?;
|
||||||
let button: TString = kwargs.get_or(Qstr::MP_QSTR_button, TR::buttons__continue.try_into()?)?;
|
let button: TString = kwargs.get_or(Qstr::MP_QSTR_button, TR::buttons__continue.into())?;
|
||||||
let allow_cancel: bool = kwargs.get_or(Qstr::MP_QSTR_allow_cancel, true)?;
|
let allow_cancel: bool = kwargs.get_or(Qstr::MP_QSTR_allow_cancel, true)?;
|
||||||
let time_ms: u32 = kwargs.get_or(Qstr::MP_QSTR_time_ms, 0)?;
|
let time_ms: u32 = kwargs.get_or(Qstr::MP_QSTR_time_ms, 0)?;
|
||||||
|
|
||||||
@ -965,7 +913,7 @@ extern "C" fn new_confirm_fido(n_args: usize, args: *const Obj, kwargs: *mut Map
|
|||||||
|
|
||||||
let controls = Button::cancel_confirm(
|
let controls = Button::cancel_confirm(
|
||||||
Button::with_icon(theme::ICON_CANCEL),
|
Button::with_icon(theme::ICON_CANCEL),
|
||||||
Button::with_text(TR::buttons__confirm.try_into()?).styled(theme::button_confirm()),
|
Button::with_text(TR::buttons__confirm.into()).styled(theme::button_confirm()),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1031,9 +979,9 @@ extern "C" fn new_show_info(n_args: usize, args: *const Obj, kwargs: *mut Map) -
|
|||||||
extern "C" fn new_show_mismatch(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
extern "C" fn new_show_mismatch(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||||
let block = move |_args: &[Obj], kwargs: &Map| {
|
let block = move |_args: &[Obj], kwargs: &Map| {
|
||||||
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
||||||
let description: TString = TR::addr_mismatch__contact_support_at.try_into()?;
|
let description: TString = TR::addr_mismatch__contact_support_at.into();
|
||||||
let url: TString = TR::addr_mismatch__support_url.try_into()?;
|
let url: TString = TR::addr_mismatch__support_url.into();
|
||||||
let button: TString = TR::buttons__quit.try_into()?;
|
let button: TString = TR::buttons__quit.into();
|
||||||
|
|
||||||
let icon = BlendedImage::new(
|
let icon = BlendedImage::new(
|
||||||
theme::IMAGE_BG_OCTAGON,
|
theme::IMAGE_BG_OCTAGON,
|
||||||
@ -1344,9 +1292,9 @@ extern "C" fn new_confirm_recovery(n_args: usize, args: *const Obj, kwargs: *mut
|
|||||||
let paragraphs = Paragraphs::new([Paragraph::new(&theme::TEXT_NORMAL, description)]);
|
let paragraphs = Paragraphs::new([Paragraph::new(&theme::TEXT_NORMAL, description)]);
|
||||||
|
|
||||||
let notification: TString = if dry_run {
|
let notification: TString = if dry_run {
|
||||||
TR::recovery__title_dry_run.try_into()?
|
TR::recovery__title_dry_run.into()
|
||||||
} else {
|
} else {
|
||||||
TR::recovery__title.try_into()?
|
TR::recovery__title.into()
|
||||||
};
|
};
|
||||||
|
|
||||||
let content = SwipeUpScreen::new(paragraphs);
|
let content = SwipeUpScreen::new(paragraphs);
|
||||||
|
@ -676,10 +676,15 @@ pub const TEXT_CHECKLIST_SELECTED: TextStyle =
|
|||||||
pub const TEXT_CHECKLIST_DONE: TextStyle =
|
pub const TEXT_CHECKLIST_DONE: TextStyle =
|
||||||
TextStyle::new(Font::NORMAL, GREEN_DARK, BG, GREY_LIGHT, GREY_LIGHT);
|
TextStyle::new(Font::NORMAL, GREEN_DARK, BG, GREY_LIGHT, GREY_LIGHT);
|
||||||
|
|
||||||
|
/// Spacing between components (e.g. header and main content) and offsets from
|
||||||
|
/// the side of the screen. Generally applied everywhere except the top side of
|
||||||
|
/// the header. [px]
|
||||||
|
pub const SPACING: i16 = 2;
|
||||||
|
|
||||||
pub const CONTENT_BORDER: i16 = 0;
|
pub const CONTENT_BORDER: i16 = 0;
|
||||||
pub const BUTTON_HEIGHT: i16 = 62;
|
pub const BUTTON_HEIGHT: i16 = 62;
|
||||||
pub const BUTTON_WIDTH: i16 = 78;
|
pub const BUTTON_WIDTH: i16 = 78;
|
||||||
pub const BUTTON_SPACING: i16 = 2;
|
pub const BUTTON_SPACING: i16 = SPACING;
|
||||||
pub const KEYBOARD_SPACING: i16 = BUTTON_SPACING;
|
pub const KEYBOARD_SPACING: i16 = BUTTON_SPACING;
|
||||||
pub const CHECKLIST_SPACING: i16 = 10;
|
pub const CHECKLIST_SPACING: i16 = 10;
|
||||||
pub const RECOVERY_SPACING: i16 = 18;
|
pub const RECOVERY_SPACING: i16 = 18;
|
||||||
|
@ -25,7 +25,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
TextStyle,
|
TextStyle,
|
||||||
},
|
},
|
||||||
Border, Component, Empty, FormattedText, Label, Never, Qr, Timeout,
|
Border, Component, Empty, FormattedText, Label, Never, Timeout,
|
||||||
},
|
},
|
||||||
geometry,
|
geometry,
|
||||||
layout::{
|
layout::{
|
||||||
@ -195,12 +195,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComponentMsgObj for Jpeg {
|
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clippy/compiler complains about conflicting implementations
|
// Clippy/compiler complains about conflicting implementations
|
||||||
// TODO move the common impls to a common module
|
// TODO move the common impls to a common module
|
||||||
#[cfg(not(feature = "clippy"))]
|
#[cfg(not(feature = "clippy"))]
|
||||||
@ -213,21 +207,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComponentMsgObj for FormattedText {
|
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, T> ComponentMsgObj for Checklist<T>
|
|
||||||
where
|
|
||||||
T: ParagraphSource<'a>,
|
|
||||||
{
|
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<F> ComponentMsgObj for NumberInputDialog<F>
|
impl<F> ComponentMsgObj for NumberInputDialog<F>
|
||||||
where
|
where
|
||||||
F: Fn(u32) -> TString<'static>,
|
F: Fn(u32) -> TString<'static>,
|
||||||
@ -241,15 +220,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> ComponentMsgObj for Border<T>
|
|
||||||
where
|
|
||||||
T: ComponentMsgObj,
|
|
||||||
{
|
|
||||||
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
|
||||||
self.inner().msg_try_into_obj(msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentMsgObj for Progress {
|
impl ComponentMsgObj for Progress {
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
@ -292,12 +262,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComponentMsgObj for Qr {
|
|
||||||
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
|
||||||
unreachable!();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> ComponentMsgObj for SimplePage<T>
|
impl<T> ComponentMsgObj for SimplePage<T>
|
||||||
where
|
where
|
||||||
T: ComponentMsgObj + Paginate,
|
T: ComponentMsgObj + Paginate,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import trezorui2
|
import trezorui2
|
||||||
from trezor import TR, io, loop, ui
|
from trezor import TR, io, loop, ui, utils
|
||||||
from trezor.enums import ButtonRequestType
|
from trezor.enums import ButtonRequestType
|
||||||
from trezor.wire import ActionCancelled
|
from trezor.wire import ActionCancelled
|
||||||
from trezor.wire.context import wait as ctx_wait
|
from trezor.wire.context import wait as ctx_wait
|
||||||
@ -942,7 +942,9 @@ async def confirm_summary(
|
|||||||
await raise_if_not_confirmed(with_info(total_layout, info_layout, br_type, br_code))
|
await raise_if_not_confirmed(with_info(total_layout, info_layout, br_type, br_code))
|
||||||
|
|
||||||
|
|
||||||
async def confirm_ethereum_tx(
|
if not utils.BITCOIN_ONLY:
|
||||||
|
|
||||||
|
async def confirm_ethereum_tx(
|
||||||
recipient: str,
|
recipient: str,
|
||||||
total_amount: str,
|
total_amount: str,
|
||||||
maximum_fee: str,
|
maximum_fee: str,
|
||||||
@ -950,7 +952,7 @@ async def confirm_ethereum_tx(
|
|||||||
br_type: str = "confirm_ethereum_tx",
|
br_type: str = "confirm_ethereum_tx",
|
||||||
br_code: ButtonRequestType = ButtonRequestType.SignTx,
|
br_code: ButtonRequestType = ButtonRequestType.SignTx,
|
||||||
chunkify: bool = False,
|
chunkify: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
total_layout = RustLayout(
|
total_layout = RustLayout(
|
||||||
trezorui2.confirm_total(
|
trezorui2.confirm_total(
|
||||||
title=TR.words__title_summary,
|
title=TR.words__title_summary,
|
||||||
@ -988,8 +990,7 @@ async def confirm_ethereum_tx(
|
|||||||
except ActionCancelled:
|
except ActionCancelled:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
async def confirm_ethereum_staking_tx(
|
||||||
async def confirm_ethereum_staking_tx(
|
|
||||||
title: str,
|
title: str,
|
||||||
intro_question: str,
|
intro_question: str,
|
||||||
verb: str,
|
verb: str,
|
||||||
@ -1001,7 +1002,7 @@ async def confirm_ethereum_staking_tx(
|
|||||||
chunkify: bool = False,
|
chunkify: bool = False,
|
||||||
br_type: str = "confirm_ethereum_staking_tx",
|
br_type: str = "confirm_ethereum_staking_tx",
|
||||||
br_code: ButtonRequestType = ButtonRequestType.SignTx,
|
br_code: ButtonRequestType = ButtonRequestType.SignTx,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
# intro
|
# intro
|
||||||
await confirm_value(
|
await confirm_value(
|
||||||
@ -1034,8 +1035,7 @@ async def confirm_ethereum_staking_tx(
|
|||||||
br_code=br_code,
|
br_code=br_code,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def confirm_solana_tx(
|
||||||
async def confirm_solana_tx(
|
|
||||||
amount: str,
|
amount: str,
|
||||||
fee: str,
|
fee: str,
|
||||||
items: Iterable[tuple[str, str]],
|
items: Iterable[tuple[str, str]],
|
||||||
@ -1043,7 +1043,7 @@ async def confirm_solana_tx(
|
|||||||
fee_title: str | None = None,
|
fee_title: str | None = None,
|
||||||
br_type: str = "confirm_solana_tx",
|
br_type: str = "confirm_solana_tx",
|
||||||
br_code: ButtonRequestType = ButtonRequestType.SignTx,
|
br_code: ButtonRequestType = ButtonRequestType.SignTx,
|
||||||
):
|
):
|
||||||
amount_title = (
|
amount_title = (
|
||||||
amount_title if amount_title is not None else f"{TR.words__amount}:"
|
amount_title if amount_title is not None else f"{TR.words__amount}:"
|
||||||
) # def_arg
|
) # def_arg
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import trezorui2
|
import trezorui2
|
||||||
from trezor import TR, ui
|
from trezor import TR, ui, utils
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -60,13 +60,13 @@ def pin_progress(message: str, description: str) -> ProgressLayout:
|
|||||||
return progress(message, description=description)
|
return progress(message, description=description)
|
||||||
|
|
||||||
|
|
||||||
def monero_keyimage_sync_progress() -> ProgressLayout:
|
if not utils.BITCOIN_ONLY:
|
||||||
|
|
||||||
|
def monero_keyimage_sync_progress() -> ProgressLayout:
|
||||||
return progress("", TR.progress__syncing)
|
return progress("", TR.progress__syncing)
|
||||||
|
|
||||||
|
def monero_live_refresh_progress() -> ProgressLayout:
|
||||||
def monero_live_refresh_progress() -> ProgressLayout:
|
|
||||||
return progress("", TR.progress__refreshing, indeterminate=True)
|
return progress("", TR.progress__refreshing, indeterminate=True)
|
||||||
|
|
||||||
|
def monero_transaction_progress_inner() -> ProgressLayout:
|
||||||
def monero_transaction_progress_inner() -> ProgressLayout:
|
|
||||||
return progress("", TR.progress__signing_transaction)
|
return progress("", TR.progress__signing_transaction)
|
||||||
|
Loading…
Reference in New Issue
Block a user