diff --git a/core/embed/rust/src/ui/layout/obj.rs b/core/embed/rust/src/ui/layout/obj.rs index eae3779905..9d780a40f1 100644 --- a/core/embed/rust/src/ui/layout/obj.rs +++ b/core/embed/rust/src/ui/layout/obj.rs @@ -10,7 +10,7 @@ use num_traits::{FromPrimitive, ToPrimitive}; #[cfg(feature = "button")] use crate::ui::event::ButtonEvent; #[cfg(feature = "new_rendering")] -use crate::ui::{display::Color, shape::render_on_display, shape::Renderer}; +use crate::ui::{display::Color, shape::render_on_display}; #[cfg(feature = "touch")] use crate::ui::{event::TouchEvent, geometry::Direction}; use crate::{ @@ -31,9 +31,8 @@ use crate::{ ui::{ button_request::ButtonRequest, component::{base::{AttachType, TimerToken}, Component, Event, EventCtx, Never}, - constant, display, + display, event::USBEvent, - geometry::Rect, ui_features::ModelUI, UIFeaturesCommon, }, @@ -88,52 +87,7 @@ pub trait ComponentMsgObj: Component { fn msg_try_into_obj(&self, msg: Self::Msg) -> Result; } -/// Object-safe interface between trait `Component` and MicroPython world. It -/// converts the result of `Component::event` into `Obj` via the -/// `ComponentMsgObj` trait, in order to easily return the value to Python. It -/// also optionally implies `Trace` for UI debugging. -/// Note: we need to use an object-safe trait in order to store it in a `Gc` field. `Component` itself is not object-safe because of `Component::Msg` -/// associated type. -// pub trait ObjComponent: MaybeTrace { -// fn obj_place(&mut self, bounds: Rect) -> Rect; -// fn obj_event(&mut self, ctx: &mut EventCtx, event: Event) -> Result; fn obj_paint(&mut self); -// fn obj_bounds(&self, _sink: &mut dyn FnMut(Rect)) {} -// } - -// impl ObjComponent for T -// where -// T: Component + ComponentMsgObj + MaybeTrace, -// { -// fn obj_place(&mut self, bounds: Rect) -> Rect { -// self.place(bounds) -// } - -// fn obj_event(&mut self, ctx: &mut EventCtx, event: Event) -> Result { if let Some(msg) = self.event(ctx, event) { -// self.msg_try_into_obj(msg) -// } else { -// Ok(Obj::const_none()) -// } -// } - -// fn obj_paint(&mut self) { -// #[cfg(not(feature = "new_rendering"))] -// { -// self.paint(); -// } - -// #[cfg(feature = "new_rendering")] -// { -// render_on_display(None, Some(Color::black()), |target| { -// self.render(target); -// }); -// } -// } -// } - -trait ComponentMaybeTrace: Component + ComponentMsgObj + MaybeTrace {} +pub trait ComponentMaybeTrace: Component + ComponentMsgObj + MaybeTrace {} impl ComponentMaybeTrace for T where T: Component + ComponentMsgObj + MaybeTrace {} struct RootComponent @@ -205,7 +159,7 @@ where } } -trait LayoutMaybeTrace: Layout> + MaybeTrace {} +pub trait LayoutMaybeTrace: Layout> + MaybeTrace {} impl LayoutMaybeTrace for T where T: Layout> + MaybeTrace {} #[derive(Copy, Clone, PartialEq, Eq)] diff --git a/core/embed/rust/src/ui/layout/result.rs b/core/embed/rust/src/ui/layout/result.rs index 6e66c63cf3..bf91424b38 100644 --- a/core/embed/rust/src/ui/layout/result.rs +++ b/core/embed/rust/src/ui/layout/result.rs @@ -1,9 +1,4 @@ -use crate::micropython::{ - macros::{obj_dict, obj_map, obj_type}, - qstr::Qstr, - simple_type::SimpleTypeObj, - typ::Type, -}; +use crate::micropython::{macros::obj_type, qstr::Qstr, simple_type::SimpleTypeObj, typ::Type}; static CONFIRMED_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_CONFIRMED, }; static CANCELLED_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_CANCELLED, }; diff --git a/core/embed/rust/src/ui/model_mercury/component/homescreen.rs b/core/embed/rust/src/ui/model_mercury/component/homescreen.rs index 379f2b2213..892cebfc96 100644 --- a/core/embed/rust/src/ui/model_mercury/component/homescreen.rs +++ b/core/embed/rust/src/ui/model_mercury/component/homescreen.rs @@ -365,7 +365,7 @@ impl HideLabelAnimation { } } } - Event::Timer(token) if self.timer.expire(event) && !animation_disabled() => { + Event::Timer(_) if self.timer.expire(event) && !animation_disabled() => { self.stopwatch.start(); ctx.request_anim_frame(); self.animating = true; @@ -524,7 +524,7 @@ impl Homescreen { self.loader.start_shrinking(ctx, now); } } - Event::Timer(token) if self.delay.expire(event) => { + Event::Timer(_) if self.delay.expire(event) => { self.loader.start_growing(ctx, Instant::now()); } _ => {} diff --git a/core/embed/rust/src/ui/model_tt/bootloader/mod.rs b/core/embed/rust/src/ui/model_tt/bootloader/mod.rs index f8e53c53e9..e83c6f9369 100644 --- a/core/embed/rust/src/ui/model_tt/bootloader/mod.rs +++ b/core/embed/rust/src/ui/model_tt/bootloader/mod.rs @@ -36,7 +36,6 @@ use super::theme::BLACK; #[cfg(feature = "new_rendering")] use crate::ui::{ - constant, display::toif::Toif, geometry::{Alignment, Alignment2D, Offset}, shape,