Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/examples/google_photos/google_photos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
20 changes: 14 additions & 6 deletions scripts/gallery_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading