Skip to content

Commit

Permalink
feat(core): unify RustLayout, implement single global layout
Browse files Browse the repository at this point in the history
  • Loading branch information
matejcik committed Apr 7, 2024
1 parent ca80a6e commit b75dbe1
Show file tree
Hide file tree
Showing 39 changed files with 2,065 additions and 2,764 deletions.
28 changes: 24 additions & 4 deletions common/protob/messages-debug.proto
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ message DebugLinkDecision {

optional uint32 x = 4; // touch X coordinate
optional uint32 y = 5; // touch Y coordinate
optional bool wait = 6; // wait for layout change
optional bool wait = 6 [deprecated=true]; // wait for layout change
optional uint32 hold_ms = 7; // touch hold duration
optional DebugPhysicalButton physical_button = 8; // physical button press
}
Expand All @@ -61,6 +61,7 @@ message DebugLinkDecision {
* @end
*/
message DebugLinkLayout {
option deprecated = true;
repeated string tokens = 1;
}

Expand Down Expand Up @@ -89,9 +90,26 @@ message DebugLinkRecordScreen {
* @next DebugLinkState
*/
message DebugLinkGetState {
optional bool wait_word_list = 1; // Trezor T only - wait until mnemonic words are shown
optional bool wait_word_pos = 2; // Trezor T only - wait until reset word position is requested
optional bool wait_layout = 3; // wait until current layout changes
/// Wait behavior of the call.
enum DebugWaitType {
/// Respond immediately. If no layout is currently displayed, the layout
/// response will be empty.
IMMEDIATE = 0;
/// Wait for next layout. If a layout is displayed, waits for it to change.
/// If no layout is displayed, waits for one to come up.
NEXT_LAYOUT = 1;
/// Return current layout. If no layout is currently displayed, waits for
/// one to come up.
CURRENT_LAYOUT = 2;
}

// Trezor T < 2.6.0 only - wait until mnemonic words are shown
optional bool wait_word_list = 1 [deprecated=true];
// Trezor T < 2.6.0 only - wait until reset word position is requested
optional bool wait_word_pos = 2 [deprecated=true];
// trezor-core only - wait until current layout changes
// changed in 2.6.4: multiple wait types instead of true/false.
optional DebugWaitType wait_layout = 3 [default=IMMEDIATE];
}

/**
Expand Down Expand Up @@ -192,6 +210,7 @@ message DebugLinkEraseSdCard {
* @next Success
*/
message DebugLinkWatchLayout {
option deprecated = true;
optional bool watch = 1; // if true, start watching layout.
// if false, stop.
}
Expand All @@ -203,4 +222,5 @@ message DebugLinkWatchLayout {
* @next Success
*/
message DebugLinkResetDebugEvents {
option deprecated = true;
}
6 changes: 2 additions & 4 deletions core/src/all_modules.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions core/src/apps/bitcoin/sign_tx/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
if TYPE_CHECKING:
from trezor.enums import AmountUnit
from trezor.messages import TxAckPaymentRequest, TxOutput
from trezor.ui.layouts import LayoutType

from apps.common.coininfo import CoinInfo
from apps.common.paths import Bip32Path
Expand Down Expand Up @@ -72,7 +71,7 @@ async def confirm_output(
assert data is not None
if omni.is_valid(data):
# OMNI transaction
layout: LayoutType = confirm_metadata(
layout = confirm_metadata(
"omni_transaction",
"OMNI transaction",
omni.parse(data),
Expand Down
4 changes: 0 additions & 4 deletions core/src/apps/bitcoin/sign_tx/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ def report_init(self) -> None:
self.progress_layout = progress_layout(text)

def report(self) -> None:
from trezor import utils

if utils.DISABLE_ANIMATION:
return
p = int(1000 * self.progress / self.steps)
self.progress_layout.report(p)

Expand Down
2 changes: 1 addition & 1 deletion core/src/apps/common/mnemonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

if TYPE_CHECKING:
from trezor.enums import BackupType
from trezor.ui.layouts.common import ProgressLayout
from trezor.ui import ProgressLayout


def get() -> tuple[bytes | None, BackupType]:
Expand Down
Loading

0 comments on commit b75dbe1

Please sign in to comment.