1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

src/trezor/ui: split ui.SCREEN into ui.WIDTH and ui.HEIGHT

This commit is contained in:
Pavol Rusnak 2018-02-22 16:44:46 +01:00
parent d5ab82ae2b
commit d9324f3e57
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
5 changed files with 9 additions and 9 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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):

View File

@ -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()

View File

@ -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