1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-12 18:49:07 +00:00

visual changes in pin matrix

This commit is contained in:
chren 2016-06-06 16:56:43 +02:00 committed by Pavol Rusnak
parent 1e76061d70
commit bbfd633f35
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 22 additions and 7 deletions

View File

@ -7,7 +7,7 @@ DEFAULT_BUTTON = {
'bg-color': ui.BLACK,
'fg-color': ui.WHITE,
'text-style': ui.NORMAL,
'border-color': ui.blend(ui.BLACK, ui.WHITE, 0.1),
'border-color': ui.BLACK,
}
DEFAULT_BUTTON_ACTIVE = {
'bg-color': ui.GREY,
@ -20,7 +20,7 @@ CANCEL_BUTTON = {
'bg-color': ui.blend(ui.BLACK, ui.RED, 0.3),
'fg-color': ui.RED,
'text-style': ui.NORMAL,
'border-color': ui.blend(ui.BLACK, ui.RED, 0.6),
'border-color': ui.blend(ui.BLACK, ui.RED, 0.3),
}
CANCEL_BUTTON_ACTIVE = {
'bg-color': ui.RED,
@ -33,7 +33,7 @@ CONFIRM_BUTTON = {
'bg-color': ui.blend(ui.BLACK, ui.GREEN, 0.3),
'fg-color': ui.GREEN,
'text-style': ui.NORMAL,
'border-color': ui.blend(ui.BLACK, ui.GREEN, 0.6),
'border-color': ui.blend(ui.BLACK, ui.GREEN, 0.3),
}
CONFIRM_BUTTON_ACTIVE = {
'bg-color': ui.GREEN,

View File

@ -12,10 +12,10 @@ class ConfirmDialog():
def __init__(self, content=None, confirm='Confirm', cancel='Cancel'):
self.content = content
self.confirm = Button((0, 240 - 60, 120, 60), confirm,
self.confirm = Button((0, 240 - 48, 119, 48), confirm,
normal_style=CONFIRM_BUTTON,
active_style=CONFIRM_BUTTON_ACTIVE)
self.cancel = Button((120, 240 - 60, 120, 60), cancel,
self.cancel = Button((121, 240 - 48, 119, 48), cancel,
normal_style=CANCEL_BUTTON,
active_style=CANCEL_BUTTON_ACTIVE)

View File

@ -1,3 +1,5 @@
from . import display
from trezor import ui
from trezor import loop
from trezor.crypto import random
from .button import Button, BTN_CLICKED
@ -7,10 +9,10 @@ from .button import CANCEL_BUTTON, CANCEL_BUTTON_ACTIVE
def digit_area(i):
width = const(80)
height = const(60)
height = const(48)
x = (i % 3) * width
y = (i // 3) * height
return (x, y, width, height)
return (x, y + 48, width, height) # 48px is offset of input line
def generate_digits():
@ -27,6 +29,19 @@ class PinMatrix():
for i, d in enumerate(generate_digits())]
def render(self):
# input line with placeholder (x, y, text, style, fg-c, bg-c)
display.text_center(120, 20, 'Enter PIN', ui.BOLD, ui.GREY, ui.BLACK)
# vertical border bars (x, y, w, h, c)
display.bar(79, 48, 2, 143, ui.blend(ui.BLACK, ui.WHITE, 0.25))
display.bar(158, 48, 2, 143, ui.blend(ui.BLACK, ui.WHITE, 0.25))
# horizontal border bars
display.bar(0, 95, 240, 2, ui.blend(ui.BLACK, ui.WHITE, 0.25))
display.bar(0, 142, 240, 2, ui.blend(ui.BLACK, ui.WHITE, 0.25))
# pin matrix buttons
for btn in self.buttons:
btn.render()