Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to GUI selection and Qt support #431

Merged
merged 9 commits into from
Mar 31, 2024

Conversation

almarklein
Copy link
Collaborator

@almarklein almarklein commented Mar 13, 2024

Closes #384

  • Adds a new fpl.utils/gui module where the GUI selection is handled and nothing else.
  • Fastplotlib lists its own GUI preference order, but respects users who override it.
  • Avoid importing multiple GUI libraries.
    • This makes fpl lighter.
    • In my experience importing multiple GUI frameworks can also result in odd bugs.
    • Remove all imports of wgpu.gui.auto except in fpl.utils.gui.
    • Users can still use a custom canvas and thus mix GUI toolkits if they want to go crazy :)
  • The fpl.run() method now matches the GUI backend in use (this was not necessarily the case previously).
  • Support for all modern Qt libraries!
  • The cases where ipywidgets is imported is now conditional (only happens in Jupyter notebook / lab).

Note on performance: The import time is about 0.2 s faster on desktop (because it does not import Jupyter stuff). In the notebook we can expect a similar improvement because glfw and qt are not imported by default (when available).

@almarklein
Copy link
Collaborator Author

Ready for review, but I figure you may want to have a code-review before letting CI run 😄

@almarklein almarklein mentioned this pull request Mar 13, 2024
fastplotlib/widgets/image.py Show resolved Hide resolved
fastplotlib/layouts/_frame/_frame.py Show resolved Hide resolved
fastplotlib/utils/gui.py Show resolved Hide resolved
@almarklein
Copy link
Collaborator Author

Funny how pygfx/pygfx#674 gets reported while we're working on this 😄 I think I'll put this PR on hold, and first address the GUI backend selection mechanics. I think your code to check what GUI Jupyter has integrated should be used in wgpu-py. And perhaps it makes sense to provide more ways to influence backend preference, that fpl can then use (in the new gui.py).

@kushalkolar
Copy link
Member

yup makes sense to do it upstream, less wheel reinventing 😄

@kushalkolar
Copy link
Member

After pygfx/wgpu-py#478 it should be possible to greatly simplify this

@almarklein
Copy link
Collaborator Author

I made some updates to make it work with the latest wgpu. Ready from my end!

@kushalkolar kushalkolar marked this pull request as ready for review March 29, 2024 19:15
@kushalkolar
Copy link
Member

This is really great, thanks! 🥳 . Will merge once wgpu v0.15.1 is on pypi and tests pass

@kushalkolar kushalkolar merged commit af23b58 into fastplotlib:main Mar 31, 2024
16 checks passed
@clewis7 clewis7 mentioned this pull request May 29, 2024
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.

Use qtpy so we can use PySide etc
3 participants