From 2c3dfc75bf42d1c4a7fa616ffcee2ae793e79f7c Mon Sep 17 00:00:00 2001 From: Wolfgang Fahl Date: Wed, 19 Oct 2022 13:10:52 +0200 Subject: [PATCH] fixes #567 regression and prepares release --- examples/demo_browser.py | 16 +++++++++++++--- jpcore/demostarter.py | 2 +- justpy/__init__.py | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/examples/demo_browser.py b/examples/demo_browser.py index 86bf4e60..f5d151d6 100644 --- a/examples/demo_browser.py +++ b/examples/demo_browser.py @@ -223,12 +223,15 @@ class DemoBrowser(BaseWebPage): """ Browser for demos """ - def __init__(self): + def __init__(self,base_path:str=None): """ constructor + + Args: + base_path(str): the path to search examples in """ BaseWebPage.__init__(self) - self.demo_starter=Demostarter() + self.demo_starter=Demostarter(base_path=base_path) self.tutorial_manager=TutorialManager() jp.app.add_jproute("/demo/{demo_name}",self.show_demo) self.mounted={} @@ -434,10 +437,17 @@ def main(argv=None): # IGNORE:C0111 parser.add_argument( "-d", "--debug", dest="debug", action="store_true", help="show debug info" ) + script_dir = os.path.dirname(__file__) + parser.add_argument( + "-p", + "--path", + default=os.path.dirname(script_dir), + help="path to the examples (default: %(default)s)", + ) parser.add_argument("--host", default=socket.getfqdn()) parser.add_argument("--port", type=int, default=8000) args = parser.parse_args(argv[1:]) - demo_browser=DemoBrowser() + demo_browser=DemoBrowser(base_path=args.path) jp.justpy(demo_browser.web_page,host=args.host, port=args.port,PLOTLY=True,KATEX=True,VEGA=True) except Exception as e: indent = len(program_name) * " " diff --git a/jpcore/demostarter.py b/jpcore/demostarter.py index aa7bd370..d5a1d9f1 100644 --- a/jpcore/demostarter.py +++ b/jpcore/demostarter.py @@ -181,7 +181,7 @@ def main(argv=None): # IGNORE:C0111 ) args = parser.parse_args(argv[1:]) - demostarter = Demostarter(mode=args.mode, debug=args.debug) + demostarter = Demostarter(base_path=args.path,mode=args.mode, debug=args.debug) if args.debug: for demo in demostarter.demos: print(demo) diff --git a/justpy/__init__.py b/justpy/__init__.py index 2af91c44..f9eb09d4 100644 --- a/justpy/__init__.py +++ b/justpy/__init__.py @@ -1,4 +1,4 @@ """JustPy is an object-oriented, component based, high-level Python Web Framework that requires no front-end programming""" from .justpy import * -__version__ = "0.9.6" +__version__ = "0.9.7"