From d8ff7dd944a46a5efe040762d684018528393fa0 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 28 Sep 2023 12:59:08 -0500 Subject: [PATCH] Add testing watermark asset --- wuttapos/app.py | 3 ++- wuttapos/assets/testing.png | Bin 0 -> 10375 bytes wuttapos/commands.py | 4 +++- wuttapos/views/base.py | 8 +++----- 4 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 wuttapos/assets/testing.png 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 0000000000000000000000000000000000000000..7228b334edf2e11f718b6fd3bf550e18c1eb9563 GIT binary patch literal 10375 zcmb7IWmgY=X0D$<^U*FJE_k$0e zyN8>tgR>2tr=PnGosF-9Edb!Vbdqo2VGZ+Ec;UmqMtBB%4@;WF5)5p>X0BUJ2nOkf zu*tvY%g9*(3_1fV#9yw97oJefE3=P1KEDrWC~8`Pq(q2}hXf_v2;4pf_cWPFhhTaVGpesd8GRg^DwvyiAPExQ{30}I zeRd~JbG5g=dQ+Rm_cKH8^3j>%!}Loo${?cjo#|fJ%~(pYSdgOXm$JVD56{#Ky)XBj zX`N@KA-c~ona{pA)%rXy3+kPulV^I<#r*mqUC*OirH|e#Pg0dUZoL5>4aGheDT9Nz zI2UetkoAL3pRWPG7LFAg)nUQR*OEVPlK)nfT{l7lDPI!YFuwGNuP0?2N;nZl4&Pu% z%1`^g!x2w(|L)hs!5N*q6*u6Nn4r%+*r&+v53Ueotz?U#b_ow<)=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xf!yH=znXh>yfvJz%ATH{b=t08 z646&F0HlFTaG|`4*t}OE8KcD(s30FKRLEr-W~FR60jmxbA+s9Eo9+7x&n_w|vgIj> z3B`H+_f}|YLp%0bzZm{vj${ifUSw44@n4dojK=v~2xjdq zGz)UoK;q6M<31s?*C(> g{Lgox>VA}tT7FCq#mSC&^^E{33Yzkbau(tL0U;%!VgLXD literal 0 HcmV?d00001 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)