1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-25 08:58:14 +00:00

refactor(core): get rid of description_font_green

[no changelog]
This commit is contained in:
Ioan Bizău 2024-11-12 18:07:10 +01:00
parent 3b40950f7a
commit fc54ad1b77
8 changed files with 15 additions and 20 deletions

View File

@ -226,7 +226,6 @@ static void _librust_qstrs(void) {
MP_QSTR_decode; MP_QSTR_decode;
MP_QSTR_deinit; MP_QSTR_deinit;
MP_QSTR_description; MP_QSTR_description;
MP_QSTR_description_font_green;
MP_QSTR_details_title; MP_QSTR_details_title;
MP_QSTR_device_name__change_template; MP_QSTR_device_name__change_template;
MP_QSTR_device_name__title; MP_QSTR_device_name__title;

View File

@ -374,10 +374,10 @@ extern "C" fn new_confirm_blob(n_args: usize, args: *const Obj, kwargs: *mut Map
let block = move |_args: &[Obj], kwargs: &Map| { let block = move |_args: &[Obj], kwargs: &Map| {
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?; let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
let data: Obj = kwargs.get(Qstr::MP_QSTR_data)?; let data: Obj = kwargs.get(Qstr::MP_QSTR_data)?;
let description: Option<TString> = let description: Option<TString> = kwargs
kwargs.get(Qstr::MP_QSTR_description)?.try_into_option()?; .get(Qstr::MP_QSTR_description)
let description_font_green: bool = .unwrap_or_else(|_| Obj::const_none())
kwargs.get_or(Qstr::MP_QSTR_description_font_green, false)?; .try_into_option()?;
let text_mono: bool = kwargs.get_or(Qstr::MP_QSTR_text_mono, true)?; let text_mono: bool = kwargs.get_or(Qstr::MP_QSTR_text_mono, true)?;
let extra: Option<TString> = kwargs let extra: Option<TString> = kwargs
.get(Qstr::MP_QSTR_extra) .get(Qstr::MP_QSTR_extra)
@ -408,10 +408,13 @@ extern "C" fn new_confirm_blob(n_args: usize, args: *const Obj, kwargs: *mut Map
.unwrap_or_else(|_| Obj::const_none()) .unwrap_or_else(|_| Obj::const_none())
.try_into_option()?; .try_into_option()?;
let description_font = if description_font_green { let (description, description_font) = if page_limit == Some(1) {
&theme::TEXT_SUB_GREEN_LIME (
Some(TR::instructions__view_all_data.into()),
&theme::TEXT_SUB_GREEN_LIME,
)
} else { } else {
&theme::TEXT_NORMAL (description, &theme::TEXT_NORMAL)
}; };
ConfirmBlobParams::new( ConfirmBlobParams::new(
@ -1248,7 +1251,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str, /// title: str,
/// data: str | bytes, /// data: str | bytes,
/// description: str | None, /// description: str | None,
/// description_font_green: bool = False,
/// text_mono: bool = True, /// text_mono: bool = True,
/// extra: str | None = None, /// extra: str | None = None,
/// subtitle: str | None = None, /// subtitle: str | None = None,

View File

@ -1700,7 +1700,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str, /// title: str,
/// data: str | bytes, /// data: str | bytes,
/// description: str | None, /// description: str | None,
/// description_font_green: bool = False,
/// text_mono: bool = True, /// text_mono: bool = True,
/// extra: str | None = None, /// extra: str | None = None,
/// subtitle: str | None = None, /// subtitle: str | None = None,

View File

@ -1794,7 +1794,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str, /// title: str,
/// data: str | bytes, /// data: str | bytes,
/// description: str | None, /// description: str | None,
/// description_font_green: bool = False,
/// text_mono: bool = True, /// text_mono: bool = True,
/// extra: str | None = None, /// extra: str | None = None,
/// subtitle: str | None = None, /// subtitle: str | None = None,

View File

@ -59,7 +59,6 @@ def confirm_blob(
title: str, title: str,
data: str | bytes, data: str | bytes,
description: str | None, description: str | None,
description_font_green: bool = False,
text_mono: bool = True, text_mono: bool = True,
extra: str | None = None, extra: str | None = None,
subtitle: str | None = None, subtitle: str | None = None,
@ -632,7 +631,6 @@ def confirm_blob(
title: str, title: str,
data: str | bytes, data: str | bytes,
description: str | None, description: str | None,
description_font_green: bool = False,
text_mono: bool = True, text_mono: bool = True,
extra: str | None = None, extra: str | None = None,
subtitle: str | None = None, subtitle: str | None = None,
@ -1204,7 +1202,6 @@ def confirm_blob(
title: str, title: str,
data: str | bytes, data: str | bytes,
description: str | None, description: str | None,
description_font_green: bool = False,
text_mono: bool = True, text_mono: bool = True,
extra: str | None = None, extra: str | None = None,
subtitle: str | None = None, subtitle: str | None = None,

View File

@ -480,9 +480,8 @@ def confirm_blob(
main_layout = trezorui2.confirm_blob( main_layout = trezorui2.confirm_blob(
title=title, title=title,
data=data, data=data,
description=TR.instructions__view_all_data, description=None,
description_font_green=True, subtitle=description,
subtitle=subtitle,
verb=verb, verb=verb,
verb_cancel=verb_cancel, verb_cancel=verb_cancel,
verb_info=TR.buttons__view_all_data, verb_info=TR.buttons__view_all_data,
@ -540,7 +539,7 @@ if not utils.BITCOIN_ONLY:
"confirm_data", "confirm_data",
TR.ethereum__title_input_data, TR.ethereum__title_input_data,
data, data,
subtitle=TR.ethereum__data_size_template.format(data_total), TR.ethereum__data_size_template.format(data_total),
verb=TR.buttons__confirm, verb=TR.buttons__confirm,
verb_cancel=TR.send__cancel_sign, verb_cancel=TR.send__cancel_sign,
br_code=ButtonRequestType.SignTx, br_code=ButtonRequestType.SignTx,

View File

@ -638,7 +638,7 @@ if not utils.BITCOIN_ONLY:
"confirm_data", "confirm_data",
TR.ethereum__title_input_data, TR.ethereum__title_input_data,
data, data,
subtitle=TR.ethereum__data_size_template.format(data_total), TR.ethereum__data_size_template.format(data_total),
verb=TR.buttons__confirm, verb=TR.buttons__confirm,
verb_cancel=None, verb_cancel=None,
br_code=ButtonRequestType.SignTx, br_code=ButtonRequestType.SignTx,

View File

@ -606,7 +606,7 @@ if not utils.BITCOIN_ONLY:
"confirm_data", "confirm_data",
TR.ethereum__title_input_data, TR.ethereum__title_input_data,
data, data,
subtitle=TR.ethereum__data_size_template.format(data_total), TR.ethereum__data_size_template.format(data_total),
verb=TR.buttons__confirm, verb=TR.buttons__confirm,
verb_cancel=None, verb_cancel=None,
br_code=ButtonRequestType.SignTx, br_code=ButtonRequestType.SignTx,