mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-25 18:28:47 +00:00
33 lines
886 B
Python
33 lines
886 B
Python
from . import display
|
|
from trezor import ui, loop, res
|
|
|
|
|
|
class Scroll():
|
|
|
|
def __init__(self, page=0, totale_lines=0, lines_per_page=4):
|
|
self.page = page
|
|
self.totale_lines = totale_lines
|
|
self.lines_per_page = lines_per_page
|
|
|
|
def render(self):
|
|
count = len(self.totale_lines) // self.lines_per_page
|
|
padding = 20
|
|
screen_height = const(220)
|
|
cursor = 8
|
|
|
|
if count * padding > screen_height:
|
|
padding = screen_height // count
|
|
|
|
x = 220
|
|
y = (10 + (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)
|
|
|
|
def wait(self):
|
|
while True:
|
|
self.render()
|
|
|