mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
tests with UI and minor changes in scroll component
This commit is contained in:
parent
be01cee8d3
commit
53a6132ed8
43
src/apps/playground_chren/layout_send_tx.py
Normal file
43
src/apps/playground_chren/layout_send_tx.py
Normal file
@ -0,0 +1,43 @@
|
||||
from trezor import ui
|
||||
from trezor import loop
|
||||
from trezor import res
|
||||
from trezor.ui.scroll import Scroll
|
||||
|
||||
def layout_send_tx():
|
||||
|
||||
# paint background black
|
||||
ui.display.bar(0, 0, 240, 240, ui.BLACK)
|
||||
|
||||
# top header bar
|
||||
# ui.display.bar(0, 0, 240, 48, ui.PM_BLUE, ui.BLACK, 4)
|
||||
ui.display.icon(10, 9, res.load('apps/playground_chren/res/arrow-up2.toig'), ui.BLACK, ui.PM_BLUE)
|
||||
ui.display.text(40, 28, 'Sending coins', ui.BOLD, ui.PM_BLUE, ui.BLACK)
|
||||
|
||||
|
||||
# content
|
||||
ui.display.bar(0, 42, 240, 198, ui.BLACK)
|
||||
ui.display.text(10, 70, 'Amount:', ui.BOLD, ui.GREY, ui.BLACK)
|
||||
ui.display.text(10, 100, '0.0000341 BTC', ui.MONO, ui.WHITE, ui.BLACK)
|
||||
ui.display.text(10, 130, 'To address:', ui.BOLD, ui.GREY, ui.BLACK)
|
||||
ui.display.text(10, 160, '1NDpZ2wyFekVezssS', ui.MONO, ui.WHITE, ui.BLACK)
|
||||
ui.display.text(10, 185, 'Xv2tmQgmxcoHMUJ7u', ui.MONO, ui.WHITE, ui.BLACK)
|
||||
|
||||
scroll = Scroll(page=0, totale_lines=20, lines_per_page=4)
|
||||
scroll.render()
|
||||
|
||||
|
||||
# swipe down indicator
|
||||
def func_top(foreground):
|
||||
ui.display.bar(102, 214, 36, 4, foreground, ui.BLACK, 2)
|
||||
|
||||
def func_middle(foreground):
|
||||
ui.display.bar(106, 222, 28, 4, foreground, ui.BLACK, 2)
|
||||
|
||||
def func_bottom(foreground):
|
||||
ui.display.bar(110, 230, 20, 4, foreground, ui.BLACK, 2)
|
||||
|
||||
animation_top = ui.animate_pulse(func_top, ui.PM_BLUE, ui.PM_DARK_BLUE, speed=300000, delay=0)
|
||||
animation_middle = ui.animate_pulse(func_middle, ui.PM_BLUE, ui.PM_DARK_BLUE, speed=300000, delay=200000)
|
||||
animation_bottom = ui.animate_pulse(func_bottom, ui.PM_BLUE, ui.PM_DARK_BLUE, speed=300000, delay=400000)
|
||||
|
||||
yield loop.Wait([animation_top, animation_middle, animation_bottom])
|
BIN
src/apps/playground_chren/res/arrow-up2.toig
Normal file
BIN
src/apps/playground_chren/res/arrow-up2.toig
Normal file
Binary file not shown.
@ -37,6 +37,11 @@ BLUE_GRAY = rgbcolor(0x60, 0x7D, 0x8B)
|
||||
BLACK = rgbcolor(0x00, 0x00, 0x00)
|
||||
WHITE = rgbcolor(0xFF, 0xFF, 0xFF)
|
||||
|
||||
# password manager palette
|
||||
|
||||
PM_DARK_BLUE = rgbcolor(0x1A, 0x29, 0x42)
|
||||
PM_BLUE = rgbcolor(0x34, 0x98, 0xdb)
|
||||
|
||||
MONO = const(0)
|
||||
NORMAL = const(1)
|
||||
BOLD = const(2)
|
||||
|
@ -10,7 +10,7 @@ class Scroll():
|
||||
self.lines_per_page = lines_per_page
|
||||
|
||||
def render(self):
|
||||
count = len(self.totale_lines) // self.lines_per_page
|
||||
count = self.totale_lines // self.lines_per_page
|
||||
padding = 20
|
||||
screen_height = const(220)
|
||||
cursor = 8
|
||||
@ -18,13 +18,13 @@ class Scroll():
|
||||
if count * padding > screen_height:
|
||||
padding = screen_height // count
|
||||
|
||||
x = 220
|
||||
y = (10 + (screen_height // 2)) - ((count // 2) * padding)
|
||||
x = 230
|
||||
y = ((screen_height // 2)) - ((count // 2) * padding)
|
||||
|
||||
for i in range(0, count):
|
||||
if (i != self.page):
|
||||
ui.display.bar(x, y + i * padding, cursor, cursor, ui.GREY)
|
||||
ui.display.bar(x, y + self.page * padding, cursor, cursor, ui.WHITE)
|
||||
ui.display.bar(x, y + i * padding, cursor, cursor, ui.GREY, ui.BLACK, 4)
|
||||
ui.display.bar(x, y + self.page * padding, cursor, cursor, ui.WHITE, ui.BLACK, 4)
|
||||
|
||||
def wait(self):
|
||||
while True:
|
||||
|
Loading…
Reference in New Issue
Block a user