From 384615c047facc4e8621e2fd3ccc5d0a5ac5e36e Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Tue, 27 Aug 2024 16:38:09 +0200 Subject: [PATCH] fix(core): fix button alignment in T3T1 bootloader [no changelog] --- core/SConscript.bootloader | 2 +- core/SConscript.bootloader_ci | 2 +- core/SConscript.bootloader_emu | 2 +- .../src/ui/model_mercury/bootloader/intro.rs | 6 +++- .../src/ui/model_mercury/bootloader/mod.rs | 28 +++++++++++++------ 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/core/SConscript.bootloader b/core/SConscript.bootloader index 557a30ad4c..8eb4913013 100644 --- a/core/SConscript.bootloader +++ b/core/SConscript.bootloader @@ -8,7 +8,7 @@ CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0)) BOOTLOADER_QA = ARGUMENTS.get('BOOTLOADER_QA', '0') == '1' PRODUCTION = 0 if BOOTLOADER_QA else ARGUMENTS.get('PRODUCTION', '0') == '1' HW_REVISION = ARGUMENTS.get('HW_REVISION', None) -NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1' +NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1' or TREZOR_MODEL in ('T3T1',) if TREZOR_MODEL in ('1', ): # skip bootloader build diff --git a/core/SConscript.bootloader_ci b/core/SConscript.bootloader_ci index 80adfb36f4..73e7a688c7 100644 --- a/core/SConscript.bootloader_ci +++ b/core/SConscript.bootloader_ci @@ -6,7 +6,7 @@ import tools, models TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T') CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0)) HW_REVISION = ARGUMENTS.get('HW_REVISION', None) -NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1' +NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1' or TREZOR_MODEL in ('T3T1',) if TREZOR_MODEL in ('1', 'DISC1', 'DISC2'): # skip bootloader_ci build diff --git a/core/SConscript.bootloader_emu b/core/SConscript.bootloader_emu index a71a7aade7..692224013b 100644 --- a/core/SConscript.bootloader_emu +++ b/core/SConscript.bootloader_emu @@ -6,7 +6,7 @@ import tools, models TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T') CMAKELISTS = int(ARGUMENTS.get('CMAKELISTS', 0)) HW_REVISION = 'emulator' -NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1' +NEW_RENDERING = ARGUMENTS.get('NEW_RENDERING', '1') == '1' or TREZOR_MODEL in ('T3T1',) if TREZOR_MODEL in ('1', 'DISC1', 'DISC2'): # skip bootloader build diff --git a/core/embed/rust/src/ui/model_mercury/bootloader/intro.rs b/core/embed/rust/src/ui/model_mercury/bootloader/intro.rs index 775f8725c6..8fe0b39818 100644 --- a/core/embed/rust/src/ui/model_mercury/bootloader/intro.rs +++ b/core/embed/rust/src/ui/model_mercury/bootloader/intro.rs @@ -44,7 +44,11 @@ impl<'a> Intro<'a> { .styled(button_bld_menu()) .with_expanded_touch_area(Insets::uniform(13)), ), - host: Child::new(Button::with_text("INSTALL FIRMWARE".into()).styled(button_bld())), + host: Child::new( + Button::with_text("INSTALL FIRMWARE".into()) + .styled(button_bld()) + .with_text_align(Alignment::Center), + ), text: Child::new(Label::left_aligned(content, TEXT_NORMAL).vertically_centered()), warn: (!fw_ok).then_some(Child::new( Label::new("FIRMWARE CORRUPTED".into(), Alignment::Start, TEXT_WARNING) 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 0acbce9665..14d0c897d3 100644 --- a/core/embed/rust/src/ui/model_mercury/bootloader/mod.rs +++ b/core/embed/rust/src/ui/model_mercury/bootloader/mod.rs @@ -5,7 +5,7 @@ use crate::{ ui::{ component::{connect::Connect, Label}, display::{self, Color, Font, Icon}, - geometry::{Offset, Point, Rect}, + geometry::{Alignment, Offset, Point, Rect}, layout::simplified::{run, show}, }, }; @@ -37,7 +37,7 @@ use super::theme::BLACK; #[cfg(feature = "new_rendering")] use crate::ui::{ display::{toif::Toif, LOADER_MAX}, - geometry::{Alignment, Alignment2D}, + geometry::Alignment2D, model_mercury::cshape::{render_loader, LoaderRange}, shape, shape::render_on_display, @@ -258,12 +258,20 @@ impl UIFeaturesBootloader for ModelMercuryFeatures { )); let (left, right) = if should_keep_seed { - let l = Button::with_text("CANCEL".into()).styled(button_bld()); - let r = Button::with_text("INSTALL".into()).styled(button_confirm()); + let l = Button::with_text("CANCEL".into()) + .styled(button_bld()) + .with_text_align(Alignment::Center); + let r = Button::with_text("INSTALL".into()) + .styled(button_confirm()) + .with_text_align(Alignment::Center); (l, r) } else { - let l = Button::with_icon(Icon::new(X24)).styled(button_bld()); - let r = Button::with_icon(Icon::new(CHECK24)).styled(button_confirm()); + let l = Button::with_icon(Icon::new(X24)) + .styled(button_bld()) + .with_text_align(Alignment::Center); + let r = Button::with_icon(Icon::new(CHECK24)) + .styled(button_confirm()) + .with_text_align(Alignment::Center); (l, r) }; @@ -290,8 +298,12 @@ impl UIFeaturesBootloader for ModelMercuryFeatures { ); let alert = Label::centered("SEED AND FIRMWARE\nWILL BE ERASED!".into(), TEXT_WIPE_BOLD); - let right = Button::with_text("RESET".into()).styled(button_wipe_confirm()); - let left = Button::with_text("CANCEL".into()).styled(button_wipe_cancel()); + let right = Button::with_text("RESET".into()) + .styled(button_wipe_confirm()) + .with_text_align(Alignment::Center); + let left = Button::with_text("CANCEL".into()) + .styled(button_wipe_cancel()) + .with_text_align(Alignment::Center); let mut frame = Confirm::new(BLD_WIPE_COLOR, left, right, ConfirmTitle::Icon(icon), msg) .with_alert(alert);