diff --git a/.gitignore b/.gitignore index a7479fe..6504721 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ WuttaPOS.egg-info/ +wuttapos/assets/custom_header_logo.png diff --git a/wuttapos/views/base.py b/wuttapos/views/base.py index 827970e..5536a26 100644 --- a/wuttapos/views/base.py +++ b/wuttapos/views/base.py @@ -24,6 +24,10 @@ WuttaPOS - flet views (base class) """ +import os + +from rattail.files import resource_path + import flet as ft from wuttapos.controls.header import WuttaHeader @@ -66,9 +70,17 @@ class WuttaView(ft.View): pass def make_logo_image(self, **kwargs): - logo = self.config.get('wuttapos', 'header.logo') - if not logo: + + # we have a default header logo, but prefer custom if present + custom = resource_path('wuttapos:assets/custom_header_logo.png') + if os.path.exists(custom): + logo = '/custom_header_logo.png' + else: logo = '/header_logo.png' + + # but config can override in any case + logo = self.config.get('wuttapos', 'header.logo', default=logo) + kwargs.setdefault('height', 100) return ft.Image(src=logo, **kwargs)