mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-28 15:22:14 +00:00
chore(eckhart): fix some clippy warnings
This commit is contained in:
parent
0db51e8624
commit
e992b77924
@ -1,13 +1,15 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
component::{Component, Event, EventCtx, Never, Pad},
|
component::{Component, Event, EventCtx, Never, Pad},
|
||||||
constant::screen,
|
constant::screen,
|
||||||
display::Font,
|
|
||||||
geometry::{Offset, Point, Rect},
|
geometry::{Offset, Point, Rect},
|
||||||
shape,
|
shape,
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::theme::{BLACK, GREY, WHITE};
|
use super::{
|
||||||
|
super::theme::{BLACK, GREY, WHITE},
|
||||||
|
fonts,
|
||||||
|
};
|
||||||
|
|
||||||
const TEXT_ORIGIN: Point = Point::new(0, 105);
|
const TEXT_ORIGIN: Point = Point::new(0, 105);
|
||||||
const STRIDE: i16 = 22;
|
const STRIDE: i16 = 22;
|
||||||
@ -39,28 +41,26 @@ impl Component for Welcome {
|
|||||||
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
||||||
self.bg.render(target);
|
self.bg.render(target);
|
||||||
|
|
||||||
shape::Text::new(TEXT_ORIGIN, "Get started")
|
let font = fonts::FONT_SATOSHI_REGULAR_38;
|
||||||
.with_font(Font::NORMAL)
|
shape::Text::new(TEXT_ORIGIN, "Get started", font)
|
||||||
.with_fg(GREY)
|
.with_fg(GREY)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
shape::Text::new(TEXT_ORIGIN + Offset::y(STRIDE), "with your Trezor")
|
shape::Text::new(TEXT_ORIGIN + Offset::y(STRIDE), "with your Trezor", font)
|
||||||
.with_font(Font::NORMAL)
|
|
||||||
.with_fg(GREY)
|
.with_fg(GREY)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
shape::Text::new(TEXT_ORIGIN + Offset::y(2 * STRIDE), "at")
|
shape::Text::new(TEXT_ORIGIN + Offset::y(2 * STRIDE), "at", font)
|
||||||
.with_font(Font::NORMAL)
|
|
||||||
.with_fg(GREY)
|
.with_fg(GREY)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
let at_width = Font::NORMAL.text_width("at ");
|
let at_width = font.text_width("at ");
|
||||||
|
|
||||||
shape::Text::new(
|
shape::Text::new(
|
||||||
TEXT_ORIGIN + Offset::new(at_width, 2 * STRIDE),
|
TEXT_ORIGIN + Offset::new(at_width, 2 * STRIDE),
|
||||||
"trezor.io/start",
|
"trezor.io/start",
|
||||||
|
font,
|
||||||
)
|
)
|
||||||
.with_font(Font::NORMAL)
|
|
||||||
.with_fg(WHITE)
|
.with_fg(WHITE)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
|
@ -116,13 +116,11 @@ impl<'a> Component for Hint<'a> {
|
|||||||
let bounds = bounds.inset(Self::HINT_INSETS);
|
let bounds = bounds.inset(Self::HINT_INSETS);
|
||||||
match &mut self.content {
|
match &mut self.content {
|
||||||
HintContent::Instruction(instruction) => {
|
HintContent::Instruction(instruction) => {
|
||||||
if let Some(icon) = instruction.icon {
|
let text_area = match instruction.icon {
|
||||||
let icon_width = instruction.icon_width();
|
Some(_) => bounds.split_left(instruction.icon_width()).1,
|
||||||
let text_area = bounds.split_left(icon_width).1;
|
None => bounds,
|
||||||
instruction.label.place(text_area);
|
};
|
||||||
} else {
|
instruction.label.place(text_area);
|
||||||
instruction.label.place(bounds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
use crate::{
|
use crate::ui::{
|
||||||
strutil::TString,
|
component::{
|
||||||
ui::{
|
swipe_detect::SwipeConfig,
|
||||||
component::{
|
text::paragraphs::{ParagraphSource, Paragraphs},
|
||||||
swipe_detect::SwipeConfig,
|
Component, Event, EventCtx, FormattedText, PaginateFull,
|
||||||
text::paragraphs::{ParagraphSource, Paragraphs},
|
|
||||||
Component, Event, EventCtx, FormattedText, PaginateFull,
|
|
||||||
},
|
|
||||||
flow::Swipable,
|
|
||||||
geometry::{Insets, Rect},
|
|
||||||
shape::Renderer,
|
|
||||||
util::Pager,
|
|
||||||
},
|
},
|
||||||
|
flow::Swipable,
|
||||||
|
geometry::{Insets, Rect},
|
||||||
|
shape::Renderer,
|
||||||
|
util::Pager,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{action_bar::ActionBarMsg, button::Button, ActionBar, Header, HeaderMsg, Hint};
|
pub(crate) use super::{action_bar::ActionBarMsg, ActionBar, Header, HeaderMsg, Hint};
|
||||||
|
|
||||||
/// Full-screen component for rendering text.
|
/// Full-screen component for rendering text.
|
||||||
///
|
///
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
use super::{geometry::Rect, CommonUI};
|
use super::{geometry::Rect, CommonUI};
|
||||||
use theme::backlight;
|
use theme::backlight;
|
||||||
|
|
||||||
|
#[cfg(feature = "ui_debug_overlay")]
|
||||||
|
use super::{
|
||||||
|
display::Color,
|
||||||
|
geometry::{Alignment, Alignment2D, Offset, Point},
|
||||||
|
shape, DebugOverlay,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "ui_debug_overlay")]
|
||||||
|
use crate::strutil::ShortString;
|
||||||
|
|
||||||
#[cfg(feature = "bootloader")]
|
#[cfg(feature = "bootloader")]
|
||||||
pub mod bootloader;
|
pub mod bootloader;
|
||||||
pub mod component;
|
pub mod component;
|
||||||
@ -69,4 +79,34 @@ impl CommonUI for UIEckhart {
|
|||||||
fn screen_boot_stage_2(fade_in: bool) {
|
fn screen_boot_stage_2(fade_in: bool) {
|
||||||
screens::screen_boot_stage_2(fade_in);
|
screens::screen_boot_stage_2(fade_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "ui_debug_overlay")]
|
||||||
|
fn render_debug_overlay<'s>(target: &mut impl shape::Renderer<'s>, info: DebugOverlay) {
|
||||||
|
let mut text = ShortString::new();
|
||||||
|
let t1 = info.render_time.min(99999) as u32;
|
||||||
|
let t2 = info.refresh_time.min(99999) as u32;
|
||||||
|
unwrap!(ufmt::uwrite!(
|
||||||
|
text,
|
||||||
|
"{}.{}|{}.{}",
|
||||||
|
t1 / 1000,
|
||||||
|
(t1 % 1000) / 100,
|
||||||
|
t2 / 1000,
|
||||||
|
(t2 % 1000) / 100
|
||||||
|
));
|
||||||
|
let font = fonts::FONT_SATOSHI_REGULAR_22;
|
||||||
|
let size = Offset::new(
|
||||||
|
font.visible_text_width("00.0|00.0"),
|
||||||
|
font.visible_text_height("0"),
|
||||||
|
);
|
||||||
|
let pos = Point::new(constant::WIDTH, 0);
|
||||||
|
let r = Rect::snap(pos, size, Alignment2D::TOP_RIGHT);
|
||||||
|
shape::Bar::new(r)
|
||||||
|
.with_alpha(192)
|
||||||
|
.with_bg(Color::black())
|
||||||
|
.render(target);
|
||||||
|
shape::Text::new(r.bottom_right(), &text, font)
|
||||||
|
.with_align(Alignment::End)
|
||||||
|
.with_fg(Color::rgb(255, 255, 0))
|
||||||
|
.render(target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
text::{
|
text::{
|
||||||
op::OpTextLayout,
|
op::OpTextLayout,
|
||||||
paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt},
|
paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, VecExt},
|
||||||
},
|
},
|
||||||
Empty, FormattedText,
|
Empty, FormattedText,
|
||||||
},
|
},
|
||||||
@ -159,6 +159,7 @@ impl FirmwareUI for UIEckhart {
|
|||||||
_title: TString<'static>,
|
_title: TString<'static>,
|
||||||
_button: TString<'static>,
|
_button: TString<'static>,
|
||||||
_button_style_confirm: bool,
|
_button_style_confirm: bool,
|
||||||
|
_hold: bool,
|
||||||
_items: Obj,
|
_items: Obj,
|
||||||
) -> Result<impl LayoutMaybeTrace, Error> {
|
) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"not implemented"))
|
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"not implemented"))
|
||||||
@ -204,7 +205,7 @@ impl FirmwareUI for UIEckhart {
|
|||||||
chunkify: bool,
|
chunkify: bool,
|
||||||
page_counter: bool,
|
page_counter: bool,
|
||||||
_prompt_screen: bool,
|
_prompt_screen: bool,
|
||||||
cancel: bool,
|
_cancel: bool,
|
||||||
) -> Result<Gc<LayoutObj>, Error> {
|
) -> Result<Gc<LayoutObj>, Error> {
|
||||||
let paragraphs = ConfirmValueParams {
|
let paragraphs = ConfirmValueParams {
|
||||||
description: description.unwrap_or("".into()),
|
description: description.unwrap_or("".into()),
|
||||||
@ -258,6 +259,7 @@ impl FirmwareUI for UIEckhart {
|
|||||||
_subtitle: Option<TString<'static>>,
|
_subtitle: Option<TString<'static>>,
|
||||||
_verb: Option<TString<'static>>,
|
_verb: Option<TString<'static>>,
|
||||||
_verb_cancel: Option<TString<'static>>,
|
_verb_cancel: Option<TString<'static>>,
|
||||||
|
_hold: bool,
|
||||||
_chunkify: bool,
|
_chunkify: bool,
|
||||||
) -> Result<Gc<LayoutObj>, Error> {
|
) -> Result<Gc<LayoutObj>, Error> {
|
||||||
Err::<Gc<LayoutObj>, Error>(Error::ValueError(c"confirm_value_intro not implemented"))
|
Err::<Gc<LayoutObj>, Error>(Error::ValueError(c"confirm_value_intro not implemented"))
|
||||||
@ -265,10 +267,10 @@ impl FirmwareUI for UIEckhart {
|
|||||||
|
|
||||||
fn confirm_with_info(
|
fn confirm_with_info(
|
||||||
_title: TString<'static>,
|
_title: TString<'static>,
|
||||||
_button: TString<'static>,
|
|
||||||
_info_button: TString<'static>,
|
|
||||||
_verb_cancel: Option<TString<'static>>,
|
|
||||||
_items: Obj,
|
_items: Obj,
|
||||||
|
_verb: TString<'static>,
|
||||||
|
_verb_info: TString<'static>,
|
||||||
|
_verb_cancel: Option<TString<'static>>,
|
||||||
) -> Result<impl LayoutMaybeTrace, Error> {
|
) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"not implemented"))
|
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"not implemented"))
|
||||||
}
|
}
|
||||||
@ -291,6 +293,7 @@ impl FirmwareUI for UIEckhart {
|
|||||||
fn flow_confirm_output(
|
fn flow_confirm_output(
|
||||||
_title: Option<TString<'static>>,
|
_title: Option<TString<'static>>,
|
||||||
_subtitle: Option<TString<'static>>,
|
_subtitle: Option<TString<'static>>,
|
||||||
|
_description: Option<TString<'static>>,
|
||||||
_message: Obj,
|
_message: Obj,
|
||||||
_amount: Option<Obj>,
|
_amount: Option<Obj>,
|
||||||
_chunkify: bool,
|
_chunkify: bool,
|
||||||
@ -299,8 +302,8 @@ impl FirmwareUI for UIEckhart {
|
|||||||
_account_path: Option<TString<'static>>,
|
_account_path: Option<TString<'static>>,
|
||||||
_br_code: u16,
|
_br_code: u16,
|
||||||
_br_name: TString<'static>,
|
_br_name: TString<'static>,
|
||||||
_address: Option<Obj>,
|
_address_item: Option<(TString<'static>, Obj)>,
|
||||||
_address_title: Option<TString<'static>>,
|
_extra_item: Option<(TString<'static>, Obj)>,
|
||||||
_summary_items: Option<Obj>,
|
_summary_items: Option<Obj>,
|
||||||
_fee_items: Option<Obj>,
|
_fee_items: Option<Obj>,
|
||||||
_summary_title: Option<TString<'static>>,
|
_summary_title: Option<TString<'static>>,
|
||||||
@ -671,7 +674,7 @@ impl FirmwareUI for UIEckhart {
|
|||||||
value: TString<'static>,
|
value: TString<'static>,
|
||||||
description: TString<'static>,
|
description: TString<'static>,
|
||||||
allow_cancel: bool,
|
allow_cancel: bool,
|
||||||
danger: bool, // TODO: review if `danger` needed in all layouts since we have show_danger
|
_danger: bool, // TODO: review if `danger` needed in all layouts since we have show_danger
|
||||||
) -> Result<Gc<LayoutObj>, Error> {
|
) -> Result<Gc<LayoutObj>, Error> {
|
||||||
let paragraphs = ParagraphVecShort::from_iter([
|
let paragraphs = ParagraphVecShort::from_iter([
|
||||||
Paragraph::new(&theme::TEXT_SMALL, description),
|
Paragraph::new(&theme::TEXT_SMALL, description),
|
||||||
|
@ -15,7 +15,7 @@ def get_ui_module(model: str, stage: str):
|
|||||||
|
|
||||||
layout = models.get_model_ui(model)
|
layout = models.get_model_ui(model)
|
||||||
|
|
||||||
if layout == "delizia" and stage == "prodtest":
|
if layout in ("delizia", "eckhart") and stage == "prodtest":
|
||||||
layout = "bolt"
|
layout = "bolt"
|
||||||
|
|
||||||
return ui_modules[layout]
|
return ui_modules[layout]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"current": {
|
"current": {
|
||||||
"merkle_root": "1754d367a3f9796a460e21677a38465ac51110a5abaae96a8977e64cd3d35e27",
|
"merkle_root": "19d4e95a0a33b04208bf228d5e00dceb75e0f0a59fc2fde24a8c53a3f61f6866",
|
||||||
"datetime": "2025-02-25T22:15:23.529862",
|
"datetime": "2025-02-26T14:55:24.158526",
|
||||||
"commit": "ba8a64d3e42febd344f60f039b6ac21ffb36aa9c"
|
"commit": "d2061b7671c84edd65033f7e22d65deda13cad06"
|
||||||
},
|
},
|
||||||
"history": [
|
"history": [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user