Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
y = const(20)
size = const(10)
padding = const(14)
box_w = const(240)
x = (box_w - l * padding) // 2
for i in range(0, l):
ui.display.bar_radius(x + i * padding, y, size, size, ui.GREY, ui.BG, 4)
elif self.sublabel:
# input line with header label and sublabel
display.text_center(ui.WIDTH // 2, 20, self.label, ui.BOLD, ui.GREY, ui.BG)
display.text_center(
ui.WIDTH // 2, 46, self.sublabel, ui.NORMAL, ui.GREY, ui.BG
)
else:
# input line with header label
display.text_center(ui.WIDTH // 2, 36, self.label, ui.BOLD, ui.GREY, ui.BG)
self.tainted = False
if not label:
label = "My TREZOR"
if not image:
image = res.load("apps/homescreen/res/bg.toif")
await ui.backlight_slide(ui.BACKLIGHT_DIM)
ui.display.clear()
ui.display.avatar(48, 48, image, ui.TITLE_GREY, ui.BG)
ui.display.text_center(ui.WIDTH // 2, 35, label, ui.BOLD, ui.TITLE_GREY, ui.BG)
ui.display.bar_radius(40, 100, 160, 40, ui.TITLE_GREY, ui.BG, 4)
ui.display.bar_radius(42, 102, 156, 36, ui.BG, ui.TITLE_GREY, 4)
ui.display.text_center(ui.WIDTH // 2, 128, "Locked", ui.BOLD, ui.TITLE_GREY, ui.BG)
ui.display.text_center(
ui.WIDTH // 2 + 10, 220, "Tap to unlock", ui.BOLD, ui.TITLE_GREY, ui.BG
)
ui.display.icon(45, 202, res.load(ui.ICON_CLICK), ui.TITLE_GREY, ui.BG)
await ui.backlight_slide(ui.BACKLIGHT_NORMAL)
await ui.click()
def on_render(self):
current = self.current
total_num = self.total_num
ui.header("Syncing", ui.ICON_SEND, ui.TITLE_GREY, ui.BG, ui.BLUE)
p = (1000 * (current + 1) // total_num) if total_num > 0 else 0
ui.display.loader(p, False, 18, ui.WHITE, ui.BG)
def render_background(self, s, ax, ay, aw, ah):
radius = s["radius"]
bg_color = s["bg-color"]
border_color = s["border-color"]
if border_color != bg_color:
# render border and background on top of it
display.bar_radius(ax, ay, aw, ah, border_color, ui.BG, radius)
display.bar_radius(
ax + BORDER,
ay + BORDER,
aw - BORDER * 2,
ah - BORDER * 2,
bg_color,
border_color,
radius,
)
else:
# render only the background
display.bar_radius(ax, ay, aw, ah, bg_color, ui.BG, radius)
from trezor import ui, res
ui.display.clear()
ui.display.backlight(255)
image = res.load('../../src/apps/homescreen/res/trezor.toig')
ui.display.icon(0, 0, image, ui.WHITE, ui.BLACK)
ui.display.bar(0, 175, 240, 48, ui.BLACK)
ui.display.text_center(120, 192 + 32, "Visit TREZOR.io/start", 1, ui.WHITE, ui.BLACK)
while True:
ui.display.refresh()
ui.display.bar(0, 60, 240, 128, ui.BLACK)
image = res.load('./res/sl_logo.toif')
ui.display.image(60, 64, image)
confirm = button.Button((121, 240 - 48, 119, 48), 'Confirm', normal_style=button.CONFIRM_BUTTON, active_style=button.CONFIRM_BUTTON_ACTIVE)
confirm.render()
cancel = button.Button((0, 240 - 48, 119, 48), 'Cancel', normal_style=button.CANCEL_BUTTON, active_style=button.CANCEL_BUTTON_ACTIVE)
cancel.render()
while True:
logo()
ui.display.refresh()
utime.sleep(2)
fingerprint()
ui.display.refresh()
utime.sleep(2)
#!../../vendor/micropython/unix/micropython
import sys
sys.path.append('../../src')
from trezor import ui
from trezor.ui import button
from bl_common import bl_header
ui.display.clear()
ui.display.backlight(255)
# background frame
ui.display.bar(0, 10, 240, 240 - 50, ui.LIGHT_RED)
ui.display.bar(3, 3, 234, 240 - 54, ui.BLACK)
# header
bl_header('Install failed')
# content
ui.display.text(10, 53, 'Some error happend', ui.NORMAL, ui.WHITE, ui.BLACK)
ui.display.text(10, 79, 'Sorry, try again maybe?', ui.NORMAL, ui.WHITE, ui.BLACK)
reboot = button.Button((0, 240 - 48, 240, 48), 'Reboot', normal_style=button.DEFAULT_BUTTON, active_style=button.DEFAULT_BUTTON_ACTIVE)
reboot.render()
if start is None:
return
now = utime.ticks_ms()
if stop is None:
r = min(now - start, target)
else:
r = max(stop - start + (stop - now) * 2, 0)
if r != target:
s = self.normal_style
else:
s = self.active_style
Y = const(-24)
if s.icon is None:
display.loader(r, False, Y, s.fg_color, s.bg_color)
else:
display.loader(
r, False, Y, s.fg_color, s.bg_color, res.load(s.icon), s.icon_fg_color
)
if (r == 0) and (self.stop_ms is not None):
self.start_ms = None
self.stop_ms = None
self.on_start()
if r == target:
self.on_finish()
elif pdx < 0 and dirs & SWIPE_LEFT:
self.on_swipe(SWIPE_LEFT)
return
elif pdxa < pdya and dirs & SWIPE_VERTICAL:
# vertical direction
ratio = min(pdya / _SWIPE_DISTANCE, 1)
if ratio * 100 >= _SWIPE_TRESHOLD:
if pdy > 0 and dirs & SWIPE_DOWN:
self.on_swipe(SWIPE_DOWN)
return
elif pdy < 0 and dirs & SWIPE_UP:
self.on_swipe(SWIPE_UP)
return
# no swipe detected, reset the state
ui.display.backlight(self.light_origin)
self.started = False