1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

extract common bootloader stuff into bl_common.py

This commit is contained in:
Pavol Rusnak 2016-10-05 21:09:45 +02:00
parent e405a6305d
commit 7dc53219d2
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
12 changed files with 25 additions and 44 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,10 @@
from trezor import ui, res
BL_HEADER_FG = ui.BLACK
BL_HEADER_BG = ui.ORANGE
def bl_header(title):
ui.display.bar(0, 0, 240, 32, BL_HEADER_BG)
image = res.load('./res/bootloader.toig')
ui.display.icon(8, 4, image, BL_HEADER_FG, BL_HEADER_BG)
ui.display.text(8 + 24 + 8, 23, title, ui.BOLD, BL_HEADER_FG, BL_HEADER_BG)

View File

@ -4,6 +4,7 @@ sys.path.append('../../src')
from trezor import ui, res
from trezor.ui import button
from bl_common import bl_header
CANCEL_BUTTON = {
'bg-color': ui.RED,
@ -25,12 +26,7 @@ ui.display.bar(0, 10, 240, 240 - 50, ui.LIGHT_RED)
ui.display.bar(3, 3, 234, 240 - 54, ui.BLACK)
# header
ui.display.bar(0, 0, 240, 32, ui.ORANGE)
image = res.load('./res/bootloader.toig')
ui.display.icon(8, 4, image, ui.ORANGE, ui.WHITE)
ui.display.text(35, 23, 'Unsigned firmware!', ui.BOLD, ui.WHITE, ui.ORANGE)
bl_header('Unsigned firmware!')
# content
ui.display.text(10, 60, 'Check your fingeprint', ui.NORMAL, ui.WHITE, ui.BLACK)

View File

@ -4,6 +4,7 @@ sys.path.append('../../src')
from trezor import ui, res
from trezor.ui import button
from bl_common import bl_header
DEFAULT_BUTTON = {
'bg-color': ui.DARK_GREY,
@ -26,12 +27,7 @@ ui.display.bar(0, 10, 240, 240 - 50, ui.LIGHT_RED)
ui.display.bar(3, 3, 234, 240 - 54, ui.BLACK)
# header
ui.display.bar(0, 0, 240, 32, ui.ORANGE)
image = res.load('./res/bootloader.toig')
ui.display.icon(8, 4, image, ui.ORANGE, ui.WHITE)
ui.display.text(35, 23, 'Install failed', ui.BOLD, ui.WHITE, ui.ORANGE)
bl_header('Install failed')
# content
ui.display.text(10, 53, 'Some error happend', ui.NORMAL, ui.WHITE, ui.BLACK)

View File

@ -4,6 +4,7 @@ sys.path.append('../../src')
from trezor import ui, res
from trezor.ui import button
from bl_common import bl_header
CONFIRM_BUTTON = {
'bg-color': ui.GREEN,
@ -34,12 +35,7 @@ ui.display.clear()
ui.display.backlight(255)
# header
ui.display.bar(0, 0, 240, 32, ui.ORANGE)
image = res.load('./res/bootloader.toig')
ui.display.icon(8, 4, image, ui.ORANGE, ui.WHITE)
ui.display.text(35, 23, 'Install new firmware', ui.BOLD, ui.WHITE, ui.ORANGE)
bl_header('Install new firmware')
# content
ui.display.text(10, 53, 'Monero v.1.1', ui.NORMAL, ui.WHITE, ui.BLACK)

View File

@ -4,6 +4,7 @@ sys.path.append('../../src')
from trezor import ui, res
from trezor.ui import button
from bl_common import bl_header
CONFIRM_BUTTON = {
'bg-color': ui.BLUE,
@ -22,12 +23,7 @@ ui.display.clear()
ui.display.backlight(255)
# header
ui.display.bar(0, 0, 240, 32, ui.ORANGE)
image = res.load('./res/bootloader.toig')
ui.display.icon(8, 4, image, ui.ORANGE, ui.WHITE)
ui.display.text(35, 23, 'Install new firmware', ui.BOLD, ui.WHITE, ui.ORANGE)
bl_header('Install new firmware')
# content
ui.display.text(10, 53, 'Warning!', ui.BOLD, ui.WHITE, ui.BLACK)

View File

@ -4,6 +4,7 @@ sys.path.append('../../src')
from trezor import ui, res
from trezor.ui import button
from bl_common import bl_header
DEFAULT_BUTTON = {
'bg-color': ui.DARK_GREY,
@ -22,12 +23,7 @@ ui.display.clear()
ui.display.backlight(255)
# header
ui.display.bar(0, 0, 240, 32, ui.ORANGE)
image = res.load('./res/bootloader.toig')
ui.display.icon(8, 4, image, ui.ORANGE, ui.WHITE)
ui.display.text(35, 23, 'Install done', ui.BOLD, ui.WHITE, ui.ORANGE)
bl_header('Install done')
# content
# content

View File

@ -3,17 +3,13 @@ import sys
sys.path.append('../../src')
from trezor import ui, res
from bl_common import bl_header
ui.display.clear()
ui.display.backlight(255)
# header
ui.display.bar(0, 0, 240, 32, ui.ORANGE)
image = res.load('./res/bootloader.toig')
ui.display.icon(8, 4, image, ui.ORANGE, ui.WHITE)
ui.display.text(35, 23, 'Installing firmware', ui.BOLD, ui.WHITE, ui.ORANGE)
bl_header('Installing firmware')
ui.display.text_center(120, 192 + 32, "In progress ...", 1, ui.WHITE, ui.BLACK)

View File

@ -4,6 +4,7 @@ sys.path.append('../../src')
from trezor import ui, res
from trezor.ui import button
from bl_common import bl_header
CONFIRM_BUTTON = {
'bg-color': ui.GREEN,
@ -38,12 +39,7 @@ ui.display.bar(0, 10, 240, 240 - 58, ui.LIGHT_RED)
ui.display.bar(3, 3, 234, 240 - 54, ui.BLACK)
# header
ui.display.bar(0, 0, 240, 32, ui.ORANGE)
image = res.load('./res/bootloader.toig')
ui.display.icon(8, 4, image, ui.ORANGE, ui.WHITE)
ui.display.text(35, 23, 'Install new firmware', ui.BOLD, ui.WHITE, ui.ORANGE)
bl_header('Install new firmware')
# content
ui.display.text(10, 60, 'Unsigned firmware!', ui.NORMAL, ui.WHITE, ui.BLACK)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -11,7 +11,6 @@ display = Display()
def rgbcolor(r: int, g: int, b: int) -> int:
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3)
LIGHT_RED = rgbcolor(0xFF, 0x00, 0x00)
RED = rgbcolor(0x66, 0x00, 0x00)
PINK = rgbcolor(0xE9, 0x1E, 0x63)
@ -40,7 +39,7 @@ WHITE = rgbcolor(0xFA, 0xFA, 0xFA)
# password manager palette
PM_DARK_BLUE = rgbcolor(0x1A, 0x29, 0x42)
PM_BLUE = rgbcolor(0x34, 0x98, 0xdb)
PM_BLUE = rgbcolor(0x34, 0x98, 0xDB)
MONO = Display.FONT_MONO
NORMAL = Display.FONT_NORMAL