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

Fix frame capture when using PyQt6 #43

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

dalthviz
Copy link
Member

@dalthviz dalthviz commented Dec 16, 2024

See #40 (comment), #42 (comment)

These failures were caused by an intervening frame in QtPy when using the Qt6 backend, because QtPy replaced some removed functions in the Qt5->Qt6 transition with their own implementations:

https://github.com/spyder-ide/qtpy/blob/1d2a1eae43bda2a3d0efef605cafc5462389ec03/qtpy/QtWidgets.py#L69-L105

Therefore, when looking for "first frame in the call stack that is not in napari", the frame capture code would stop in QtPy. By adding QtPy to the list of ignored prefixes, this PR fixes the issue in the Qt6 case.

@dalthviz dalthviz marked this pull request as ready for review December 16, 2024 16:22
@jni
Copy link
Member

jni commented Dec 17, 2024

@dalthviz following the references doesn't make it any clearer to me why this works. Do you have any intuition there?

@jni
Copy link
Member

jni commented Dec 17, 2024

(specifically: why does this help the Qt6 case but is unnecessary in Qt5-land?)

@Czaki
Copy link
Contributor

Czaki commented Dec 17, 2024

As I understand, it is connected with some backward compatibility code introduced by qtpy. Something like:

https://github.com/spyder-ide/qtpy/blob/1d2a1eae43bda2a3d0efef605cafc5462389ec03/qtpy/QtWidgets.py#L69-L105

@dalthviz
Copy link
Member Author

As I understand, it is connected with some backward compatibility code introduced by qtpy.

Exactly! 👍

@psobolewskiPhD
Copy link
Member

I can confirm this fixes my issue with pyqt6.

@jni
Copy link
Member

jni commented Dec 20, 2024

Brilliant. Thanks both! I've copied the explanation over to the PR description!

@jni jni merged commit fe3dcf0 into napari:main Dec 20, 2024
7 checks passed
@jni jni added the bugfix label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants