From 96dff55d6fabede19f91708349f351626ae25119 Mon Sep 17 00:00:00 2001 From: Brad Barnett <127794626+bdbarnett@users.noreply.github.com> Date: Wed, 23 Sep 2026 16:50:56 -0500 Subject: [PATCH] google_photos: hold the -m launch with the timer's own sleep, so Windows keeps the window alive gallery_generator: find the sibling pydevices/tools from a git worktree too --- lib/examples/google_photos/google_photos.py | 10 +++++++--- scripts/gallery_generator.py | 20 ++++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lib/examples/google_photos/google_photos.py b/lib/examples/google_photos/google_photos.py index ae93630b..f4355f03 100644 --- a/lib/examples/google_photos/google_photos.py +++ b/lib/examples/google_photos/google_photos.py @@ -123,11 +123,15 @@ def _block_if_batch(): app.run() # "none": blocking service loop (async timers: asyncio.run) return # "ambient" was chosen at import time; the timer already drives the app, - # so just hold the main thread until the window closes. - import time + # so just hold the main thread until the window closes. Hold it with the + # timer backend's own sleep, never time.sleep: on Windows the timer fires + # only while this thread is in an alertable wait (SleepEx), and a plain + # time.sleep starves it -- the window then never repaints and Windows + # marks it "Not Responding". + from multimer import auto as timer while not app.quit_requested: - time.sleep(0.05) + timer.sleep_ms(50) main() diff --git a/scripts/gallery_generator.py b/scripts/gallery_generator.py index 81144e7e..7428003b 100755 --- a/scripts/gallery_generator.py +++ b/scripts/gallery_generator.py @@ -62,14 +62,22 @@ from personal_examples import PERSONAL_EXAMPLE_DIRS # noqa: E402 REPO_ROOT = Path(__file__).resolve().parent.parent +# The sibling pydevices checkout's tools/. Walk up rather than look one level +# up only: from a git worktree under .worktrees/ the sibling is further away. _browser_tools = next( - path - for path in ( - REPO_ROOT.parent / "pydevices" / "tools", - REPO_ROOT / "pydevices" / "tools", - ) - if (path / "_browser_url.py").is_file() + ( + path + for path in [REPO_ROOT / "pydevices" / "tools"] + + [parent / "pydevices" / "tools" for parent in REPO_ROOT.parents] + if (path / "_browser_url.py").is_file() + ), + None, ) +if _browser_tools is None: + raise SystemExit( + "gallery_generator: no pydevices/tools/_browser_url.py beside this " + "checkout or above it; clone PyDevices/pydevices as a sibling" + ) sys.path.insert(0, str(_browser_tools)) from _browser_url import query as browser_query # noqa: E402