Add testing watermark asset

This commit is contained in:
Lance Edgar 2023-09-28 12:59:08 -05:00
parent 44b3b437e3
commit d8ff7dd944
4 changed files with 8 additions and 7 deletions

View file

@ -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__':

BIN
wuttapos/assets/testing.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -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):

View file

@ -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['image_src'] = '/testing.png'
kwargs.setdefault('image_repeat', ft.ImageRepeat.REPEAT)
super().__init__(*args, **kwargs)