diff --git a/wuttapos/controls/header.py b/wuttapos/controls/header.py index 545fa34..d551dc6 100644 --- a/wuttapos/controls/header.py +++ b/wuttapos/controls/header.py @@ -2,7 +2,7 @@ ################################################################################ # # WuttaPOS -- Pythonic Point of Sale System -# Copyright © 2023 Lance Edgar +# Copyright © 2023-2024 Lance Edgar # # This file is part of WuttaPOS. # @@ -37,7 +37,7 @@ from .feedback import WuttaFeedback class WuttaHeader(WuttaControl): def __init__(self, *args, **kwargs): - self.term_display = kwargs.pop('term_display', '??') + self.terminal_id = kwargs.pop('terminal_id', None) super().__init__(*args, **kwargs) def build(self): @@ -51,6 +51,11 @@ class WuttaHeader(WuttaControl): self.logout_divider = ft.VerticalDivider(visible=False) self.title_button = ft.FilledButton(self.app.get_title(), on_click=self.title_click) + terminal_style = ft.TextStyle(size=20, weight=ft.FontWeight.BOLD) + if not self.terminal_id: + terminal_style.bgcolor = 'red' + terminal_style.color = 'white' + return ft.Stack( controls=[ ft.Container( @@ -81,7 +86,11 @@ class WuttaHeader(WuttaControl): ft.VerticalDivider(), self.logout_button, self.logout_divider, - ft.Text(f"Term: {self.term_display}", weight=ft.FontWeight.BOLD, size=20), + ft.Text( + spans=[ + ft.TextSpan(style=terminal_style, text=f"Term: {self.terminal_id or '??'}"), + ], + ), ft.VerticalDivider(), self.title_button, ], diff --git a/wuttapos/views/base.py b/wuttapos/views/base.py index b863c9b..d8a1f21 100644 --- a/wuttapos/views/base.py +++ b/wuttapos/views/base.py @@ -2,7 +2,7 @@ ################################################################################ # # WuttaPOS -- Pythonic Point of Sale System -# Copyright © 2023 Lance Edgar +# Copyright © 2023-2024 Lance Edgar # # This file is part of WuttaPOS. # @@ -60,7 +60,7 @@ class WuttaView(ft.View): def build_header(self): handler = self.get_batch_handler() self.header = WuttaHeader(self.config, on_reset=self.reset, - term_display=handler.get_terminal_id() or '??') + terminal_id=handler.get_terminal_id()) return self.header def get_batch_handler(self):