From cde0dce3ef2864a202ead820f98d15621fb578a4 Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Tue, 28 May 2024 23:40:52 +0200 Subject: [PATCH] fix(core/ui): T3T1: rebase on main --- core/embed/rust/src/ui/component/map.rs | 2 +- core/embed/rust/src/ui/component/swipe.rs | 2 +- core/embed/rust/src/ui/flow/page.rs | 10 +++------- core/embed/rust/src/ui/flow/store.rs | 6 +++--- core/embed/rust/src/ui/flow/swipe.rs | 6 +++--- .../rust/src/ui/model_mercury/bootloader/mod.rs | 5 ++--- .../ui/model_mercury/component/address_details.rs | 2 +- .../model_mercury/component/coinjoin_progress.rs | 10 +++++----- .../rust/src/ui/model_mercury/component/dialog.rs | 4 ++-- .../rust/src/ui/model_mercury/component/fido.rs | 2 +- .../rust/src/ui/model_mercury/component/footer.rs | 2 +- .../ui/model_mercury/component/homescreen/mod.rs | 6 +++--- .../ui/model_mercury/component/keyboard/bip39.rs | 2 +- .../model_mercury/component/keyboard/mnemonic.rs | 2 +- .../component/keyboard/passphrase.rs | 4 ++-- .../ui/model_mercury/component/keyboard/pin.rs | 4 ++-- .../ui/model_mercury/component/keyboard/slip39.rs | 2 +- .../component/keyboard/word_count.rs | 2 +- .../rust/src/ui/model_mercury/component/loader.rs | 4 ++-- .../ui/model_mercury/component/number_input.rs | 4 ++-- .../rust/src/ui/model_mercury/component/page.rs | 2 +- .../src/ui/model_mercury/component/progress.rs | 15 +++++++-------- .../ui/model_mercury/component/prompt_screen.rs | 2 +- .../rust/src/ui/model_mercury/component/scroll.rs | 2 +- .../src/ui/model_mercury/component/share_words.rs | 4 ++-- .../src/ui/model_mercury/component/simple_page.rs | 2 +- .../ui/model_mercury/component/status_screen.rs | 2 +- .../ui/model_mercury/component/swipe_up_screen.rs | 2 +- .../ui/model_mercury/component/vertical_menu.rs | 2 +- .../src/ui/model_mercury/flow/confirm_output.rs | 4 ++-- .../src/ui/model_mercury/flow/confirm_summary.rs | 2 +- .../rust/src/ui/model_mercury/flow/get_address.rs | 2 +- .../src/ui/model_mercury/flow/request_number.rs | 2 +- core/embed/rust/src/ui/model_mercury/shapes.rs | 2 +- core/embed/rust/src/ui/model_mercury/theme/mod.rs | 2 +- core/src/trezor/ui/layouts/mercury/reset.py | 15 +++++---------- 36 files changed, 66 insertions(+), 77 deletions(-) diff --git a/core/embed/rust/src/ui/component/map.rs b/core/embed/rust/src/ui/component/map.rs index bc7fcf6cf1..82087c672a 100644 --- a/core/embed/rust/src/ui/component/map.rs +++ b/core/embed/rust/src/ui/component/map.rs @@ -102,7 +102,7 @@ where self.inner.paint() } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.inner.render(target); } diff --git a/core/embed/rust/src/ui/component/swipe.rs b/core/embed/rust/src/ui/component/swipe.rs index 6f69262857..ecf0f1ddf0 100644 --- a/core/embed/rust/src/ui/component/swipe.rs +++ b/core/embed/rust/src/ui/component/swipe.rs @@ -155,5 +155,5 @@ impl Component for Swipe { fn paint(&mut self) {} - fn render<'s>(&'s self, _target: &mut impl Renderer<'s>) {} + fn render<'s>(&self, _target: &mut impl Renderer<'s>) {} } diff --git a/core/embed/rust/src/ui/flow/page.rs b/core/embed/rust/src/ui/flow/page.rs index 36395b50a2..896820b24a 100644 --- a/core/embed/rust/src/ui/flow/page.rs +++ b/core/embed/rust/src/ui/flow/page.rs @@ -67,11 +67,7 @@ impl SwipePage { finished } - fn render_transition<'s>( - &'s self, - transition: &'s Transition, - target: &mut impl Renderer<'s>, - ) { + fn render_transition<'s>(&self, transition: &Transition, target: &mut impl Renderer<'s>) { target.in_clip(self.bounds, &|target| { util::render_slide( |target| transition.cloned.render(target), @@ -109,7 +105,7 @@ impl Component for SwipePage { self.inner.paint() } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { if let Some(t) = &self.transition { return self.render_transition(t, target); } @@ -200,7 +196,7 @@ impl Component for IgnoreSwipe { self.0.paint() } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.0.render(target) } } diff --git a/core/embed/rust/src/ui/flow/store.rs b/core/embed/rust/src/ui/flow/store.rs index cf1bd2d60a..62f5444d0b 100644 --- a/core/embed/rust/src/ui/flow/store.rs +++ b/core/embed/rust/src/ui/flow/store.rs @@ -22,7 +22,7 @@ pub trait FlowStore { fn event(&mut self, i: usize, ctx: &mut EventCtx, event: Event) -> Option; /// Call `Component::render` on i-th element. - fn render<'s>(&'s self, i: usize, target: &mut impl Renderer<'s>); + fn render<'s>(&self, i: usize, target: &mut impl Renderer<'s>); #[cfg(feature = "ui_debug")] /// Call `Trace::trace` on i-th element. @@ -62,7 +62,7 @@ impl FlowStore for FlowEmpty { panic!() } - fn render<'s>(&'s self, _i: usize, _target: &mut impl Renderer<'s>) { + fn render<'s>(&self, _i: usize, _target: &mut impl Renderer<'s>) { panic!() } @@ -132,7 +132,7 @@ where } } - fn render<'s>(&'s self, i: usize, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, i: usize, target: &mut impl Renderer<'s>) { if i == 0 { self.as_ref().render(target) } else { diff --git a/core/embed/rust/src/ui/flow/swipe.rs b/core/embed/rust/src/ui/flow/swipe.rs index 70bb21c1df..627dbff1cc 100644 --- a/core/embed/rust/src/ui/flow/swipe.rs +++ b/core/embed/rust/src/ui/flow/swipe.rs @@ -80,12 +80,12 @@ impl SwipeFlow { ctx.request_paint(); } - fn render_state<'s>(&'s self, state: Q, target: &mut impl Renderer<'s>) { + fn render_state<'s>(&self, state: Q, target: &mut impl Renderer<'s>) { self.store.render(state.index(), target) } fn render_transition<'s>( - &'s self, + &self, prev_state: &Q, animation: &Animation, direction: &SwipeDirection, @@ -188,7 +188,7 @@ impl Component for SwipeFlow { fn paint(&mut self) {} - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { match &self.transition { Transition::None | Transition::Internal => self.render_state(self.state, target), Transition::External { diff --git a/core/embed/rust/src/ui/model_mercury/bootloader/mod.rs b/core/embed/rust/src/ui/model_mercury/bootloader/mod.rs index c77d7e1c9c..9462752c69 100644 --- a/core/embed/rust/src/ui/model_mercury/bootloader/mod.rs +++ b/core/embed/rust/src/ui/model_mercury/bootloader/mod.rs @@ -35,7 +35,6 @@ use super::theme::BLACK; #[cfg(feature = "new_rendering")] use crate::ui::{ - constant, display::{toif::Toif, LOADER_MAX}, geometry::{Alignment, Alignment2D}, model_mercury::shapes::{render_loader, LoaderRange}, @@ -123,7 +122,7 @@ impl ModelMercuryFeatures { let center_text_offset: i16 = 10; let center = SCREEN.center() + Offset::y(loader_offset); let inactive_color = bg_color.blend(fg_color, 85); - let end = ((progress as i32 * 8 * shape::PI4 as i32) / 1000) as i16; + let end = 360.0 * progress as f32 / 1000.0; render_loader( center, @@ -133,7 +132,7 @@ impl ModelMercuryFeatures { if progress >= LOADER_MAX { LoaderRange::Full } else { - LoaderRange::FromTo(0, end) + LoaderRange::FromTo(0.0, end) }, target, ); diff --git a/core/embed/rust/src/ui/model_mercury/component/address_details.rs b/core/embed/rust/src/ui/model_mercury/component/address_details.rs index 79cde1c1f1..2e44f4317e 100644 --- a/core/embed/rust/src/ui/model_mercury/component/address_details.rs +++ b/core/embed/rust/src/ui/model_mercury/component/address_details.rs @@ -161,7 +161,7 @@ impl Component for AddressDetails { } } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { match self.current_page { 0 => self.details.render(target), _ => self.xpub_view.render(target), diff --git a/core/embed/rust/src/ui/model_mercury/component/coinjoin_progress.rs b/core/embed/rust/src/ui/model_mercury/component/coinjoin_progress.rs index eabb074037..1977d0c19b 100644 --- a/core/embed/rust/src/ui/model_mercury/component/coinjoin_progress.rs +++ b/core/embed/rust/src/ui/model_mercury/component/coinjoin_progress.rs @@ -124,7 +124,7 @@ where self.label.paint(); } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.content.render(target); let center = constant::screen().center() + Offset::y(LOADER_OFFSET); @@ -132,10 +132,10 @@ where let background_color = theme::BG; let inactive_color = background_color.blend(active_color, 85); - let start = (self.value as i32 - 100) % 1000; - let end = (self.value as i32 + 100) % 1000; - let start = ((start * 8 * shape::PI4 as i32) / 1000) as i16; - let end = ((end * 8 * shape::PI4 as i32) / 1000) as i16; + let start = (self.value as i16 - 100) % 1000; + let end = (self.value as i16 + 100) % 1000; + let start = 360.0 * start as f32 / 1000.0; + let end = 360.0 * end as f32 / 1000.0; shape::Circle::new(center, LOADER_OUTER) .with_bg(inactive_color) diff --git a/core/embed/rust/src/ui/model_mercury/component/dialog.rs b/core/embed/rust/src/ui/model_mercury/component/dialog.rs index 54fb32b152..e5bcd9f883 100644 --- a/core/embed/rust/src/ui/model_mercury/component/dialog.rs +++ b/core/embed/rust/src/ui/model_mercury/component/dialog.rs @@ -72,7 +72,7 @@ where self.controls.paint(); } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.content.render(target); self.controls.render(target); } @@ -202,7 +202,7 @@ where self.controls.paint(); } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.image.render(target); self.paragraphs.render(target); self.controls.render(target); diff --git a/core/embed/rust/src/ui/model_mercury/component/fido.rs b/core/embed/rust/src/ui/model_mercury/component/fido.rs index bdee85ae1b..868c4c2fc2 100644 --- a/core/embed/rust/src/ui/model_mercury/component/fido.rs +++ b/core/embed/rust/src/ui/model_mercury/component/fido.rs @@ -211,7 +211,7 @@ where } } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.icon.render(target); self.controls.render(target); self.app_name.render(target); diff --git a/core/embed/rust/src/ui/model_mercury/component/footer.rs b/core/embed/rust/src/ui/model_mercury/component/footer.rs index 4161b2ba87..d21753c7e6 100644 --- a/core/embed/rust/src/ui/model_mercury/component/footer.rs +++ b/core/embed/rust/src/ui/model_mercury/component/footer.rs @@ -94,7 +94,7 @@ impl<'a> Component for Footer<'a> { todo!() } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { // show description only if there is space for it if self.area.height() == Footer::HEIGHT_DEFAULT { if let Some(description) = self.text_description { diff --git a/core/embed/rust/src/ui/model_mercury/component/homescreen/mod.rs b/core/embed/rust/src/ui/model_mercury/component/homescreen/mod.rs index d9ec8b0e22..7575110641 100644 --- a/core/embed/rust/src/ui/model_mercury/component/homescreen/mod.rs +++ b/core/embed/rust/src/ui/model_mercury/component/homescreen/mod.rs @@ -108,7 +108,7 @@ impl Homescreen { } } - fn render_loader<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render_loader<'s>(&self, target: &mut impl Renderer<'s>) { TR::progress__locking_device.map_translated(|t| { shape::Text::new(TOP_CENTER + Offset::y(HOLD_Y), t) .with_align(Alignment::Center) @@ -186,7 +186,7 @@ impl Component for Homescreen { todo!() } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { if self.loader.is_animating() || self.loader.is_completely_grown(Instant::now()) { self.render_loader(target); } else { @@ -309,7 +309,7 @@ impl Component for Lockscreen<'_> { todo!() } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { let center = AREA.center(); match ImageInfo::parse(self.image) { diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/bip39.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/bip39.rs index 5fb9488af2..c5ce0d1143 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/bip39.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/bip39.rs @@ -107,7 +107,7 @@ impl Component for Bip39Input { todo!("remove when ui-t3t1 done"); } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { let area = self.button.area(); let style = self.button.style(); diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/mnemonic.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/mnemonic.rs index 058a4f606e..a8451149ea 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/mnemonic.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/mnemonic.rs @@ -208,7 +208,7 @@ where } } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { if self.input.inner().inner().is_empty() { self.prompt.render(target); if self.can_go_back { diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/passphrase.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/passphrase.rs index 645882cee1..4f3ffbbaa0 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/passphrase.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/passphrase.rs @@ -377,7 +377,7 @@ impl Component for PassphraseKeyboard { todo!("remove when ui-t3t1 done") } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.input.render(target); self.next_btn.render(target); self.erase_btn.render(target); @@ -441,7 +441,7 @@ impl Component for Input { todo!("remove when ui-t3t1 done"); } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { let style = theme::label_keyboard(); let text_baseline = self.area.top_left() + Offset::y(style.text_font.text_height()) diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/pin.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/pin.rs index 600c10d452..c5350f0dd9 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/pin.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/pin.rs @@ -237,7 +237,7 @@ impl Component for PinKeyboard<'_> { todo!("remove when ui-t3t1 done"); } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.erase_btn.render(target); self.textbox_pad.render(target); @@ -433,7 +433,7 @@ impl Component for PinDots { // TODO: remove when ui-t3t1 done } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { let dot_area = self.area.inset(HEADER_PADDING); self.pad.render(target); if self.display_digits { diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/slip39.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/slip39.rs index 79173a1db0..d4de52fa91 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/slip39.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/slip39.rs @@ -127,7 +127,7 @@ impl Component for Slip39Input { todo!("remove when ui-t3t1 done") } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { let area = self.button.area(); let style = self.button.style(); diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/word_count.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/word_count.rs index 720336473f..3b5ee6473d 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/word_count.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/word_count.rs @@ -67,7 +67,7 @@ impl Component for SelectWordCount { } } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { for btn in self.button.iter() { btn.render(target) } diff --git a/core/embed/rust/src/ui/model_mercury/component/loader.rs b/core/embed/rust/src/ui/model_mercury/component/loader.rs index 78e9e54387..e55ad1022f 100644 --- a/core/embed/rust/src/ui/model_mercury/component/loader.rs +++ b/core/embed/rust/src/ui/model_mercury/component/loader.rs @@ -223,8 +223,8 @@ impl Component for Loader { let active_color = style.active; let background_color = style.background_color; - let end = ((progress as i32 * 8 * shape::PI4 as i32) / 1000) as i16; - let start = 0; + let end = 360.0 * progress as f32 / 1000.0; + let start = 0.0; render_loader( center, diff --git a/core/embed/rust/src/ui/model_mercury/component/number_input.rs b/core/embed/rust/src/ui/model_mercury/component/number_input.rs index d3ff1c18fd..7b2f1052e0 100644 --- a/core/embed/rust/src/ui/model_mercury/component/number_input.rs +++ b/core/embed/rust/src/ui/model_mercury/component/number_input.rs @@ -97,7 +97,7 @@ where todo!("remove when ui-t3t1 done"); } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.input.render(target); self.paragraphs_pad.render(target); self.paragraphs.render(target); @@ -212,7 +212,7 @@ impl Component for NumberInput { todo!("remove when ui-t3t1 done"); } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { let mut buf = [0u8; 10]; if let Some(text) = strutil::format_i64(self.value as i64, &mut buf) { diff --git a/core/embed/rust/src/ui/model_mercury/component/page.rs b/core/embed/rust/src/ui/model_mercury/component/page.rs index 7aab423874..9e501f549c 100644 --- a/core/embed/rust/src/ui/model_mercury/component/page.rs +++ b/core/embed/rust/src/ui/model_mercury/component/page.rs @@ -419,7 +419,7 @@ where } } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.pad.render(target); match &self.loader { Some(l) if l.is_animating() => self.loader.render(target), diff --git a/core/embed/rust/src/ui/model_mercury/component/progress.rs b/core/embed/rust/src/ui/model_mercury/component/progress.rs index c2af34a0aa..604f1ef26d 100644 --- a/core/embed/rust/src/ui/model_mercury/component/progress.rs +++ b/core/embed/rust/src/ui/model_mercury/component/progress.rs @@ -15,7 +15,6 @@ use crate::{ constant, shapes::{render_loader, LoaderRange}, }, - shape, shape::Renderer, util::animation_disabled, }, @@ -111,7 +110,7 @@ impl Component for Progress { self.description.paint(); } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.title.render(target); let center = constant::screen().center() + Offset::y(self.loader_y_offset); @@ -120,17 +119,17 @@ impl Component for Progress { let inactive_color = theme::GREY_EXTRA_DARK; let range = if self.indeterminate { - let start = (self.value - 100) % 1000; - let end = (self.value + 100) % 1000; - let start = ((start as i32 * 8 * shape::PI4 as i32) / 1000) as i16; - let end = ((end as i32 * 8 * shape::PI4 as i32) / 1000) as i16; + let start = (self.value as i16 - 100) % 1000; + let end = (self.value as i16 + 100) % 1000; + let start = 360.0 * start as f32 / 1000.0; + let end = 360.0 * end as f32 / 1000.0; LoaderRange::FromTo(start, end) } else { - let end = ((self.value as i32 * 8 * shape::PI4 as i32) / 1000) as i16; + let end = 360.0 * self.value as f32 / 1000.0; if self.value >= LOADER_MAX { LoaderRange::Full } else { - LoaderRange::FromTo(0, end) + LoaderRange::FromTo(0.0, end) } }; diff --git a/core/embed/rust/src/ui/model_mercury/component/prompt_screen.rs b/core/embed/rust/src/ui/model_mercury/component/prompt_screen.rs index 432603726b..31470ff722 100644 --- a/core/embed/rust/src/ui/model_mercury/component/prompt_screen.rs +++ b/core/embed/rust/src/ui/model_mercury/component/prompt_screen.rs @@ -106,7 +106,7 @@ impl Component for PromptScreen { todo!() } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { shape::Circle::new(self.area.center(), 70) .with_fg(self.circle_pad_color) .with_bg(theme::BLACK) diff --git a/core/embed/rust/src/ui/model_mercury/component/scroll.rs b/core/embed/rust/src/ui/model_mercury/component/scroll.rs index 1ea96fd960..d091082b57 100644 --- a/core/embed/rust/src/ui/model_mercury/component/scroll.rs +++ b/core/embed/rust/src/ui/model_mercury/component/scroll.rs @@ -124,7 +124,7 @@ impl Component for ScrollBar { } } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { fn dotsize(distance: usize, nhidden: usize) -> Icon { match (nhidden.saturating_sub(distance)).min(2 - distance) { 0 => theme::DOT_INACTIVE, diff --git a/core/embed/rust/src/ui/model_mercury/component/share_words.rs b/core/embed/rust/src/ui/model_mercury/component/share_words.rs index b21274b5ff..b443ea3d34 100644 --- a/core/embed/rust/src/ui/model_mercury/component/share_words.rs +++ b/core/embed/rust/src/ui/model_mercury/component/share_words.rs @@ -58,7 +58,7 @@ impl<'a> ShareWords<'a> { self.page_index == self.share_words.len() - 1 } - fn render_word<'s>(&'s self, word_index: usize, target: &mut impl Renderer<'s>) { + fn render_word<'s>(&self, word_index: usize, target: &mut impl Renderer<'s>) { // the share word let word = self.share_words[word_index]; let word_baseline = target.viewport().clip.center() @@ -110,7 +110,7 @@ impl<'a> Component for ShareWords<'a> { // TODO: remove when ui-t3t1 done } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { // corner highlights let (_, top_right_shape, bot_left_shape, bot_right_shape) = shape::CornerHighlight::from_rect(self.area_word, theme::GREY_DARK, theme::BG); diff --git a/core/embed/rust/src/ui/model_mercury/component/simple_page.rs b/core/embed/rust/src/ui/model_mercury/component/simple_page.rs index 6fa2b9bca9..259ee1f626 100644 --- a/core/embed/rust/src/ui/model_mercury/component/simple_page.rs +++ b/core/embed/rust/src/ui/model_mercury/component/simple_page.rs @@ -169,7 +169,7 @@ where } } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.pad.render(target); self.content.render(target); if self.scrollbar.has_pages() { diff --git a/core/embed/rust/src/ui/model_mercury/component/status_screen.rs b/core/embed/rust/src/ui/model_mercury/component/status_screen.rs index 1fe30e7190..dde3d7ac3a 100644 --- a/core/embed/rust/src/ui/model_mercury/component/status_screen.rs +++ b/core/embed/rust/src/ui/model_mercury/component/status_screen.rs @@ -108,7 +108,7 @@ impl Component for StatusScreen { todo!() } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { shape::Circle::new(self.area.center(), 40) .with_fg(self.circle_color) .with_bg(theme::BLACK) diff --git a/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs b/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs index 05f90bab67..fcbbaf2813 100644 --- a/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs +++ b/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs @@ -52,7 +52,7 @@ where todo!() } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { self.content.render(target); } diff --git a/core/embed/rust/src/ui/model_mercury/component/vertical_menu.rs b/core/embed/rust/src/ui/model_mercury/component/vertical_menu.rs index 6773be7a8c..39d31a57ff 100644 --- a/core/embed/rust/src/ui/model_mercury/component/vertical_menu.rs +++ b/core/embed/rust/src/ui/model_mercury/component/vertical_menu.rs @@ -119,7 +119,7 @@ impl Component for VerticalMenu { // TODO remove when ui-t3t1 done } - fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { + fn render<'s>(&self, target: &mut impl Renderer<'s>) { // render buttons separated by thin bars for button in &self.buttons { button.render(target); diff --git a/core/embed/rust/src/ui/model_mercury/flow/confirm_output.rs b/core/embed/rust/src/ui/model_mercury/flow/confirm_output.rs index d5b40aa91a..df5850dca2 100644 --- a/core/embed/rust/src/ui/model_mercury/flow/confirm_output.rs +++ b/core/embed/rust/src/ui/model_mercury/flow/confirm_output.rs @@ -109,7 +109,7 @@ impl ConfirmOutput { .with_chunkify(chunkify) .with_text_mono(text_mono) .into_layout()? - .one_button_request(ButtonRequest::from_tstring(br_code, br_type)); + .one_button_request(ButtonRequest::from_num(br_code, br_type)); // Amount let content_amount = ConfirmBlobParams::new(TR::words__amount.into(), amount, None) @@ -118,7 +118,7 @@ impl ConfirmOutput { .with_footer(TR::instructions__swipe_up.into(), None) .with_text_mono(text_mono) .into_layout()? - .one_button_request(ButtonRequest::from_tstring(br_code, br_type)); + .one_button_request(ButtonRequest::from_num(br_code, br_type)); // Menu let content_menu = Frame::left_aligned( diff --git a/core/embed/rust/src/ui/model_mercury/flow/confirm_summary.rs b/core/embed/rust/src/ui/model_mercury/flow/confirm_summary.rs index 8466b8a370..ccf50743a7 100644 --- a/core/embed/rust/src/ui/model_mercury/flow/confirm_summary.rs +++ b/core/embed/rust/src/ui/model_mercury/flow/confirm_summary.rs @@ -105,7 +105,7 @@ impl ConfirmSummary { } let content_summary = summary .into_layout()? - .one_button_request(ButtonRequest::from_tstring(br_code, br_type)) + .one_button_request(ButtonRequest::from_num(br_code, br_type)) // Summary(1) + Hold(1) .with_pages(|summary_pages| summary_pages + 1); diff --git a/core/embed/rust/src/ui/model_mercury/flow/get_address.rs b/core/embed/rust/src/ui/model_mercury/flow/get_address.rs index 7e3ab61819..2710264892 100644 --- a/core/embed/rust/src/ui/model_mercury/flow/get_address.rs +++ b/core/embed/rust/src/ui/model_mercury/flow/get_address.rs @@ -171,7 +171,7 @@ impl GetAddress { .with_menu_button() .with_footer(TR::instructions__swipe_up.into(), None) .map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info)) - .one_button_request(ButtonRequest::from_tstring(br_code, br_type)) + .one_button_request(ButtonRequest::from_num(br_code, br_type)) // Count tap-to-confirm screen towards page count .with_pages(|address_pages| address_pages + 1); diff --git a/core/embed/rust/src/ui/model_mercury/flow/request_number.rs b/core/embed/rust/src/ui/model_mercury/flow/request_number.rs index b265fdb66c..de5654ac00 100644 --- a/core/embed/rust/src/ui/model_mercury/flow/request_number.rs +++ b/core/embed/rust/src/ui/model_mercury/flow/request_number.rs @@ -109,7 +109,7 @@ impl RequestNumber { FrameMsg::Button(_) => Some(FlowMsg::Info), FrameMsg::Content(NumberInputDialogMsg(n)) => Some(FlowMsg::Choice(n as usize)), }) - .one_button_request(ButtonRequest::from_tstring(br_code, br_type)); + .one_button_request(ButtonRequest::from_num(br_code, br_type)); let content_menu = Frame::left_aligned( "".into(), diff --git a/core/embed/rust/src/ui/model_mercury/shapes.rs b/core/embed/rust/src/ui/model_mercury/shapes.rs index d05fc5d414..c31141c67a 100644 --- a/core/embed/rust/src/ui/model_mercury/shapes.rs +++ b/core/embed/rust/src/ui/model_mercury/shapes.rs @@ -2,7 +2,7 @@ use crate::ui::{display::Color, geometry::Point, model_mercury::constant, shape, pub enum LoaderRange { Full, - FromTo(i16, i16), + FromTo(f32, f32), } pub fn render_loader<'s>( diff --git a/core/embed/rust/src/ui/model_mercury/theme/mod.rs b/core/embed/rust/src/ui/model_mercury/theme/mod.rs index d85a0ed683..bcc93a3446 100644 --- a/core/embed/rust/src/ui/model_mercury/theme/mod.rs +++ b/core/embed/rust/src/ui/model_mercury/theme/mod.rs @@ -8,7 +8,7 @@ use crate::{ FixedHeightBar, }, display::{Color, Font, Icon}, - geometry::{Insets, Offset}, + geometry::Insets, }, }; diff --git a/core/src/trezor/ui/layouts/mercury/reset.py b/core/src/trezor/ui/layouts/mercury/reset.py index 6c8ad0f0a1..4f33788cdf 100644 --- a/core/src/trezor/ui/layouts/mercury/reset.py +++ b/core/src/trezor/ui/layouts/mercury/reset.py @@ -9,10 +9,9 @@ from ..common import interact from . import RustLayout, raise_if_not_confirmed if TYPE_CHECKING: + pass from typing import Callable, Sequence - from trezor.enums import BackupType - CONFIRMED = trezorui2.CONFIRMED # global_import_cache @@ -94,11 +93,11 @@ async def select_word( async def slip39_show_checklist( step: int, - backup_type: BackupType, + advanced: bool, count: int | None = None, threshold: int | None = None, ) -> None: - items = _slip_39_checklist_items(step, backup_type, count, threshold) + items = _slip_39_checklist_items(step, advanced, count, threshold) result = await interact( RustLayout( trezorui2.show_checklist( @@ -117,15 +116,11 @@ async def slip39_show_checklist( def _slip_39_checklist_items( step: int, - backup_type: BackupType, + advanced: bool, count: int | None = None, threshold: int | None = None, ): - from trezor.enums import BackupType - - assert backup_type in (BackupType.Slip39_Basic, BackupType.Slip39_Advanced) - - if backup_type == BackupType.Slip39_Basic: + if not advanced: entry_1 = ( TR.reset__slip39_checklist_num_shares_x_template.format(count) if count