src/trezor/ui: split ui.SCREEN into ui.WIDTH and ui.HEIGHT
This commit is contained in:
parent
d5ab82ae2b
commit
d9324f3e57
|
@ -22,7 +22,7 @@ def display_homescreen():
|
||||||
if not image:
|
if not image:
|
||||||
image = res.load('apps/homescreen/res/bg.toif')
|
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.avatar(48, 48 - 10, image, ui.WHITE, ui.BLACK)
|
||||||
ui.display.text_center(120, 220, label, ui.BOLD, ui.FG, ui.BG)
|
ui.display.text_center(120, 220, label, ui.BOLD, ui.FG, ui.BG)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ def pin_to_int(pin: str) -> int:
|
||||||
|
|
||||||
|
|
||||||
def show_pin_timeout(wait: int, total: 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.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()
|
ui.display.refresh()
|
||||||
|
|
|
@ -23,7 +23,8 @@ SIZE = Display.FONT_SIZE
|
||||||
NORMAL = Display.FONT_NORMAL
|
NORMAL = Display.FONT_NORMAL
|
||||||
BOLD = Display.FONT_BOLD
|
BOLD = Display.FONT_BOLD
|
||||||
MONO = Display.FONT_MONO
|
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:
|
def lerpi(a: int, b: int, t: float) -> int:
|
||||||
|
@ -132,7 +133,6 @@ def header(title: str,
|
||||||
|
|
||||||
VIEWX = const(6)
|
VIEWX = const(6)
|
||||||
VIEWY = const(9)
|
VIEWY = const(9)
|
||||||
VIEW = const(228) # SCREEN - 2 * VIEWX
|
|
||||||
|
|
||||||
|
|
||||||
def grid(i: int,
|
def grid(i: int,
|
||||||
|
@ -140,8 +140,8 @@ def grid(i: int,
|
||||||
n_y: int=5,
|
n_y: int=5,
|
||||||
start_x: int=VIEWX,
|
start_x: int=VIEWX,
|
||||||
start_y: int=VIEWY,
|
start_y: int=VIEWY,
|
||||||
end_x: int=(VIEWX + VIEW),
|
end_x: int=(WIDTH - VIEWX),
|
||||||
end_y: int=(VIEWY + VIEW),
|
end_y: int=(HEIGHT - VIEWY),
|
||||||
cells_x: int=1,
|
cells_x: int=1,
|
||||||
cells_y: int=1,
|
cells_y: int=1,
|
||||||
spacing: int=0):
|
spacing: int=0):
|
||||||
|
|
|
@ -99,7 +99,7 @@ class PassphraseKeyboard(ui.Widget):
|
||||||
self.input.render()
|
self.input.render()
|
||||||
else:
|
else:
|
||||||
display.bar(0, 0, 240, 48, ui.BG)
|
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)
|
render_scrollbar(self.page)
|
||||||
# buttons
|
# buttons
|
||||||
self.back.render()
|
self.back.render()
|
||||||
|
|
|
@ -27,7 +27,7 @@ def degrees(swipe: int) -> int:
|
||||||
class Swipe(ui.Widget):
|
class Swipe(ui.Widget):
|
||||||
|
|
||||||
def __init__(self, area=None, absolute=False, directions=SWIPE_ALL, treshold=30):
|
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.absolute = absolute
|
||||||
self.directions = directions
|
self.directions = directions
|
||||||
self.treshold = treshold
|
self.treshold = treshold
|
||||||
|
|
Loading…
Reference in New Issue