From 5a20a48745101e16336221f96c769ba50fcf9a6a Mon Sep 17 00:00:00 2001 From: chren Date: Thu, 6 Oct 2016 16:16:59 +0200 Subject: [PATCH] added ui header and icons --- assets/recovery.png | Bin 0 -> 1068 bytes assets/reset.png | Bin 0 -> 1235 bytes assets/wipe.png | Bin 0 -> 1167 bytes src/apps/management/layout_recovery_device.py | 3 +-- src/apps/management/layout_reset_device.py | 3 +-- src/apps/management/layout_wipe_device.py | 3 +-- src/trezor/res/recovery.toig | Bin 0 -> 95 bytes src/trezor/res/reset.toig | Bin 0 -> 189 bytes src/trezor/res/wipe.toig | Bin 0 -> 163 bytes src/trezor/ui/__init__.py | 11 ++++++++++- src/trezor/ui/text.py | 6 ++---- 11 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 assets/recovery.png create mode 100644 assets/reset.png create mode 100644 assets/wipe.png create mode 100644 src/trezor/res/recovery.toig create mode 100644 src/trezor/res/reset.toig create mode 100644 src/trezor/res/wipe.toig diff --git a/assets/recovery.png b/assets/recovery.png new file mode 100644 index 0000000000000000000000000000000000000000..dfa41cbc26e7b5e1807c267887b0f808c4b47c57 GIT binary patch literal 1068 zcmV+{1k?M8P)U8P*7-ZbZ>KLZ*U+lnSp_Ufq@}0xwybFAi#%#fq@|}KQEO56)-X|e7nZL z$iTqBa9P*U#mSX{G{Bl%P*lRez;J+pfx##xwK$o9f#C}S14DXwNkIt%17i#W1A|CX zc0maP17iUL1A|C*NRTrF17iyV0~1e4YDEbH0|SF|enDkXW_m`6f}y3QrGjHhep0GJ zaAk2xYHqQDXI^rCQ9*uDVo7QW0|Nup4h9AW240u^5(W3f%sd4n162kpgNVo|1qcff zJ_s=cNG>fZg9jx8g8+j9g8_pBLjXe}Lp{R+hNBE`7{wV~7)u#fFy3PlV+vxLz;uCG zm^qSpA@ds+OO_6nTdaDlt*rOhEZL^9ePa)2-_4=K(Z%tFGm-NGmm}8}ZcXk5JW@PU zd4+f<@d@)yL(o<5icqT158+-B6_LH7;i6x}CW#w~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_iiJvgN^h0dsuZZ2sQy$tsNSU!s;Q*;LF<6_B%M@UD?LHI zSNcZ`78uqV#TeU~$eS{ozBIdFzSClfs*^S+dw;4dus<{M;#|MXC)T}S9v!D zcV!QCPhBq)ZyO(X-(bH4|NMaZz==UigLj2o41F2S6d@OB6%`R(5i>J(Puzn9wnW{e zu;hl6HK{k#IWjCVGqdJqU(99Cv(K+6*i`tgSi2;vbXD1#3jNBGs$DgVwO(~o>mN4i zHPtkqZIx>)Y(Ls5-Br|mx>vQYvH$Kwn@O`L|D75??eGkZnfg$5<;Xeg_o%+-I&+-3%01W^SH2RkDT>t<8AY({UO#lFGm;eBCjsO7P zF8~04jQ{|B{r~{faR2}^>Hq*8F{N>7IRF3wHAzH4RCwBqkxwYYVI0OEi*{PW(pI+O zAeS9PIXE~-L`k~{J8^O1ObG zq!Y;a3}@ARf+MePZ>A-kHF8~%FN=%6Zv7o3EmlFe`qzFj_rcY x&xV@ncGwrY%H}`rcPE<~*Y4@`I`t3z4gg1Hv!<-oVg>*J002ovPDHLkV1n(|B^m$# literal 0 HcmV?d00001 diff --git a/assets/wipe.png b/assets/wipe.png new file mode 100644 index 0000000000000000000000000000000000000000..6a8909c272426e96dd26be69cdf52e1406039326 GIT binary patch literal 1167 zcmV;A1aSL_P)U8P*7-ZbZ>KLZ*U+lnSp_Ufq@}0xwybFAi#%#fq@|}KQEO56)-X|e7nZL z$iTqBa9P*U#mSX{G{Bl%P*lRez;J+pfx##xwK$o9f#C}S14DXwNkIt%17i#W1A|CX zc0maP17iUL1A|C*NRTrF17iyV0~1e4YDEbH0|SF|enDkXW_m`6f}y3QrGjHhep0GJ zaAk2xYHqQDXI^rCQ9*uDVo7QW0|Nup4h9AW240u^5(W3f%sd4n162kpgNVo|1qcff zJ_s=cNG>fZg9jx8g8+j9g8_pBLjXe}Lp{R+hNBE`7{wV~7)u#fFy3PlV+vxLz;uCG zm^qSpA@ds+OO_6nTdaDlt*rOhEZL^9ePa)2-_4=K(Z%tFGm-NGmm}8}ZcXk5JW@PU zd4+f<@d@)yL(o<5icqT158+-B6_LH7;i6x}CW#w~Uy-Pgl#@Irl`kzV zeL|*8R$ca%T%Wv){2zs_iiJvgN^h0dsuZZ2sQy$tsNSU!s;Q*;LF<6_B%M@UD?LHI zSNcZ`78uqV#TeU~$eS{ozBIdFzSClfs*^S+dw;4dus<{M;#|MXC)T}S9v!D zcV!QCPhBq)ZyO(X-(bH4|NMaZz==UigLj2o41F2S6d@OB6%`R(5i>J(Puzn9wnW{e zu;hl6HK{k#IWjCVGqdJqU(99Cv(K+6*i`tgSi2;vbXD1#3jNBGs$DgVwO(~o>mN4i zHPtkqZIx>)Y(Ls5-Br|mx>vQYvH$Kwn@O`L|D75??eGkZnfg$5<;Xeg_o%+-I&+-3%01W^SH2RkDT>t<8AY({UO#lFGm;eBCjsO7P zF8~04jQ{|B{r~{faR2}^>Hq*8F{N>7IRF3v@kvBMRCwBKk+DlcaTG?c1W6>Jsf&xG z;9`?YQ$rBWZh{~!610Y!DB>W3AiRba2cf2h7XJakO>_-f92}g)6d{p9PeYdXJ%8VJ z&spyMu87W=7~`@mvuIK_@&{;`cme1b`1J<(jO}sn5P;V`QQQB_*OO z_&60g9s?=;qAo1MBEcC<0{V~)kP}G*HCrVIZ5VnE-=KG5FU#MDmuDD+oV^EHD_B@Q h!w=(kw~^iSGXNx)t?yhZ39tYF002ovPDHLkV1f!W?ZW^7 literal 0 HcmV?d00001 diff --git a/src/apps/management/layout_recovery_device.py b/src/apps/management/layout_recovery_device.py index fcce713d95..accb36fa5b 100644 --- a/src/apps/management/layout_recovery_device.py +++ b/src/apps/management/layout_recovery_device.py @@ -16,8 +16,7 @@ async def layout_recovery_device(session_id, message): msg = 'Please enter ' + nth(message.word_count) + ' word' ui.display.clear() - ui.display.text(10, 30, 'Recovering device', - ui.BOLD, ui.LIGHT_GREEN, ui.BLACK) + ui.header('Recovering device', ui.ICON_RECOVERY, ui.BLACK, ui.LIGHT_GREEN) ui.display.text(10, 74, msg, ui.BOLD, ui.WHITE, ui.BLACK) ui.display.text(10, 104, 'of your mnemonic.', ui.BOLD, ui.WHITE, ui.BLACK) diff --git a/src/apps/management/layout_reset_device.py b/src/apps/management/layout_reset_device.py index 997c7026c6..754c7cba09 100644 --- a/src/apps/management/layout_reset_device.py +++ b/src/apps/management/layout_reset_device.py @@ -74,8 +74,7 @@ async def show_mnemonic_page(page, page_count, mnemonic): from trezor.ui.scroll import render_scrollbar, animate_swipe ui.display.clear() - ui.display.text( - 10, 34, 'Write down your seed', ui.BOLD, ui.LIGHT_GREEN, ui.BLACK) + ui.header('Write down your seed', ui.ICON_RESET, ui.BLACK, ui.LIGHT_GREEN) render_scrollbar(page, page_count) for pi, (wi, word) in enumerate(mnemonic[page]): diff --git a/src/apps/management/layout_wipe_device.py b/src/apps/management/layout_wipe_device.py index a78f41c4bf..ddb6ab8a81 100644 --- a/src/apps/management/layout_wipe_device.py +++ b/src/apps/management/layout_wipe_device.py @@ -10,9 +10,8 @@ async def layout_wipe_device(message, session_id): from ..common import storage ui.display.clear() - + ui.header('Wiping device', ui.ICON_WIPE, ui.BLACK, ui.LIGHT_GREEN) content = Text( - 'Wiping device', ui.BOLD, 'Do you really want to', 'wipe the device?', ui.NORMAL, '', 'All data will be lost.') await hold_to_confirm(session_id, content) diff --git a/src/trezor/res/recovery.toig b/src/trezor/res/recovery.toig new file mode 100644 index 0000000000000000000000000000000000000000..72f1c904f5df50416dc8c13f3988a063e3844556 GIT binary patch literal 95 zcmV-l0HFU=Pf2GO02lyM0001EU_b%v?|@(egw6RM2o^xt9JFLJ3JOYs*b4;(1=#+* zdk{|hk4|8D@Z<^Cry`2Po+ z29%$`5dR-!DdV1V|KFT|uz^DV|38ANVg3LApMw7X01dPB2h?0tI zzzS>-HpmERKp;T=v7Jl&8h^G<=R2iBj7m8t=I`W7a-VPK6-

f&gdGUymi-D1;SJpO{^N&El+ literal 0 HcmV?d00001 diff --git a/src/trezor/ui/__init__.py b/src/trezor/ui/__init__.py index 300957946a..589a77f74e 100644 --- a/src/trezor/ui/__init__.py +++ b/src/trezor/ui/__init__.py @@ -2,7 +2,7 @@ import math import utime from TrezorUi import Display -from trezor import loop +from trezor import loop, res display = Display() @@ -45,6 +45,10 @@ MONO = Display.FONT_MONO NORMAL = Display.FONT_NORMAL BOLD = Display.FONT_BOLD +# icons +ICON_RESET = 'trezor/res/reset.toig' +ICON_WIPE = 'trezor/res/wipe.toig' +ICON_RECOVERY = 'trezor/res/recovery.toig' def in_area(pos: tuple, area: tuple) -> bool: x, y = pos @@ -70,6 +74,11 @@ def animate_pulse(func, ca, cb, speed=200000, delay=30000): func(c) yield loop.Sleep(delay) +def header(title, icon=ICON_RESET, fg=BLACK, bg=PM_DARK_BLUE): + display.bar(0, 0, 240, 32, bg) + image = res.load(icon) + display.icon(8, 4, image, fg, bg) + display.text(8 + 24 + 8, 23, title, BOLD, fg, bg) def rotate_coords(pos: tuple) -> tuple: r = display.orientation() diff --git a/src/trezor/ui/text.py b/src/trezor/ui/text.py index 575beaa727..523c067da1 100644 --- a/src/trezor/ui/text.py +++ b/src/trezor/ui/text.py @@ -1,8 +1,8 @@ from micropython import const from trezor import ui -TEXT_HEADER_HEIGHT = const(44) -TEXT_LINE_HEIGHT = const(30) +TEXT_HEADER_HEIGHT = const(32) +TEXT_LINE_HEIGHT = const(23) TEXT_MARGIN_LEFT = const(10) @@ -14,8 +14,6 @@ class Text: def render(self): offset = TEXT_LINE_HEIGHT - ui.display.text(TEXT_MARGIN_LEFT, offset, - self.header, ui.BOLD, ui.LIGHT_GREEN, ui.BLACK) offset += TEXT_HEADER_HEIGHT style = ui.NORMAL for item in self.content: