Skip to content

Commit

Permalink
refactor(core): consistent naming of UI layouts
Browse files Browse the repository at this point in the history
- follow-up on 862c987
- layout_bolt stays the same
- layout_samson -> layout_caesar
- layout_quicksilver -> layout_delizia

[no changelog]
  • Loading branch information
obrusvit committed Jan 17, 2025
1 parent 30e88f4 commit cfac449
Show file tree
Hide file tree
Showing 344 changed files with 683 additions and 867 deletions.
2 changes: 1 addition & 1 deletion common/protob/messages-debug.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ message DebugLinkDecision {
}

/**
* Structure representing button presses of UI samson
* Structure representing button presses of UI Caesar
*/
// TODO: probably delete the middle_btn as it is not a physical one
enum DebugPhysicalButton {
Expand Down
6 changes: 3 additions & 3 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ LAYOUT_FEATURE = layout_bolt
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T2B1))
MCU = STM32F4
OPENOCD_TARGET = target/stm32f4x.cfg
LAYOUT_FEATURE = layout_samson
LAYOUT_FEATURE = layout_caesar
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T3T1))
MCU = STM32U5
OPENOCD_TARGET = target/stm32u5x.cfg
LAYOUT_FEATURE = layout_quicksilver
LAYOUT_FEATURE = layout_delizia
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T3B1))
MCU = STM32U5
OPENOCD_TARGET = target/stm32u5x.cfg
LAYOUT_FEATURE = layout_samson
LAYOUT_FEATURE = layout_caesar
else ifeq ($(TREZOR_MODEL),$(filter $(TREZOR_MODEL),T3W1))
MCU = STM32U5
OPENOCD_TARGET = target/stm32u5x.cfg
Expand Down
4 changes: 2 additions & 2 deletions core/embed/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ build = "build.rs"
default = ["layout_bolt"]
crypto = ["zeroize"]
layout_bolt = ["jpeg"]
layout_samson = []
layout_quicksilver = ["jpeg", "dma2d"]
layout_caesar = []
layout_delizia = ["jpeg", "dma2d"]
micropython = []
protobuf = ["micropython"]
ui = []
Expand Down
8 changes: 4 additions & 4 deletions core/embed/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const DEFAULT_BINDGEN_MACROS_T2T1: &[&str] = &[
#[cfg(not(feature = "layout_bolt"))]
const DEFAULT_BINDGEN_MACROS_T2T1: &[&str] = &[];

#[cfg(feature = "layout_samson")]
#[cfg(feature = "layout_caesar")]
const DEFAULT_BINDGEN_MACROS_T2B1: &[&str] = &[
"-DSTM32F427",
"-DTREZOR_MODEL_T2B1",
Expand All @@ -78,10 +78,10 @@ const DEFAULT_BINDGEN_MACROS_T2B1: &[&str] = &[
"-DDISPLAY_RESY=64",
"-DTREZOR_BOARD=\"T2B1/boards/t2b1-unix.h\"",
];
#[cfg(not(feature = "layout_samson"))]
#[cfg(not(feature = "layout_caesar"))]
const DEFAULT_BINDGEN_MACROS_T2B1: &[&str] = &[];

#[cfg(feature = "layout_quicksilver")]
#[cfg(feature = "layout_delizia")]
const DEFAULT_BINDGEN_MACROS_T3T1: &[&str] = &[
"-DSTM32U5",
"-DTREZOR_MODEL_T3T1",
Expand All @@ -91,7 +91,7 @@ const DEFAULT_BINDGEN_MACROS_T3T1: &[&str] = &[
"-DDISPLAY_RESY=240",
"-DTREZOR_BOARD=\"T3T1/boards/t3t1-unix.h\"",
];
#[cfg(not(feature = "layout_quicksilver"))]
#[cfg(not(feature = "layout_delizia"))]
const DEFAULT_BINDGEN_MACROS_T3T1: &[&str] = &[];

fn add_bindgen_macros<'a>(clang_args: &mut Vec<&'a str>, envvar: Option<&'a str>) {
Expand Down
2 changes: 1 addition & 1 deletion core/embed/rust/librust_qstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ static void _librust_qstrs(void) {
MP_QSTR_show_progress_coinjoin;
MP_QSTR_show_remaining_shares;
MP_QSTR_show_share_words;
MP_QSTR_show_share_words_quicksilver;
MP_QSTR_show_share_words_delizia;
MP_QSTR_show_simple;
MP_QSTR_show_success;
MP_QSTR_show_wait_text;
Expand Down
16 changes: 8 additions & 8 deletions core/embed/rust/src/ui/api/firmware_micropython.rs
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ extern "C" fn new_show_share_words(n_args: usize, args: *const Obj, kwargs: *mut
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}

extern "C" fn new_show_share_words_quicksilver(
extern "C" fn new_show_share_words_delizia(
n_args: usize,
args: *const Obj,
kwargs: *mut Map,
Expand All @@ -947,7 +947,7 @@ extern "C" fn new_show_share_words_quicksilver(

let words: Vec<TString, 33> = util::iter_into_vec(words)?;

let layout = ModelUI::show_share_words_quicksilver(
let layout = ModelUI::show_share_words_delizia(
words,
subtitle,
instructions,
Expand Down Expand Up @@ -1280,7 +1280,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// items: Iterable[tuple[int, str | bytes]],
/// ) -> LayoutObj[UiResult]:
/// """Confirm long content with the possibility to go back from any page.
/// Meant to be used with confirm_with_info on UI bolt and samson."""
/// Meant to be used with confirm_with_info on UI Bolt and Caesar."""
Qstr::MP_QSTR_confirm_more => obj_fn_kw!(0, new_confirm_more).as_obj(),

/// def confirm_properties(
Expand Down Expand Up @@ -1338,7 +1338,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// items: Iterable[tuple[int, str | bytes]],
/// ) -> LayoutObj[UiResult]:
/// """Confirm given items but with third button. Always single page
/// without scrolling. In Quicksilver, the button is placed in
/// without scrolling. In Delizia, the button is placed in
/// context menu."""
Qstr::MP_QSTR_confirm_with_info => obj_fn_kw!(0, new_confirm_with_info).as_obj(),

Expand Down Expand Up @@ -1378,7 +1378,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// """Confirm the recipient, (optionally) confirm the amount and (optionally) confirm the summary and present a Hold to Sign page."""
Qstr::MP_QSTR_flow_confirm_output => obj_fn_kw!(0, new_flow_confirm_output).as_obj(),

// TODO: supply more arguments for Wipe code setting (quicksilver)
// TODO: supply more arguments for Wipe code setting (delizia)
///
/// def flow_confirm_set_new_pin(
/// *,
Expand Down Expand Up @@ -1625,7 +1625,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// """Show mnemonic for backup."""
Qstr::MP_QSTR_show_share_words => obj_fn_kw!(0, new_show_share_words).as_obj(),

/// def show_share_words_quicksilver(
/// def show_share_words_delizia(
/// *,
/// words: Iterable[str],
/// subtitle: str | None,
Expand All @@ -1635,7 +1635,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// ) -> LayoutObj[UiResult]:
/// """Show mnemonic for wallet backup preceded by an instruction screen and followed by a
/// confirmation screen."""
Qstr::MP_QSTR_show_share_words_quicksilver => obj_fn_kw!(0, new_show_share_words_quicksilver).as_obj(),
Qstr::MP_QSTR_show_share_words_delizia => obj_fn_kw!(0, new_show_share_words_delizia).as_obj(),

/// def show_simple(
/// *,
Expand Down Expand Up @@ -1670,7 +1670,7 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// allow_cancel: bool = True,
/// danger: bool = False, # unused on bolt
/// ) -> LayoutObj[UiResult]:
/// """Warning modal. bolt: No buttons shown when `button` is empty string. samson: middle button and centered text."""
/// """Warning modal. Bolt: No buttons shown when `button` is empty string. Caesar: middle button and centered text."""
Qstr::MP_QSTR_show_warning => obj_fn_kw!(0, new_show_warning).as_obj(),

/// def tutorial() -> LayoutObj[UiResult]:
Expand Down
12 changes: 6 additions & 6 deletions core/embed/rust/src/ui/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#[cfg(all(
feature = "layout_bolt",
not(feature = "layout_quicksilver"),
not(feature = "layout_samson")
not(feature = "layout_delizia"),
not(feature = "layout_caesar")
))]
pub use super::layout_bolt::constant::*;
#[cfg(all(feature = "layout_quicksilver", not(feature = "layout_bolt")))]
pub use super::layout_quicksilver::constant::*;
#[cfg(feature = "layout_samson")]
pub use super::layout_samson::constant::*;
#[cfg(all(feature = "layout_caesar", not(feature = "layout_delizia")))]
pub use super::layout_caesar::constant::*;
#[cfg(feature = "layout_delizia")]
pub use super::layout_delizia::constant::*;
2 changes: 1 addition & 1 deletion core/embed/rust/src/ui/layout_bolt/ui_firmware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ impl FirmwareUI for UIBolt {
Ok(layout)
}

fn show_share_words_quicksilver(
fn show_share_words_delizia(
_words: heapless::Vec<TString<'static>, 33>,
_subtitle: Option<TString<'static>>,
_instructions: Obj,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ use super::{
bootloader::{BLD_BG, BLD_FG, ICON_ALERT, ICON_SPINNER, ICON_SUCCESS},
ICON_ARM_LEFT, ICON_ARM_RIGHT, TEXT_BOLD, TEXT_NORMAL,
},
UISamson,
UICaesar,
};

use crate::ui::{
display::toif::Toif, geometry::Alignment, layout_samson::cshape, shape,
display::toif::Toif, geometry::Alignment, layout_caesar::cshape, shape,
shape::render_on_display,
};

Expand All @@ -48,7 +48,7 @@ impl ReturnToC for ConfirmMsg {
}
}

impl UISamson {
impl UICaesar {
fn screen_progress(
text: &str,
text2: &str,
Expand Down Expand Up @@ -93,7 +93,7 @@ impl UISamson {
}
}

impl BootloaderUI for UISamson {
impl BootloaderUI for UICaesar {
fn screen_welcome() {
let mut frame = Welcome::new();
show(&mut frame, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ use crate::{
},
display::Font,
geometry::{Alignment, Alignment2D, Insets, Offset, Rect},
layout_samson::cshape,
shape,
shape::Renderer,
util::animation_disabled,
},
};

use super::theme;
use super::super::{cshape, theme};

const FOOTER_TEXT_MARGIN: i16 = 8;
const LOADER_OFFSET: i16 = -15;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ use crate::{
component::{Child, Component, Event, EventCtx, Label, Never, Pad},
constant::{screen, WIDTH},
geometry::{Alignment2D, Offset, Point, Rect},
layout_samson::cshape,
shape,
shape::Renderer,
},
};

use super::super::{
theme,
cshape, theme,
theme::{BG, FG, TITLE_AREA_HEIGHT},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ use crate::{
constant,
display::{Font, Icon, LOADER_MAX},
geometry::{Alignment2D, Offset, Rect},
layout_samson::cshape,
shape,
shape::Renderer,
util::animation_disabled,
},
};

use super::super::theme;
use super::super::{cshape, theme};

const BOTTOM_DESCRIPTION_MARGIN: i16 = 10;
const LOADER_Y_OFFSET_TITLE: i16 = -10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ pub mod cshape;
mod screens;
pub mod theme;

pub struct UISamson {}
pub struct UICaesar {}

#[cfg(feature = "micropython")]
pub mod ui_firmware;

impl CommonUI for UISamson {
impl CommonUI for UICaesar {
const SCREEN: Rect = constant::SCREEN;

fn screen_fatal_error(title: &str, msg: &str, footer: &str) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use crate::ui::{
component::base::Component, constant::screen, display, layout_samson::component::WelcomeScreen,
};
use crate::ui::{component::base::Component, constant::screen, display};

use crate::ui::{display::Color, shape::render_on_display};

use super::{component::ErrorScreen, constant};
use super::{
component::{ErrorScreen, WelcomeScreen},
constant,
};

pub fn screen_fatal_error(title: &str, msg: &str, footer: &str) {
let mut frame = ErrorScreen::new(title.into(), msg.into(), footer.into());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ pub use super::super::theme::{BLACK, WHITE};
pub const BLD_BG: Color = BLACK;
pub const BLD_FG: Color = WHITE;

include_icon!(ICON_TRASH, "layout_samson/res/trash.toif");
include_icon!(ICON_ALERT, "layout_samson/res/alert.toif");
include_icon!(ICON_SPINNER, "layout_samson/res/spinner.toif");
include_icon!(ICON_SUCCESS, "layout_samson/res/success.toif");
include_icon!(ICON_REDO, "layout_samson/res/redo.toif");
include_icon!(ICON_EXIT, "layout_samson/res/exit.toif");
include_icon!(ICON_TRASH, "layout_caesar/res/trash.toif");
include_icon!(ICON_ALERT, "layout_caesar/res/alert.toif");
include_icon!(ICON_SPINNER, "layout_caesar/res/spinner.toif");
include_icon!(ICON_SUCCESS, "layout_caesar/res/success.toif");
include_icon!(ICON_REDO, "layout_caesar/res/redo.toif");
include_icon!(ICON_EXIT, "layout_caesar/res/exit.toif");

pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
Original file line number Diff line number Diff line change
Expand Up @@ -65,35 +65,35 @@ pub fn textstyle_number(num: i32) -> &'static TextStyle {
}

// Firmware icons
include_icon!(ICON_ARM_LEFT, "layout_samson/res/arm_left.toif"); // 10*6
include_icon!(ICON_ARM_RIGHT, "layout_samson/res/arm_right.toif"); // 10*6
include_icon!(ICON_ARROW_LEFT, "layout_samson/res/arrow_left.toif"); // 4*7
include_icon!(ICON_ARROW_LEFT_BIG, "layout_samson/res/arrow_left_big.toif"); // 8*7
include_icon!(ICON_ARROW_RIGHT, "layout_samson/res/arrow_right.toif"); // 4*7
include_icon!(ICON_ARM_LEFT, "layout_caesar/res/arm_left.toif"); // 10*6
include_icon!(ICON_ARM_RIGHT, "layout_caesar/res/arm_right.toif"); // 10*6
include_icon!(ICON_ARROW_LEFT, "layout_caesar/res/arrow_left.toif"); // 4*7
include_icon!(ICON_ARROW_LEFT_BIG, "layout_caesar/res/arrow_left_big.toif"); // 8*7
include_icon!(ICON_ARROW_RIGHT, "layout_caesar/res/arrow_right.toif"); // 4*7
include_icon!(
ICON_ARROW_RIGHT_FAT,
"layout_samson/res/arrow_right_fat.toif"
"layout_caesar/res/arrow_right_fat.toif"
); // 4*8
include_icon!(ICON_ARROW_UP, "layout_samson/res/arrow_up.toif"); // 8*4
include_icon!(ICON_ARROW_DOWN, "layout_samson/res/arrow_down.toif"); // 7*4
include_icon!(ICON_ARROW_BACK_UP, "layout_samson/res/arrow_back_up.toif"); // 8*8
include_icon!(ICON_BIN, "layout_samson/res/bin.toif"); // 10*10
include_icon!(ICON_CANCEL, "layout_samson/res/cancel.toif"); // 7*7
include_icon!(ICON_COINJOIN, "layout_samson/res/coinjoin.toif"); // 12*12
include_icon!(ICON_DELETE, "layout_samson/res/delete.toif"); // 9*7
include_icon!(ICON_DEVICE_NAME, "layout_samson/res/device_name.toif"); // 116*18
include_icon!(ICON_EYE, "layout_samson/res/eye_round.toif"); // 12*7
include_icon!(ICON_LOCK, "layout_samson/res/lock.toif"); // 10*10
include_icon!(ICON_LOCK_SMALL, "layout_samson/res/lock_small.toif"); // 6*7
include_icon!(ICON_LOGO, "layout_samson/res/logo_22_33.toif"); // 22*33
include_icon!(ICON_LOGO_EMPTY, "layout_samson/res/logo_22_33_empty.toif");
include_icon!(ICON_NEXT_PAGE, "layout_samson/res/next_page.toif"); // 9*8
include_icon!(ICON_PREV_PAGE, "layout_samson/res/prev_page.toif"); // 8*10
include_icon!(ICON_SPACE, "layout_samson/res/space.toif"); // 12*3
include_icon!(ICON_TICK, "layout_samson/res/tick.toif"); // 8*6
include_icon!(ICON_TICK_FAT, "layout_samson/res/tick_fat.toif"); // 8*6
include_icon!(ICON_WARNING, "layout_samson/res/warning.toif"); // 11*12
include_icon!(ICON_WARN_TITLE, "layout_samson/res/bld_header_warn.toif");
include_icon!(ICON_ARROW_UP, "layout_caesar/res/arrow_up.toif"); // 8*4
include_icon!(ICON_ARROW_DOWN, "layout_caesar/res/arrow_down.toif"); // 7*4
include_icon!(ICON_ARROW_BACK_UP, "layout_caesar/res/arrow_back_up.toif"); // 8*8
include_icon!(ICON_BIN, "layout_caesar/res/bin.toif"); // 10*10
include_icon!(ICON_CANCEL, "layout_caesar/res/cancel.toif"); // 7*7
include_icon!(ICON_COINJOIN, "layout_caesar/res/coinjoin.toif"); // 12*12
include_icon!(ICON_DELETE, "layout_caesar/res/delete.toif"); // 9*7
include_icon!(ICON_DEVICE_NAME, "layout_caesar/res/device_name.toif"); // 116*18
include_icon!(ICON_EYE, "layout_caesar/res/eye_round.toif"); // 12*7
include_icon!(ICON_LOCK, "layout_caesar/res/lock.toif"); // 10*10
include_icon!(ICON_LOCK_SMALL, "layout_caesar/res/lock_small.toif"); // 6*7
include_icon!(ICON_LOGO, "layout_caesar/res/logo_22_33.toif"); // 22*33
include_icon!(ICON_LOGO_EMPTY, "layout_caesar/res/logo_22_33_empty.toif");
include_icon!(ICON_NEXT_PAGE, "layout_caesar/res/next_page.toif"); // 9*8
include_icon!(ICON_PREV_PAGE, "layout_caesar/res/prev_page.toif"); // 8*10
include_icon!(ICON_SPACE, "layout_caesar/res/space.toif"); // 12*3
include_icon!(ICON_TICK, "layout_caesar/res/tick.toif"); // 8*6
include_icon!(ICON_TICK_FAT, "layout_caesar/res/tick_fat.toif"); // 8*6
include_icon!(ICON_WARNING, "layout_caesar/res/warning.toif"); // 11*12
include_icon!(ICON_WARN_TITLE, "layout_caesar/res/bld_header_warn.toif");

// checklist settings
pub const CHECKLIST_SPACING: i16 = 5;
Expand Down
Loading

0 comments on commit cfac449

Please sign in to comment.