diff --git a/src/apps/homescreen/homescreen.py b/src/apps/homescreen/homescreen.py index b0b789e2b5..2ea8beeee4 100644 --- a/src/apps/homescreen/homescreen.py +++ b/src/apps/homescreen/homescreen.py @@ -22,7 +22,7 @@ def display_homescreen(): if not image: image = res.load('apps/homescreen/res/bg.toif') - ui.display.bar(0, 0, ui.SCREEN, ui.SCREEN, ui.BG) + ui.display.bar(0, 0, ui.WIDTH, ui.HEIGHT, ui.BG) ui.display.avatar(48, 48 - 10, image, ui.WHITE, ui.BLACK) ui.display.text_center(120, 220, label, ui.BOLD, ui.FG, ui.BG) diff --git a/src/trezor/pin.py b/src/trezor/pin.py index 2b9752a8a1..29be6f9659 100644 --- a/src/trezor/pin.py +++ b/src/trezor/pin.py @@ -6,7 +6,7 @@ def pin_to_int(pin: str) -> int: def show_pin_timeout(wait: int, total: int): - ui.display.bar(0, 0, ui.SCREEN, ui.SCREEN, ui.BG) + ui.display.bar(0, 0, ui.WIDTH, ui.HEIGHT, ui.BG) ui.display.loader(1000 - (1000 * wait // total), -10, ui.FG, ui.BG) - ui.display.text_center(ui.SCREEN // 2, ui.SCREEN - 20, 'Waiting for %d s' % wait, ui.BOLD, ui.FG, ui.BG) + ui.display.text_center(ui.WIDTH // 2, ui.HEIGHT - 20, 'Waiting for %d s' % wait, ui.BOLD, ui.FG, ui.BG) ui.display.refresh() diff --git a/src/trezor/ui/__init__.py b/src/trezor/ui/__init__.py index 8e85c242b0..493287f2c1 100644 --- a/src/trezor/ui/__init__.py +++ b/src/trezor/ui/__init__.py @@ -23,7 +23,8 @@ SIZE = Display.FONT_SIZE NORMAL = Display.FONT_NORMAL BOLD = Display.FONT_BOLD MONO = Display.FONT_MONO -SCREEN = Display.WIDTH # used also for height as we have square display +WIDTH = Display.WIDTH +HEIGHT = Display.HEIGHT def lerpi(a: int, b: int, t: float) -> int: @@ -132,7 +133,6 @@ def header(title: str, VIEWX = const(6) VIEWY = const(9) -VIEW = const(228) # SCREEN - 2 * VIEWX def grid(i: int, @@ -140,8 +140,8 @@ def grid(i: int, n_y: int=5, start_x: int=VIEWX, start_y: int=VIEWY, - end_x: int=(VIEWX + VIEW), - end_y: int=(VIEWY + VIEW), + end_x: int=(WIDTH - VIEWX), + end_y: int=(HEIGHT - VIEWY), cells_x: int=1, cells_y: int=1, spacing: int=0): diff --git a/src/trezor/ui/passphrase.py b/src/trezor/ui/passphrase.py index 9522aad291..c12a799618 100644 --- a/src/trezor/ui/passphrase.py +++ b/src/trezor/ui/passphrase.py @@ -99,7 +99,7 @@ class PassphraseKeyboard(ui.Widget): self.input.render() else: display.bar(0, 0, 240, 48, ui.BG) - display.text_center(ui.SCREEN // 2, 32, self.prompt, ui.BOLD, ui.GREY, ui.BG) + display.text_center(ui.WIDTH // 2, 32, self.prompt, ui.BOLD, ui.GREY, ui.BG) render_scrollbar(self.page) # buttons self.back.render() diff --git a/src/trezor/ui/swipe.py b/src/trezor/ui/swipe.py index b620cea22a..70c775e5dc 100644 --- a/src/trezor/ui/swipe.py +++ b/src/trezor/ui/swipe.py @@ -27,7 +27,7 @@ def degrees(swipe: int) -> int: class Swipe(ui.Widget): def __init__(self, area=None, absolute=False, directions=SWIPE_ALL, treshold=30): - self.area = area or (0, 0, ui.SCREEN, ui.SCREEN) + self.area = area or (0, 0, ui.WIDTH, ui.HEIGHT) self.absolute = absolute self.directions = directions self.treshold = treshold