From 64d5f18ed690899d1c4f789d4b67fd8b1092a644 Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Tue, 30 Jan 2018 19:08:51 +0100 Subject: [PATCH] ui/text: simplify --- src/trezor/ui/text.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/trezor/ui/text.py b/src/trezor/ui/text.py index 688aca864..3d8338312 100644 --- a/src/trezor/ui/text.py +++ b/src/trezor/ui/text.py @@ -22,20 +22,11 @@ class Text(ui.Widget): bg = ui.BG ui.header(self.header_text, self.header_icon, ui.TITLE_GREY, ui.BG, self.icon_color) - def process(eitem): - nonlocal offset_y - nonlocal style - nonlocal fg - if isinstance(eitem, str): - ui.display.text(offset_x, offset_y, eitem, style, fg, bg) + for item in self.content: + if isinstance(item, str): + ui.display.text(offset_x, offset_y, item, style, fg, bg) offset_y += TEXT_LINE_HEIGHT - elif isinstance(eitem, (tuple, list, dict, set)): - for i in eitem: - process(i) - elif eitem == ui.MONO or eitem == ui.NORMAL or eitem == ui.BOLD: - style = eitem + elif item == ui.MONO or item == ui.NORMAL or item == ui.BOLD: + style = item else: - fg = eitem - - for item in self.content: - process(item) + fg = item