1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-23 13:02:03 +00:00

fixup! feat(core/rust): bootloader implementation in rust

This commit is contained in:
tychovrahe 2022-10-25 15:45:37 +02:00
parent 8de5624ada
commit bed8ceaa02
2 changed files with 25 additions and 5 deletions

View File

@ -264,6 +264,8 @@ pub struct Paragraph<T> {
/// Try to keep this and the next paragraph on the same page. NOTE: doesn't
/// work if two or more subsequent paragraphs have this flag.
no_break: bool,
padding_top: i16,
padding_bottom: i16,
}
impl<T> Paragraph<T> {
@ -274,6 +276,8 @@ impl<T> Paragraph<T> {
align: Alignment::Start,
break_after: false,
no_break: false,
padding_top: PARAGRAPH_TOP_SPACE,
padding_bottom: PARAGRAPH_BOTTOM_SPACE,
}
}
@ -292,6 +296,16 @@ impl<T> Paragraph<T> {
self
}
pub const fn with_top_padding(mut self, padding: i16) -> Self {
self.padding_top = padding;
self
}
pub const fn with_bottom_padding(mut self, padding: i16) -> Self {
self.padding_bottom = padding;
self
}
pub fn update(&mut self, content: T) {
self.content = content
}
@ -306,13 +320,15 @@ impl<T> Paragraph<T> {
align: self.align,
break_after: self.break_after,
no_break: self.no_break,
padding_top: self.padding_top,
padding_bottom: self.padding_bottom,
}
}
fn layout(&self, area: Rect) -> TextLayout {
TextLayout {
padding_top: PARAGRAPH_TOP_SPACE,
padding_bottom: PARAGRAPH_BOTTOM_SPACE,
padding_top: self.padding_top,
padding_bottom: self.padding_bottom,
..TextLayout::new(*self.style)
.with_align(self.align)
.with_bounds(area)

View File

@ -427,14 +427,18 @@ extern "C" fn screen_install_success(
#[no_mangle]
extern "C" fn screen_welcome() -> u32 {
let mut messages = ParagraphVecShort::new();
display::rect_fill(screen(), WELCOME_COLOR);
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(&theme::TEXT_WELCOME, "Get started with").centered());
messages.add(Paragraph::new(&theme::TEXT_WELCOME, "your trezor at").centered());
messages.add(Paragraph::new(&theme::TEXT_WELCOME_BOLD, "trezor.io/start").centered());
messages.add(
Paragraph::new(&theme::TEXT_WELCOME_BOLD, "trezor.io/start")
.centered()
.with_top_padding(2),
);
let mut frame =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
frame.place(constant::screen());
frame.paint();
0