-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
WIP,MNT: Add support for QtPy #10430
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
Conversation
|
As I explain in mne-tools/mne-gui-addons#14, the resource system needs some rework to allow Qt6 support. |
|
Although there is no https://doc.qt.io/qtforpython/tutorials/basictutorial/qrcfiles.html So I think we could migrate to |
|
Could we just load the PNGs/SVGs directly? |
|
@larsoner feel free to take a look at the code. This did the trick for me on
Definitely, but I think we need to be smart here because a relative path won't do. I chose Of course, the PR is not ready, I tried |
|
There are still many places in the project where DetailsPlus a |
|
As a first step let's make the only change CIs just to add Then the next PR can be to improve CIs by adding PySide2 / PySide 6 / PyQt6 runs -- this will require a bit of work and thinking as we probably only want to test things that use our new abstraction (Brain, iEEG GUI, etc.). The easiest way to do this is maybe by making a |
|
Also I think there is no hurry. I jumped on this because I am interested but I can wait for the release. |
|
Agreed we should merge this right after release. So actually if the qtpy abstraction is quick and some commit is green before release, it's okay to roll the CI changes into this PR, too. It will be obvious what CIs and infrastructure have been added to make it work I think. |
|
I guess I have to open this PR rather sooner than later 😅 Meanwhile, do you think it's worth patching in |
|
IIRC VTK 9.2 will already support PyQt6. I think it's supposed to come out in a month. So perhaps for now we should just omit the PyQt6 support / CI entry. An option in the interim would be to get an updated pyvista wheel with 9.2dev that supports PyQt6. But it doesn't seem worth it. So that covers PyQt6. Why isn't PySide2 working though? |
This is good to know, thank you for the info!
I will update the PR to disable PyQt6 testing then. I'll continue to investigate |
On second thought, let's just leave the PyQt6 CI entry in here. It at least tests matplotlib, and eventually will get mne-qt-browser, then finally VTK. And the skips work in the meantime. So I think all that is left to do is figure out PySide2... |
|
... I can't resist the temptation to try following https://docs.pyvista.org/extras/building_vtk.html#building-wheels in a 20.04 VM to see if I can make suitable wheels here. Will push in a little bit. Feel free to push any commits to fix PySide2 in the meantime... |
|
For This time,
|
If you're on linux, perhaps you have one in the system |
|
I investigated and it is caused by |
Can you open an upstream bug report with them? In the meantime, let's set this env var in just the PySide2 calls, then. (I can push a commit for this if you don't get what I mean.) And let's reenable PyQt6 -- sorry for the suggestion to disable earlier! Give me 1h to try to get a working VTK 9.2dev build to see if I can get PyQt6 fully working, but even if we don't, we can still test the non-3D stuff with that run... |
Sorry for the noise. Technically, The real problem is that it should not be possible to When I delete this directory manually, the issue is resolved because I can also guess that it works with At this point, I don't know if it's only me or this is something related to |
Does |
|
One moment, I will double-check because I modified the env too much 👍 |
|
... given that this can happen, though, it might still make sense to make a PR to |
|
The check of |
Argh, I missed that this was already |
I would also port this over to VTK and see what they say. In a worst case we have to remove it and just live with the |
|
... FYI here is a little diff I'm going to apply to VTK diff --git a/Wrapping/Python/vtkmodules/qt/__init__.py b/Wrapping/Python/vtkmodules/qt/__init__.py
index 2b5b2f73fb..cb7c27a308 100644
--- a/Wrapping/Python/vtkmodules/qt/__init__.py
+++ b/Wrapping/Python/vtkmodules/qt/__init__.py
@@ -19,16 +19,24 @@ For more information, see QVTKRenderWidgetConeExample() in the file
QVTKRenderWindowInteractor.py.
"""
+import importlib
import sys
# PyQtImpl can be set by the user
PyQtImpl = None
# Has an implementation has been imported yet?
-for impl in ["PySide6", "PyQt5", "PySide2", "PyQt4", "PySide"]:
+for impl in ["PySide6", "PyQt6", "PyQt5", "PySide2", "PyQt4", "PySide"]:
if impl in sys.modules:
- PyQtImpl = impl
- break
+ # Sometimes an attempted import can be crufty (e.g., unclean
+ # uninstalls of PyQt5), so let's try to import the actual functionality
+ try:
+ importlib.import_module(impl + '.QtCore')
+ except Exception:
+ pass
+ else:
+ PyQtImpl = impl
+ break
# QVTKRWIBase, base class for QVTKRenderWindowInteractor,
# can be altered by the user to "QGLWidget" or "QOpenGLWidget"It's probably going to take a couple of hours to actually build, then I'll upload the wheel to OSF, and we can try it here! |
Thank you for the help! I think the updated test is more robust indeed.
Sorry for the delay, I purged my |
|
@GuillaumeFavelier looks like the PyQt6 failure is real, can you look? Only one failure, though! |
|
At the moment, there are some timeouts for: I will try again later. |
|
Thanks @GuillaumeFavelier ! |
* upstream/main: (40 commits) FIX: Flake (mne-tools#10540) FIX: Correct link (mne-tools#10536) DOC: Update installers (mne-tools#10535) ENH: Add dark mode to website (mne-tools#10523) WIP: Copy BEM surfaces by default (don't symlink) (mne-tools#10531) Avoid lowpass=0 in brainvision data (mne-tools#10517) DOC: Update installers [skip azp] [skip actions] (mne-tools#10528) FIX: Fix for old build (mne-tools#10527) Fix line noise at wrong frequencies (mne-tools#10525) FIX : read fids in eeglab (mne-tools#10521) MAINT: Prefer PySide6 in testing (mne-tools#10513) ENH: Add overview_mode support (mne-tools#10501) MRG: Updates for qtpy in mne-qt-browser (mne-tools#10509) BUG: Fix bug with themes on macOS (mne-tools#10500) MAINT: Bump installer links (mne-tools#10511) Add metadata to combine_channels (mne-tools#10504) MAINT: Standardize tests (mne-tools#10502) CI: Test circle (mne-tools#10506) ENH: Use HiDPI splash screen on HiDPI screens (mne-tools#10503) WIP,MNT: Add support for QtPy (mne-tools#10430) ...
This PR adds support for
qtpywhich allows us to become Qt-agnostic. This can eventually make the transition to Qt6 easier.Related to mne-tools/mne-gui-addons#14