diff --git a/ports/stm32/boards/Passport/modules/views/card.py b/ports/stm32/boards/Passport/modules/views/card.py index c6a7bf3f4..de83d92d0 100644 --- a/ports/stm32/boards/Passport/modules/views/card.py +++ b/ports/stm32/boards/Passport/modules/views/card.py @@ -179,6 +179,8 @@ def set_header(self, self.update() def update(self): + from utils import derive_icon + # Always update the color and top padding top_pad = CARD_HEADER_HEIGHT if self.is_header_visible() else CARD_BORDER_WIDTH with LocalStyle(self.card_border) as style: @@ -199,7 +201,8 @@ def update(self): # default.bg_color(GREEN, 128) if self.icon is not None: - self.icon_view = Image(self.icon, color=self.header_fg_color) + icon = derive_icon(self.icon) + self.icon_view = Image(icon, color=self.header_fg_color) with Stylize(self.icon_view) as default: default.align(lv.ALIGN.LEFT_MID) self.header.add_child(self.icon_view) @@ -212,7 +215,8 @@ def update(self): self.header.add_child(header_title) if self.right_icon is not None: - self.right_icon_view = Image(self.right_icon, color=self.header_fg_color) + right_icon = derive_icon(self.right_icon) + self.right_icon_view = Image(right_icon, color=self.header_fg_color) with Stylize(self.right_icon_view) as default: default.align(lv.ALIGN.RIGHT_MID) self.header.add_child(self.right_icon_view) diff --git a/ports/stm32/boards/Passport/modules/views/icon.py b/ports/stm32/boards/Passport/modules/views/icon.py index da5e6f445..1b529726c 100644 --- a/ports/stm32/boards/Passport/modules/views/icon.py +++ b/ports/stm32/boards/Passport/modules/views/icon.py @@ -24,10 +24,9 @@ def __init__(self, icon, color=None, opa=None): default.opa(self.opa) def set_icon(self, icon): - if isinstance(icon, str): - self.icon = getattr(lv, icon) - else: - self.icon = icon + from utils import derive_icon + + self.icon = derive_icon(icon) self.update() def set_color(self, color=None, opa=None):