mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-02 04:42:33 +00:00
WIP - fixes and comments
This commit is contained in:
parent
3c441d089b
commit
1f35a64c3b
@ -16,7 +16,7 @@ pub enum Bip39EntryMsg {
|
|||||||
ResultWord(String<15>),
|
ResultWord(String<15>),
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAX_LENGTH: usize = 10;
|
const MAX_WORD_LENGTH: usize = 10;
|
||||||
const MAX_CHOICE_LENGTH: usize = 26;
|
const MAX_CHOICE_LENGTH: usize = 26;
|
||||||
|
|
||||||
/// Offer words when there will be fewer of them than this
|
/// Offer words when there will be fewer of them than this
|
||||||
@ -110,9 +110,9 @@ impl ChoiceFactory for ChoiceFactoryBIP39 {
|
|||||||
/// Component for entering a BIP39 mnemonic.
|
/// Component for entering a BIP39 mnemonic.
|
||||||
pub struct Bip39Entry {
|
pub struct Bip39Entry {
|
||||||
choice_page: ChoicePage<ChoiceFactoryBIP39>,
|
choice_page: ChoicePage<ChoiceFactoryBIP39>,
|
||||||
chosen_letters: Child<ChangingTextLine<String<{ MAX_LENGTH + 1 }>>>,
|
chosen_letters: Child<ChangingTextLine<String<{ MAX_WORD_LENGTH + 1 }>>>,
|
||||||
letter_choices: Vec<char, MAX_CHOICE_LENGTH>,
|
letter_choices: Vec<char, MAX_CHOICE_LENGTH>,
|
||||||
textbox: TextBox<MAX_LENGTH>,
|
textbox: TextBox<MAX_WORD_LENGTH>,
|
||||||
offer_words: bool,
|
offer_words: bool,
|
||||||
words_list: bip39::Wordlist,
|
words_list: bip39::Wordlist,
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ impl Bip39Entry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn update_chosen_letters(&mut self, ctx: &mut EventCtx) {
|
fn update_chosen_letters(&mut self, ctx: &mut EventCtx) {
|
||||||
let text = build_string!({ MAX_LENGTH + 1 }, self.textbox.content(), PROMPT);
|
let text = build_string!({ MAX_WORD_LENGTH + 1 }, self.textbox.content(), PROMPT);
|
||||||
self.chosen_letters.inner_mut().update_text(text);
|
self.chosen_letters.inner_mut().update_text(text);
|
||||||
self.chosen_letters.request_complete_repaint(ctx);
|
self.chosen_letters.request_complete_repaint(ctx);
|
||||||
}
|
}
|
||||||
|
@ -112,13 +112,14 @@ impl ChoiceFactoryPassphrase {
|
|||||||
ButtonLayout::default_three_icons(),
|
ButtonLayout::default_three_icons(),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Including accept button on the left and cancel on the very right
|
// Including accept button on the left and cancel on the very right.
|
||||||
// TODO: could have some icons instead of the shortcut text
|
// TODO: could have some icons instead of the shortcut text
|
||||||
if choice_index == 0 {
|
if choice_index == 0 {
|
||||||
menu_item.set_left_btn(Some(
|
menu_item.set_left_btn(Some(
|
||||||
ButtonDetails::text("ACC").with_duration(HOLD_DURATION),
|
ButtonDetails::text("ACC").with_duration(HOLD_DURATION),
|
||||||
));
|
));
|
||||||
} else if choice_index == MENU.len() as u8 - 1 {
|
}
|
||||||
|
if choice_index == MENU.len() as u8 - 1 {
|
||||||
menu_item.set_right_btn(Some(
|
menu_item.set_right_btn(Some(
|
||||||
ButtonDetails::text("CAN").with_duration(HOLD_DURATION),
|
ButtonDetails::text("CAN").with_duration(HOLD_DURATION),
|
||||||
));
|
));
|
||||||
|
@ -42,10 +42,12 @@ where
|
|||||||
let mut choice_item = ChoiceItem::new(text, ButtonLayout::default_three_icons());
|
let mut choice_item = ChoiceItem::new(text, ButtonLayout::default_three_icons());
|
||||||
|
|
||||||
// Disabling prev/next buttons for the first/last choice when not in carousel.
|
// Disabling prev/next buttons for the first/last choice when not in carousel.
|
||||||
|
// (could be done to the same button if there is only one)
|
||||||
if !self.carousel {
|
if !self.carousel {
|
||||||
if choice_index == 0 {
|
if choice_index == 0 {
|
||||||
choice_item.set_left_btn(None);
|
choice_item.set_left_btn(None);
|
||||||
} else if choice_index as usize == N - 1 {
|
}
|
||||||
|
if choice_index as usize == N - 1 {
|
||||||
choice_item.set_right_btn(None);
|
choice_item.set_right_btn(None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,17 @@ def confirm_total_r(
|
|||||||
"""Confirm summary of a transaction. Specific for model R."""
|
"""Confirm summary of a transaction. Specific for model R."""
|
||||||
|
|
||||||
|
|
||||||
|
# rust/src/ui/model_tr/layout.rs
|
||||||
|
def show_qr(
|
||||||
|
*,
|
||||||
|
title: str,
|
||||||
|
address: str,
|
||||||
|
verb_cancel: str,
|
||||||
|
case_sensitive: bool,
|
||||||
|
) -> object:
|
||||||
|
"""Show QR code."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tr/layout.rs
|
# rust/src/ui/model_tr/layout.rs
|
||||||
def tutorial() -> object:
|
def tutorial() -> object:
|
||||||
"""Show user how to interact with the device."""
|
"""Show user how to interact with the device."""
|
||||||
|
Loading…
Reference in New Issue
Block a user