diff --git a/core/src/apps/debug/__init__.py b/core/src/apps/debug/__init__.py index 5084f8a3cd..e5ea8379b9 100644 --- a/core/src/apps/debug/__init__.py +++ b/core/src/apps/debug/__init__.py @@ -65,8 +65,8 @@ if __debug__: async def _dispatch_debuglink_decision(msg: DebugLinkDecision) -> None: from trezor.enums import DebugButton, DebugSwipeDirection - from trezor.ui import Result - from trezor.ui.components.common import ( + from trezor.ui import ( + Result, SWIPE_UP, SWIPE_DOWN, SWIPE_LEFT, diff --git a/core/src/trezor/ui/__init__.py b/core/src/trezor/ui/__init__.py index 31e9a98a06..e2defdc00c 100644 --- a/core/src/trezor/ui/__init__.py +++ b/core/src/trezor/ui/__init__.py @@ -16,6 +16,14 @@ MONO: int = Display.FONT_MONO WIDTH: int = Display.WIDTH HEIGHT: int = Display.HEIGHT +if __debug__: + # common symbols to transfer swipes between debuglink and the UI + SWIPE_UP = const(0x01) + SWIPE_DOWN = const(0x02) + SWIPE_LEFT = const(0x04) + SWIPE_RIGHT = const(0x08) + + # channel used to cancel layouts, see `Cancelled` exception layout_chan = loop.chan() diff --git a/core/src/trezor/ui/components/__init__.py b/core/src/trezor/ui/components/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/core/src/trezor/ui/components/common/__init__.py b/core/src/trezor/ui/components/common/__init__.py deleted file mode 100644 index dde3163753..0000000000 --- a/core/src/trezor/ui/components/common/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -""" -The components/common module contains code that is used by both components/tt -and components/t1. -""" -from micropython import const - -SWIPE_UP = const(0x01) -SWIPE_DOWN = const(0x02) -SWIPE_LEFT = const(0x04) -SWIPE_RIGHT = const(0x08) diff --git a/core/src/trezor/ui/layouts/tt_v2/__init__.py b/core/src/trezor/ui/layouts/tt_v2/__init__.py index f8420c46cd..5870a81058 100644 --- a/core/src/trezor/ui/layouts/tt_v2/__init__.py +++ b/core/src/trezor/ui/layouts/tt_v2/__init__.py @@ -7,7 +7,6 @@ from trezor.wire import ActionCancelled import trezorui2 -from ...components.common.confirm import CANCELLED, CONFIRMED, INFO from ..common import button_request, interact if TYPE_CHECKING: @@ -21,6 +20,10 @@ if TYPE_CHECKING: BR_TYPE_OTHER = ButtonRequestType.Other # global_import_cache +CONFIRMED = trezorui2.CONFIRMED +CANCELLED = trezorui2.CANCELLED +INFO = trezorui2.INFO + class _RustLayout(ui.Layout): # pylint: disable=super-init-not-called @@ -66,7 +69,7 @@ class _RustLayout(ui.Layout): async def handle_swipe(self): from apps.debug import notify_layout_change, swipe_signal - from trezor.ui.components.common import ( + from trezor.ui import ( SWIPE_UP, SWIPE_DOWN, SWIPE_LEFT,