fixup! fix(core): rebase on current drawlib

pull/3644/head
Martin Milata 2 months ago
parent 25b0e3b048
commit 38cb5c3bcc

@ -140,10 +140,10 @@ where
let background_color = theme::BG; let background_color = theme::BG;
let inactive_color = background_color.blend(active_color, 85); let inactive_color = background_color.blend(active_color, 85);
let start = (self.value - 100) % 1000; let start = (self.value as i32 - 100) % 1000;
let end = (self.value + 100) % 1000; let end = (self.value as i32 + 100) % 1000;
let start = ((start as i32 * 8 * PI4 as i32) / 1000) as i16; let start = ((start * 8 * PI4 as i32) / 1000) as i16;
let end = ((end as i32 * 8 * PI4 as i32) / 1000) as i16; let end = ((end * 8 * PI4 as i32) / 1000) as i16;
shape::Circle::new(center, LOADER_OUTER) shape::Circle::new(center, LOADER_OUTER)
.with_bg(inactive_color) .with_bg(inactive_color)

@ -62,7 +62,19 @@ where
page_swipe.allow_right = scrollbar.has_previous_page(); page_swipe.allow_right = scrollbar.has_previous_page();
page_swipe.allow_left = scrollbar.has_next_page(); page_swipe.allow_left = scrollbar.has_next_page();
let current_account = get_account(scrollbar.active_page); // NOTE: This is an ugly hotfix for the erroneous behavior of
// TextLayout used in the account_name Label. In this
// particular case, TextLayout calculates the wrong height of
// fitted text that's higher than the TextLayout bound itself.
//
// The following two lines should be swapped when the problem with
// TextLayout is fixed.
//
// See also, continuation of this hotfix in the place() function.
// let current_account = get_account(scrollbar.active_page);
let current_account = "".into();
Self { Self {
app_name: Label::centered(app_name, theme::TEXT_DEMIBOLD), app_name: Label::centered(app_name, theme::TEXT_DEMIBOLD),
@ -147,6 +159,11 @@ where
self.app_name.place(app_name_area); self.app_name.place(app_name_area);
self.account_name.place(account_name_area); self.account_name.place(account_name_area);
// NOTE: This is a hotfix used due to the erroneous behavior of TextLayout.
// This line should be removed when the problem with TextLayout is fixed.
// See also the code for FidoConfirm::new().
self.account_name.set_text((self.get_account)(self.scrollbar.active_page));
bounds bounds
} }

@ -66,7 +66,7 @@ impl BasicCanvas for DisplayModelMercury {
self.size self.size
} }
fn fill_rect(&mut self, r: Rect, color: Color) { fn fill_rect(&mut self, r: Rect, color: Color, _alpha: u8) {
let r = r.translate(self.viewport.origin); let r = r.translate(self.viewport.origin);
Dma2d::wnd565_fill(r, self.viewport.clip, color); Dma2d::wnd565_fill(r, self.viewport.clip, color);
} }

@ -655,11 +655,16 @@ async def confirm_output(
return return
async def confirm_payment_request( async def should_show_payment_request_details(
recipient_name: str, recipient_name: str,
amount: str, amount: str,
memos: list[str], memos: list[str],
) -> bool: ) -> bool:
"""Return True if the user wants to show payment request details (they click a
special button) and False when the user wants to continue without showing details.
Raises ActionCancelled if the user cancels.
"""
result = await interact( result = await interact(
RustLayout( RustLayout(
trezorui2.confirm_with_info( trezorui2.confirm_with_info(
@ -674,12 +679,10 @@ async def confirm_payment_request(
ButtonRequestType.ConfirmOutput, ButtonRequestType.ConfirmOutput,
) )
# When user pressed INFO, returning False, which gets processed in higher function
# to differentiate it from CONFIRMED. Raising otherwise.
if result is CONFIRMED: if result is CONFIRMED:
return True
elif result is INFO:
return False return False
elif result is INFO:
return True
else: else:
raise ActionCancelled raise ActionCancelled

@ -371,6 +371,7 @@ def test_signmessage_pagination(client: Client, message: str):
@pytest.mark.skip_t1b1 @pytest.mark.skip_t1b1
@pytest.mark.skip_t2b1(reason="Different screen size") @pytest.mark.skip_t2b1(reason="Different screen size")
@pytest.mark.skip_t3t1(reason="Different fonts")
def test_signmessage_pagination_trailing_newline(client: Client): def test_signmessage_pagination_trailing_newline(client: Client):
message = "THIS\nMUST\nNOT\nBE\nPAGINATED\n" message = "THIS\nMUST\nNOT\nBE\nPAGINATED\n"
# The trailing newline must not cause a new paginated screen to appear. # The trailing newline must not cause a new paginated screen to appear.

@ -950,7 +950,7 @@ class InputFlowLockTimeDatetime(InputFlowBase):
def assert_func(self, debug: DebugLink, br: messages.ButtonRequest) -> None: def assert_func(self, debug: DebugLink, br: messages.ButtonRequest) -> None:
layout_text = get_text_possible_pagination(debug, br) layout_text = get_text_possible_pagination(debug, br)
TR.assert_in(layout_text, "bitcoin__locktime_set_to") TR.assert_in(layout_text, "bitcoin__locktime_set_to")
assert self.lock_time_str in layout_text assert self.lock_time_str.replace(' ', '') in layout_text.replace(' ', '')
def input_flow_tt(self) -> BRGeneratorType: def input_flow_tt(self) -> BRGeneratorType:
yield from lock_time_input_flow_tt(self.debug, self.assert_func) yield from lock_time_input_flow_tt(self.debug, self.assert_func)

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save