File tree Expand file tree Collapse file tree 4 files changed +27
-4
lines changed
Expand file tree Collapse file tree 4 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,9 @@ def get_package_web_dir():
1313 return web_root_dir or str (Path (__file__ ).parent .joinpath ("web" ))
1414
1515
16- __all__ = ["patch_font_manifest_json" , "patch_index_html" , "patch_manifest_json" ]
16+ __all__ = [
17+ "patch_font_manifest_json" ,
18+ "patch_index_html" ,
19+ "patch_manifest_json" ,
20+ "get_package_web_dir" ,
21+ ]
Original file line number Diff line number Diff line change 11[project ]
22name = " examples-gallery"
33version = " 0.1.0"
4- description = " "
4+ description = " Live demo of Flet examples. "
55readme = " README.md"
66requires-python = " >=3.10"
77authors = [
Original file line number Diff line number Diff line change @@ -158,15 +158,33 @@ def iframe(
158158
159159 @env .macro
160160 def demo (
161- route : str ,
161+ route_or_path : str ,
162162 * ,
163163 width : str = "100%" ,
164164 height : str = "350" ,
165165 title : Optional [str ] = None ,
166166 ):
167167 """
168168 Embed an examples gallery route as a centered demo iframe.
169+
170+ `route_or_path` may be:
171+ - a gallery route, e.g. "slider/basic"
172+ - or a file path like "../../examples/controls/slider/basic.py"
169173 """
174+ route = route_or_path
175+
176+ # Strip known prefixes
177+ for prefix in ("../../examples/controls/" ,):
178+ if route .startswith (prefix ):
179+ route = route .removeprefix (prefix )
180+ break
181+
182+ # Strip known suffixes
183+ for suffix in (".py" , "/" ):
184+ if route .endswith (suffix ):
185+ route = route .removesuffix (suffix )
186+ break
187+
170188 return render_iframe (
171189 route = route ,
172190 base = "/apps/examples-gallery/dist/index.html#/" ,
Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ plugins:
163163 target_url_path : test-images
164164 include_exts : [".png", ".gif", ".svg"]
165165 - examples_gallery :
166- src : apps/examples-gallery/src/main.py
166+ src : apps/examples-gallery/src
167167 dist : apps/examples-gallery/dist
168168 base_url : apps/examples-gallery/dist
169169
You can’t perform that action at this time.
0 commit comments