Add testing watermark asset
This commit is contained in:
parent
44b3b437e3
commit
d8ff7dd944
|
@ -29,6 +29,7 @@ import os
|
||||||
|
|
||||||
from rattail import app as base
|
from rattail import app as base
|
||||||
from rattail.config import make_config
|
from rattail.config import make_config
|
||||||
|
from rattail.files import resource_path
|
||||||
|
|
||||||
import flet as ft
|
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?
|
# TODO: can we inject config to the main() via ft.app() kwargs somehow?
|
||||||
# pretty sure the `wuttapos open` command is trying to anyway..
|
# pretty sure the `wuttapos open` command is trying to anyway..
|
||||||
def run_app(config=None):
|
def run_app(config=None):
|
||||||
ft.app(target=main)
|
ft.app(target=main, assets_dir=resource_path('wuttapos:assets'))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
BIN
wuttapos/assets/testing.png
Normal file
BIN
wuttapos/assets/testing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
|
@ -28,6 +28,7 @@ import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from rattail import commands
|
from rattail import commands
|
||||||
|
from rattail.files import resource_path
|
||||||
|
|
||||||
from wuttapos import __version__
|
from wuttapos import __version__
|
||||||
|
|
||||||
|
@ -84,7 +85,8 @@ class Serve(commands.Subcommand):
|
||||||
default=8332)
|
default=8332)
|
||||||
|
|
||||||
log.info(f"will serve WuttaPOS on http://{host}:{port}")
|
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):
|
class Status(commands.Subcommand):
|
||||||
|
|
|
@ -75,11 +75,9 @@ class WuttaViewContainer(ft.Container):
|
||||||
def __init__(self, config, *args, **kwargs):
|
def __init__(self, config, *args, **kwargs):
|
||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
|
# add testing watermark when not in production
|
||||||
if 'image_src' not in kwargs and not self.config.production():
|
if 'image_src' not in kwargs and not self.config.production():
|
||||||
# TODO: host a local testing image? where *should* this come from?
|
kwargs['image_src'] = '/testing.png'
|
||||||
image = self.config.get('rattail', 'testing_watermark')
|
|
||||||
if image:
|
|
||||||
kwargs['image_src'] = image
|
|
||||||
kwargs.setdefault('image_repeat', ft.ImageRepeat.REPEAT)
|
kwargs.setdefault('image_repeat', ft.ImageRepeat.REPEAT)
|
||||||
|
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
Loading…
Reference in a new issue