mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-23 21:02:23 +00:00
fixup! feat(core/rust): bootloader implementation in rust
This commit is contained in:
parent
8de5624ada
commit
bed8ceaa02
@ -264,6 +264,8 @@ pub struct Paragraph<T> {
|
|||||||
/// Try to keep this and the next paragraph on the same page. NOTE: doesn'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.
|
/// work if two or more subsequent paragraphs have this flag.
|
||||||
no_break: bool,
|
no_break: bool,
|
||||||
|
padding_top: i16,
|
||||||
|
padding_bottom: i16,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Paragraph<T> {
|
impl<T> Paragraph<T> {
|
||||||
@ -274,6 +276,8 @@ impl<T> Paragraph<T> {
|
|||||||
align: Alignment::Start,
|
align: Alignment::Start,
|
||||||
break_after: false,
|
break_after: false,
|
||||||
no_break: false,
|
no_break: false,
|
||||||
|
padding_top: PARAGRAPH_TOP_SPACE,
|
||||||
|
padding_bottom: PARAGRAPH_BOTTOM_SPACE,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,6 +296,16 @@ impl<T> Paragraph<T> {
|
|||||||
self
|
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) {
|
pub fn update(&mut self, content: T) {
|
||||||
self.content = content
|
self.content = content
|
||||||
}
|
}
|
||||||
@ -306,13 +320,15 @@ impl<T> Paragraph<T> {
|
|||||||
align: self.align,
|
align: self.align,
|
||||||
break_after: self.break_after,
|
break_after: self.break_after,
|
||||||
no_break: self.no_break,
|
no_break: self.no_break,
|
||||||
|
padding_top: self.padding_top,
|
||||||
|
padding_bottom: self.padding_bottom,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn layout(&self, area: Rect) -> TextLayout {
|
fn layout(&self, area: Rect) -> TextLayout {
|
||||||
TextLayout {
|
TextLayout {
|
||||||
padding_top: PARAGRAPH_TOP_SPACE,
|
padding_top: self.padding_top,
|
||||||
padding_bottom: PARAGRAPH_BOTTOM_SPACE,
|
padding_bottom: self.padding_bottom,
|
||||||
..TextLayout::new(*self.style)
|
..TextLayout::new(*self.style)
|
||||||
.with_align(self.align)
|
.with_align(self.align)
|
||||||
.with_bounds(area)
|
.with_bounds(area)
|
||||||
|
@ -427,14 +427,18 @@ extern "C" fn screen_install_success(
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
extern "C" fn screen_welcome() -> u32 {
|
extern "C" fn screen_welcome() -> u32 {
|
||||||
let mut messages = ParagraphVecShort::new();
|
|
||||||
display::rect_fill(screen(), WELCOME_COLOR);
|
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, "Get started with").centered());
|
||||||
messages.add(Paragraph::new(&theme::TEXT_WELCOME, "your trezor at").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 =
|
let mut frame =
|
||||||
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
|
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
|
||||||
|
|
||||||
frame.place(constant::screen());
|
frame.place(constant::screen());
|
||||||
frame.paint();
|
frame.paint();
|
||||||
0
|
0
|
||||||
|
Loading…
Reference in New Issue
Block a user