1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

feat(core): init T3T1 UI layouts: meta

This commit is contained in:
Martin Milata 2024-03-04 12:05:19 +01:00
parent d6c502f27e
commit 2ba42d716e
12 changed files with 48 additions and 4 deletions

View File

@ -460,12 +460,15 @@ SOURCE_FIRMWARE = [
] ]
if TREZOR_MODEL in ('T', 'T3T1', 'DISC1', 'DISC2'): if TREZOR_MODEL in ('T', 'DISC1', 'DISC2'):
UI_LAYOUT = 'UI_LAYOUT_TT' UI_LAYOUT = 'UI_LAYOUT_TT'
ui_layout_feature = 'model_tt' ui_layout_feature = 'model_tt'
elif TREZOR_MODEL in ('1', 'R'): elif TREZOR_MODEL in ('1', 'R'):
UI_LAYOUT = 'UI_LAYOUT_TR' UI_LAYOUT = 'UI_LAYOUT_TR'
ui_layout_feature = 'model_tr' ui_layout_feature = 'model_tr'
elif TREZOR_MODEL in ('T3T1',):
UI_LAYOUT = 'UI_LAYOUT_MERCURY'
ui_layout_feature = 'model_mercury'
else: else:
raise ValueError('Unknown Trezor model') raise ValueError('Unknown Trezor model')
@ -640,6 +643,12 @@ if FROZEN:
SOURCE_PY_DIR + 'trezor/ui/layouts/tr/fido.py', SOURCE_PY_DIR + 'trezor/ui/layouts/tr/fido.py',
] if not EVERYTHING else [] ] if not EVERYTHING else []
)) ))
elif UI_LAYOUT == 'UI_LAYOUT_MERCURY':
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/mercury/*.py',
exclude=[
SOURCE_PY_DIR + 'trezor/ui/layouts/mercury/fido.py',
] if not EVERYTHING else []
))
else: else:
raise ValueError('Unknown layout') raise ValueError('Unknown layout')

View File

@ -471,12 +471,15 @@ env = Environment(ENV=os.environ, CFLAGS='%s -DCONFIDENTIAL= -DPYOPT=%s -DBITCOI
FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_UNIX, PATH_HAL) FEATURES_AVAILABLE = models.configure_board(TREZOR_MODEL, HW_REVISION, FEATURES_WANTED, env, CPPDEFINES_HAL, SOURCE_UNIX, PATH_HAL)
if TREZOR_MODEL in ('T', 'T3T1'): if TREZOR_MODEL in ('T',):
UI_LAYOUT = 'UI_LAYOUT_TT' UI_LAYOUT = 'UI_LAYOUT_TT'
ui_layout_feature = 'model_tt' ui_layout_feature = 'model_tt'
elif TREZOR_MODEL in ('1', 'R'): elif TREZOR_MODEL in ('1', 'R'):
UI_LAYOUT = 'UI_LAYOUT_TR' UI_LAYOUT = 'UI_LAYOUT_TR'
ui_layout_feature = 'model_tr' ui_layout_feature = 'model_tr'
elif TREZOR_MODEL in ('T3T1',):
UI_LAYOUT = 'UI_LAYOUT_MERCURY'
ui_layout_feature = 'model_mercury'
else: else:
raise ValueError('Unknown Trezor model') raise ValueError('Unknown Trezor model')
@ -682,6 +685,12 @@ if FROZEN:
SOURCE_PY_DIR + 'trezor/ui/layouts/tr/fido.py', SOURCE_PY_DIR + 'trezor/ui/layouts/tr/fido.py',
] if not EVERYTHING else [] ] if not EVERYTHING else []
)) ))
elif UI_LAYOUT == 'UI_LAYOUT_MERCURY':
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/ui/layouts/mercury/*.py',
exclude=[
SOURCE_PY_DIR + 'trezor/ui/layouts/mercury/fido.py',
] if not EVERYTHING else []
))
else: else:
raise ValueError('Unknown layout') raise ValueError('Unknown layout')

View File

@ -508,6 +508,8 @@ STATIC const mp_rom_map_elem_t mp_module_trezorutils_globals_table[] = {
{MP_ROM_QSTR(MP_QSTR_UI_LAYOUT), MP_ROM_QSTR(MP_QSTR_TT)}, {MP_ROM_QSTR(MP_QSTR_UI_LAYOUT), MP_ROM_QSTR(MP_QSTR_TT)},
#elif UI_LAYOUT_TR #elif UI_LAYOUT_TR
{MP_ROM_QSTR(MP_QSTR_UI_LAYOUT), MP_ROM_QSTR(MP_QSTR_TR)}, {MP_ROM_QSTR(MP_QSTR_UI_LAYOUT), MP_ROM_QSTR(MP_QSTR_TR)},
#elif UI_LAYOUT_MERCURY
{MP_ROM_QSTR(MP_QSTR_UI_LAYOUT), MP_ROM_QSTR(MP_QSTR_MERCURY)},
#else #else
#error Unknown layout #error Unknown layout
#endif #endif

View File

@ -9,5 +9,5 @@
pub use super::model_mercury::constant::*; pub use super::model_mercury::constant::*;
#[cfg(all(feature = "model_tr", not(feature = "model_tt")))] #[cfg(all(feature = "model_tr", not(feature = "model_tt")))]
pub use super::model_tr::constant::*; pub use super::model_tr::constant::*;
#[cfg(feature = "model_tt")] #[cfg(all(feature = "model_tt", not(feature = "model_mercury")))]
pub use super::model_tt::constant::*; pub use super::model_tt::constant::*;

View File

@ -7,7 +7,7 @@ mod starry;
use crate::ui::display::{Color, Icon}; use crate::ui::display::{Color, Icon};
#[cfg(feature = "model_tt")] #[cfg(any(feature = "model_tt", feature = "model_mercury"))]
use crate::ui::display::loader::circular::{ use crate::ui::display::loader::circular::{
loader_circular as determinate, loader_circular_indeterminate as indeterminate, loader_circular as determinate, loader_circular_indeterminate as indeterminate,
}; };

View File

@ -46,6 +46,7 @@ def generate(env):
optiga = env["optiga"] optiga = env["optiga"]
layout_tt = env["ui_layout"] == "UI_LAYOUT_TT" layout_tt = env["ui_layout"] == "UI_LAYOUT_TT"
layout_tr = env["ui_layout"] == "UI_LAYOUT_TR" layout_tr = env["ui_layout"] == "UI_LAYOUT_TR"
layout_mercury = env["ui_layout"] == "UI_LAYOUT_MERCURY"
thp = env["thp"] thp = env["thp"]
interim = f"{target[:-4]}.i" # replace .mpy with .i interim = f"{target[:-4]}.i" # replace .mpy with .i
sed_scripts = [ sed_scripts = [
@ -54,6 +55,7 @@ def generate(env):
rf"-e 's/utils\.USE_OPTIGA/{optiga}/g'", rf"-e 's/utils\.USE_OPTIGA/{optiga}/g'",
rf"-e 's/utils\.UI_LAYOUT == \"TT\"/{layout_tt}/g'", rf"-e 's/utils\.UI_LAYOUT == \"TT\"/{layout_tt}/g'",
rf"-e 's/utils\.UI_LAYOUT == \"TR\"/{layout_tr}/g'", rf"-e 's/utils\.UI_LAYOUT == \"TR\"/{layout_tr}/g'",
rf"-e 's/utils\.UI_LAYOUT == \"MERCURY\"/{layout_mercury}/g'",
rf"-e 's/utils\.USE_THP/{thp}/g'", rf"-e 's/utils\.USE_THP/{thp}/g'",
r"-e 's/if TYPE_CHECKING/if False/'", r"-e 's/if TYPE_CHECKING/if False/'",
r"-e 's/import typing/# \0/'", r"-e 's/import typing/# \0/'",

View File

@ -157,6 +157,18 @@ trezor.ui.layouts.fido
import trezor.ui.layouts.fido import trezor.ui.layouts.fido
trezor.ui.layouts.homescreen trezor.ui.layouts.homescreen
import trezor.ui.layouts.homescreen import trezor.ui.layouts.homescreen
trezor.ui.layouts.mercury
import trezor.ui.layouts.mercury
trezor.ui.layouts.mercury.fido
import trezor.ui.layouts.mercury.fido
trezor.ui.layouts.mercury.homescreen
import trezor.ui.layouts.mercury.homescreen
trezor.ui.layouts.mercury.progress
import trezor.ui.layouts.mercury.progress
trezor.ui.layouts.mercury.recovery
import trezor.ui.layouts.mercury.recovery
trezor.ui.layouts.mercury.reset
import trezor.ui.layouts.mercury.reset
trezor.ui.layouts.progress trezor.ui.layouts.progress
import trezor.ui.layouts.progress import trezor.ui.layouts.progress
trezor.ui.layouts.recovery trezor.ui.layouts.recovery

View File

@ -8,5 +8,7 @@ if utils.UI_LAYOUT == "TR":
from .tr import * # noqa: F401,F403 from .tr import * # noqa: F401,F403
elif utils.UI_LAYOUT == "TT": elif utils.UI_LAYOUT == "TT":
from .tt import * # noqa: F401,F403 from .tt import * # noqa: F401,F403
elif utils.UI_LAYOUT == "MERCURY":
from .mercury import * # noqa: F401,F403
else: else:
raise ValueError("Unknown layout") raise ValueError("Unknown layout")

View File

@ -4,3 +4,5 @@ if utils.UI_LAYOUT == "TT":
from .tt.fido import * # noqa: F401,F403 from .tt.fido import * # noqa: F401,F403
elif utils.UI_LAYOUT == "TR": elif utils.UI_LAYOUT == "TR":
from .tr.fido import * # noqa: F401,F403 from .tr.fido import * # noqa: F401,F403
elif utils.UI_LAYOUT == "MERCURY":
from .mercury.fido import * # noqa: F401,F403

View File

@ -4,3 +4,5 @@ if utils.UI_LAYOUT == "TT":
from .tt.homescreen import * # noqa: F401,F403 from .tt.homescreen import * # noqa: F401,F403
elif utils.UI_LAYOUT == "TR": elif utils.UI_LAYOUT == "TR":
from .tr.homescreen import * # noqa: F401,F403 from .tr.homescreen import * # noqa: F401,F403
elif utils.UI_LAYOUT == "MERCURY":
from .mercury.homescreen import * # noqa: F401,F403

View File

@ -4,3 +4,5 @@ if utils.UI_LAYOUT == "TT":
from .tt.recovery import * # noqa: F401,F403 from .tt.recovery import * # noqa: F401,F403
elif utils.UI_LAYOUT == "TR": elif utils.UI_LAYOUT == "TR":
from .tr.recovery import * # noqa: F401,F403 from .tr.recovery import * # noqa: F401,F403
elif utils.UI_LAYOUT == "MERCURY":
from .mercury.recovery import * # noqa: F401,F403

View File

@ -4,3 +4,5 @@ if utils.UI_LAYOUT == "TT":
from .tt.reset import * # noqa: F401,F403 from .tt.reset import * # noqa: F401,F403
elif utils.UI_LAYOUT == "TR": elif utils.UI_LAYOUT == "TR":
from .tr.reset import * # noqa: F401,F403 from .tr.reset import * # noqa: F401,F403
elif utils.UI_LAYOUT == "MERCURY":
from .mercury.reset import * # noqa: F401,F403