Skip to content

Better support for interactive sessions#478

Merged
almarklein merged 6 commits intomainfrom
gui
Mar 22, 2024
Merged

Better support for interactive sessions#478
almarklein merged 6 commits intomainfrom
gui

Conversation

@almarklein
Copy link
Copy Markdown
Member

@almarklein almarklein commented Mar 21, 2024

This PR overhauls the GUI backend selection, making it clearer (I hope), improving support for various use-cases, and making it easier to add support for specific use-cases.

  • When on IPython, honor the selected %gui.
  • Prevent Qt backend from running the event loop if it's already made active by the env.
  • If multiple Qt libs are imported, check if any of them has an app object.
  • The above also makes that Qt is selected in $ ipython --gui qt.
  • Prefer glfw when we detect a running asyncio loop.
  • The above makes wgpu interactive in e.g. $ ptpython --asyncio and $ python -m asyncio.
  • Users can set WGPU_GUI_BACKEND to force a backend. Though WGPU_FORCE_OFFSCREEN still exists to overload during tests.
  • Docs on interactive use.
  • Can call run() multiple times (for both qt and glfw).
  • Fix that for the glfw backend, obtaining an asyncio event loop fails on e.g. ipython.

Comment thread wgpu/gui/auto.py Outdated
@almarklein almarklein marked this pull request as ready for review March 22, 2024 10:15
@almarklein almarklein requested a review from Korijn as a code owner March 22, 2024 10:15
@almarklein
Copy link
Copy Markdown
Member Author

almarklein commented Mar 22, 2024

Really happy with how this works now. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants