diff --git a/wuttapos/app.py b/wuttapos/app.py index eae304b..f419f01 100644 --- a/wuttapos/app.py +++ b/wuttapos/app.py @@ -29,6 +29,7 @@ import os from rattail import app as base from rattail.config import make_config +from rattail.files import resource_path import flet as ft @@ -157,7 +158,7 @@ def main(page: ft.Page): # TODO: can we inject config to the main() via ft.app() kwargs somehow? # pretty sure the `wuttapos open` command is trying to anyway.. def run_app(config=None): - ft.app(target=main) + ft.app(target=main, assets_dir=resource_path('wuttapos:assets')) if __name__ == '__main__': diff --git a/wuttapos/assets/testing.png b/wuttapos/assets/testing.png new file mode 100644 index 0000000..7228b33 Binary files /dev/null and b/wuttapos/assets/testing.png differ diff --git a/wuttapos/commands.py b/wuttapos/commands.py index 8a1c88f..804e5fc 100644 --- a/wuttapos/commands.py +++ b/wuttapos/commands.py @@ -28,6 +28,7 @@ import logging import sys from rattail import commands +from rattail.files import resource_path from wuttapos import __version__ @@ -84,7 +85,8 @@ class Serve(commands.Subcommand): default=8332) log.info(f"will serve WuttaPOS on http://{host}:{port}") - ft.app(target=main, view=None, host=host, port=port) + ft.app(target=main, view=None, host=host, port=port, + assets_dir=resource_path('wuttapos:assets')) class Status(commands.Subcommand): diff --git a/wuttapos/views/base.py b/wuttapos/views/base.py index b90a050..766dd36 100644 --- a/wuttapos/views/base.py +++ b/wuttapos/views/base.py @@ -75,11 +75,9 @@ class WuttaViewContainer(ft.Container): def __init__(self, config, *args, **kwargs): self.config = config + # add testing watermark when not in production if 'image_src' not in kwargs and not self.config.production(): - # TODO: host a local testing image? where *should* this come from? - image = self.config.get('rattail', 'testing_watermark') - if image: - kwargs['image_src'] = image - kwargs.setdefault('image_repeat', ft.ImageRepeat.REPEAT) + kwargs['image_src'] = '/testing.png' + kwargs.setdefault('image_repeat', ft.ImageRepeat.REPEAT) super().__init__(*args, **kwargs)