mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-26 08:29:26 +00:00
WIP - after rebase fixes
This commit is contained in:
parent
825f94b2f2
commit
8d7fc11b87
@ -102,14 +102,19 @@ impl<const M: usize> Page<M> {
|
|||||||
|
|
||||||
pub fn btn_layout(&self) -> ButtonLayout<&'static str> {
|
pub fn btn_layout(&self) -> ButtonLayout<&'static str> {
|
||||||
// When we are in pagination inside this flow,
|
// When we are in pagination inside this flow,
|
||||||
// show the up and down arrows on appropriate sides
|
// show the up and down arrows on appropriate sides.
|
||||||
let current = self.btn_layout.clone();
|
let current = self.btn_layout.clone();
|
||||||
|
|
||||||
let btn_left = if self.has_prev_page() {
|
// On the last page showing only the narrow arrow, so the right
|
||||||
|
// button with possibly long text has enough space.
|
||||||
|
let btn_left = if self.has_prev_page() && !self.has_next_page() {
|
||||||
|
Some(ButtonDetails::up_arrow_icon())
|
||||||
|
} else if self.has_prev_page() {
|
||||||
Some(ButtonDetails::up_arrow_icon_wide())
|
Some(ButtonDetails::up_arrow_icon_wide())
|
||||||
} else {
|
} else {
|
||||||
current.btn_left
|
current.btn_left
|
||||||
};
|
};
|
||||||
|
|
||||||
let btn_right = if self.has_next_page() {
|
let btn_right = if self.has_next_page() {
|
||||||
Some(ButtonDetails::down_arrow_icon_wide())
|
Some(ButtonDetails::down_arrow_icon_wide())
|
||||||
} else {
|
} else {
|
||||||
|
@ -16,7 +16,7 @@ use crate::{
|
|||||||
time::Duration,
|
time::Duration,
|
||||||
ui::{
|
ui::{
|
||||||
component::{
|
component::{
|
||||||
base::{Component, ComponentExt},
|
base::Component,
|
||||||
paginated::{PageMsg, Paginate},
|
paginated::{PageMsg, Paginate},
|
||||||
painter,
|
painter,
|
||||||
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecLong, Paragraphs, VecExt},
|
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecLong, Paragraphs, VecExt},
|
||||||
@ -318,7 +318,7 @@ extern "C" fn confirm_output(n_args: usize, args: *const Obj, kwargs: *mut Map)
|
|||||||
};
|
};
|
||||||
let pages = FlowPages::new(get_page, 2);
|
let pages = FlowPages::new(get_page, 2);
|
||||||
|
|
||||||
let obj = LayoutObj::new(Flow::new(pages).with_common_title(title).into_child())?;
|
let obj = LayoutObj::new(Flow::new(pages).with_common_title(title))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
@ -362,7 +362,7 @@ extern "C" fn confirm_total(n_args: usize, args: *const Obj, kwargs: *mut Map) -
|
|||||||
};
|
};
|
||||||
let pages = FlowPages::new(get_page, 1);
|
let pages = FlowPages::new(get_page, 1);
|
||||||
|
|
||||||
let obj = LayoutObj::new(Flow::new(pages).with_common_title(title).into_child())?;
|
let obj = LayoutObj::new(Flow::new(pages).with_common_title(title))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
@ -499,7 +499,7 @@ extern "C" fn tutorial(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj
|
|||||||
|
|
||||||
let pages = FlowPages::new(get_page, PAGE_COUNT);
|
let pages = FlowPages::new(get_page, PAGE_COUNT);
|
||||||
|
|
||||||
let obj = LayoutObj::new(Flow::new(pages).into_child())?;
|
let obj = LayoutObj::new(Flow::new(pages))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
@ -512,7 +512,7 @@ extern "C" fn request_pin(n_args: usize, args: *const Obj, kwargs: *mut Map) ->
|
|||||||
let _allow_cancel: Option<bool> =
|
let _allow_cancel: Option<bool> =
|
||||||
kwargs.get(Qstr::MP_QSTR_allow_cancel)?.try_into_option()?;
|
kwargs.get(Qstr::MP_QSTR_allow_cancel)?.try_into_option()?;
|
||||||
|
|
||||||
let obj = LayoutObj::new(PinEntry::new(prompt).into_child())?;
|
let obj = LayoutObj::new(PinEntry::new(prompt))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
@ -544,10 +544,7 @@ extern "C" fn select_word(n_args: usize, args: *const Obj, kwargs: *mut Map) ->
|
|||||||
let words: Vec<StrBuffer, 3> = iter_into_vec(words_iterable)?;
|
let words: Vec<StrBuffer, 3> = iter_into_vec(words_iterable)?;
|
||||||
|
|
||||||
// TODO: should return int, to be consistent with TT's select_word
|
// TODO: should return int, to be consistent with TT's select_word
|
||||||
let obj = LayoutObj::new(Frame::new(
|
let obj = LayoutObj::new(Frame::new(title, SimpleChoice::new(words, true, true)))?;
|
||||||
title,
|
|
||||||
SimpleChoice::new(words, true, true).into_child(),
|
|
||||||
))?;
|
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
@ -559,10 +556,7 @@ extern "C" fn request_word_count(n_args: usize, args: *const Obj, kwargs: *mut M
|
|||||||
|
|
||||||
let choices: Vec<&str, 3> = ["12", "18", "24"].into_iter().collect();
|
let choices: Vec<&str, 3> = ["12", "18", "24"].into_iter().collect();
|
||||||
|
|
||||||
let obj = LayoutObj::new(Frame::new(
|
let obj = LayoutObj::new(Frame::new(title, SimpleChoice::new(choices, false, false)))?;
|
||||||
title,
|
|
||||||
SimpleChoice::new(choices, false, false).into_child(),
|
|
||||||
))?;
|
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
@ -572,7 +566,7 @@ extern "C" fn request_word_bip39(n_args: usize, args: *const Obj, kwargs: *mut M
|
|||||||
let block = |_args: &[Obj], kwargs: &Map| {
|
let block = |_args: &[Obj], kwargs: &Map| {
|
||||||
let prompt: StrBuffer = kwargs.get(Qstr::MP_QSTR_prompt)?.try_into()?;
|
let prompt: StrBuffer = kwargs.get(Qstr::MP_QSTR_prompt)?.try_into()?;
|
||||||
|
|
||||||
let obj = LayoutObj::new(Frame::new(prompt, Bip39Entry::new().into_child()))?;
|
let obj = LayoutObj::new(Frame::new(prompt, Bip39Entry::new()))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
@ -583,7 +577,7 @@ extern "C" fn request_passphrase(n_args: usize, args: *const Obj, kwargs: *mut M
|
|||||||
let prompt: StrBuffer = kwargs.get(Qstr::MP_QSTR_prompt)?.try_into()?;
|
let prompt: StrBuffer = kwargs.get(Qstr::MP_QSTR_prompt)?.try_into()?;
|
||||||
let _max_len: u8 = kwargs.get(Qstr::MP_QSTR_max_len)?.try_into()?;
|
let _max_len: u8 = kwargs.get(Qstr::MP_QSTR_max_len)?.try_into()?;
|
||||||
|
|
||||||
let obj = LayoutObj::new(Frame::new(prompt, PassphraseEntry::new().into_child()))?;
|
let obj = LayoutObj::new(Frame::new(prompt, PassphraseEntry::new()))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
|
@ -6,6 +6,8 @@ from trezor.strings import format_amount
|
|||||||
from trezor.ui import layouts
|
from trezor.ui import layouts
|
||||||
from trezor.ui.layouts import confirm_metadata
|
from trezor.ui.layouts import confirm_metadata
|
||||||
|
|
||||||
|
from apps.management import text_r
|
||||||
|
|
||||||
from .. import addresses
|
from .. import addresses
|
||||||
from ..common import format_fee_rate
|
from ..common import format_fee_rate
|
||||||
|
|
||||||
@ -261,15 +263,15 @@ async def confirm_nondefault_locktime(
|
|||||||
|
|
||||||
if lock_time_disabled:
|
if lock_time_disabled:
|
||||||
title = "Warning"
|
title = "Warning"
|
||||||
text = "Locktime is set but will\nhave no effect.\n"
|
text = text_r("Locktime is set but will\nhave no effect.\n")
|
||||||
param: str | None = None
|
param: str | None = None
|
||||||
elif lock_time < _LOCKTIME_TIMESTAMP_MIN_VALUE:
|
elif lock_time < _LOCKTIME_TIMESTAMP_MIN_VALUE:
|
||||||
title = "Confirm locktime"
|
title = "Confirm locktime"
|
||||||
text = "Locktime for this\ntransaction is set to\nblockheight:\n{}"
|
text = text_r("Locktime for this\ntransaction is set to\nblockheight:\n{}")
|
||||||
param = str(lock_time)
|
param = str(lock_time)
|
||||||
else:
|
else:
|
||||||
title = "Confirm locktime"
|
title = "Confirm locktime"
|
||||||
text = "Locktime for this\ntransaction is set to:\n{}"
|
text = text_r("Locktime for this\ntransaction is set to:\n{}")
|
||||||
param = format_timestamp(lock_time)
|
param = format_timestamp(lock_time)
|
||||||
|
|
||||||
await confirm_metadata(
|
await confirm_metadata(
|
||||||
|
@ -4,10 +4,11 @@ from typing import TYPE_CHECKING
|
|||||||
import storage.device as storage_device
|
import storage.device as storage_device
|
||||||
from trezor.wire import DataError
|
from trezor.wire import DataError
|
||||||
|
|
||||||
|
from apps.management import text_r
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from trezor.wire import Context
|
from trezor.wire import Context
|
||||||
|
|
||||||
from apps.management import text_r
|
|
||||||
|
|
||||||
_MAX_PASSPHRASE_LEN = const(50)
|
_MAX_PASSPHRASE_LEN = const(50)
|
||||||
|
|
||||||
|
@ -4,9 +4,10 @@ from typing import TYPE_CHECKING
|
|||||||
import storage.cache as storage_cache
|
import storage.cache as storage_cache
|
||||||
from trezor import config, wire
|
from trezor import config, wire
|
||||||
|
|
||||||
from .sdcard import request_sd_salt
|
|
||||||
from apps.management import text_r
|
from apps.management import text_r
|
||||||
|
|
||||||
|
from .sdcard import request_sd_salt
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any, NoReturn
|
from typing import Any, NoReturn
|
||||||
from trezor.wire import Context, GenericContext
|
from trezor.wire import Context, GenericContext
|
||||||
|
@ -11,6 +11,7 @@ from trezor.ui.layouts import (
|
|||||||
should_show_more,
|
should_show_more,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from ..management import text_r
|
||||||
from . import networks
|
from . import networks
|
||||||
from .helpers import decode_typed_data
|
from .helpers import decode_typed_data
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from . import text_r
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from trezor.messages import GetNextU2FCounter, NextU2FCounter
|
from trezor.messages import GetNextU2FCounter, NextU2FCounter
|
||||||
from trezor.wire import Context
|
from trezor.wire import Context
|
||||||
|
|
||||||
from . import text_r
|
|
||||||
|
|
||||||
|
|
||||||
async def get_next_u2f_counter(ctx: Context, msg: GetNextU2FCounter) -> NextU2FCounter:
|
async def get_next_u2f_counter(ctx: Context, msg: GetNextU2FCounter) -> NextU2FCounter:
|
||||||
import storage.device as storage_device
|
import storage.device as storage_device
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from trezor.enums import ButtonRequestType
|
from trezor.enums import ButtonRequestType
|
||||||
from trezor.ui.layouts import show_warning, confirm_action
|
from trezor.ui.layouts import confirm_action, show_warning
|
||||||
from trezor.ui.layouts.recovery import ( # noqa: F401
|
from trezor.ui.layouts.recovery import ( # noqa: F401
|
||||||
request_word_count,
|
request_word_count,
|
||||||
show_group_share_success,
|
show_group_share_success,
|
||||||
|
@ -6,8 +6,8 @@ from trezor.crypto import slip39
|
|||||||
from trezor.enums import BackupType
|
from trezor.enums import BackupType
|
||||||
from trezor.wire import ProcessError
|
from trezor.wire import ProcessError
|
||||||
|
|
||||||
from . import layout
|
|
||||||
from .. import text_r
|
from .. import text_r
|
||||||
|
from . import layout
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
import storage.debug
|
import storage.debug
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from . import text_r
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from trezor.messages import SetU2FCounter, Success
|
from trezor.messages import SetU2FCounter, Success
|
||||||
from trezor.wire import Context
|
from trezor.wire import Context
|
||||||
|
|
||||||
from . import text_r
|
|
||||||
|
|
||||||
|
|
||||||
async def set_u2f_counter(ctx: Context, msg: SetU2FCounter) -> Success:
|
async def set_u2f_counter(ctx: Context, msg: SetU2FCounter) -> Success:
|
||||||
import storage.device as storage_device
|
import storage.device as storage_device
|
||||||
|
@ -10,7 +10,8 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
T = TypeVar("T", bound=Callable)
|
T = TypeVar("T", bound=Callable)
|
||||||
|
|
||||||
|
# TODO: solve this for model R, which does not have a filesystem
|
||||||
|
if hasattr(io, "fatfs"):
|
||||||
fatfs = io.fatfs # global_import_cache
|
fatfs = io.fatfs # global_import_cache
|
||||||
|
|
||||||
SD_CARD_HOT_SWAPPABLE = False
|
SD_CARD_HOT_SWAPPABLE = False
|
||||||
|
@ -1134,7 +1134,7 @@ async def confirm_coinjoin(
|
|||||||
ctx=ctx,
|
ctx=ctx,
|
||||||
br_type="coinjoin_final",
|
br_type="coinjoin_final",
|
||||||
title="AUTHORIZE COINJOIN",
|
title="AUTHORIZE COINJOIN",
|
||||||
data=f"Maximum rounds: {max_rounds}\n\nMaximum mining fee:\n{max_fee_per_vbyte} sats/vbyte",
|
data=f"Maximum rounds: {max_rounds}\n\nMaximum mining fee:\n{max_fee_per_vbyte}",
|
||||||
description="",
|
description="",
|
||||||
br_code=ButtonRequestType.Other,
|
br_code=ButtonRequestType.Other,
|
||||||
)
|
)
|
||||||
|
@ -1119,7 +1119,7 @@ async def request_pin_on_device(
|
|||||||
|
|
||||||
|
|
||||||
async def confirm_pin_action(
|
async def confirm_pin_action(
|
||||||
ctx: wire.GenericContext,
|
ctx: GenericContext,
|
||||||
br_type: str,
|
br_type: str,
|
||||||
title: str,
|
title: str,
|
||||||
action: str | None,
|
action: str | None,
|
||||||
@ -1138,7 +1138,7 @@ async def confirm_pin_action(
|
|||||||
|
|
||||||
|
|
||||||
async def confirm_reenter_pin(
|
async def confirm_reenter_pin(
|
||||||
ctx: wire.GenericContext,
|
ctx: GenericContext,
|
||||||
br_type: str = "set_pin",
|
br_type: str = "set_pin",
|
||||||
br_code: ButtonRequestType = ButtonRequestType.Other,
|
br_code: ButtonRequestType = ButtonRequestType.Other,
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -1153,7 +1153,7 @@ async def confirm_reenter_pin(
|
|||||||
|
|
||||||
|
|
||||||
async def pin_mismatch(
|
async def pin_mismatch(
|
||||||
ctx: wire.GenericContext,
|
ctx: GenericContext,
|
||||||
br_type: str = "set_pin",
|
br_type: str = "set_pin",
|
||||||
br_code: ButtonRequestType = ButtonRequestType.Other,
|
br_code: ButtonRequestType = ButtonRequestType.Other,
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -1169,7 +1169,7 @@ async def pin_mismatch(
|
|||||||
|
|
||||||
|
|
||||||
async def confirm_set_new_pin(
|
async def confirm_set_new_pin(
|
||||||
ctx: wire.GenericContext,
|
ctx: GenericContext,
|
||||||
br_type: str,
|
br_type: str,
|
||||||
title: str,
|
title: str,
|
||||||
action: str,
|
action: str,
|
||||||
|
Loading…
Reference in New Issue
Block a user