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 for #3623 #3632
Fix for #3623 #3632
Conversation
else: | ||
QT_RC_MAJOR_VERSION = 4 | ||
|
||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs an 'if not None' check.
Ok, rewrote this to make the logic a bit simpler. |
# No ETS environment, so use rcParams. | ||
('Unrecognized environment variable %r, valid values are:' | ||
' %r, %r or %r' % (QT_API_ENV, 'pyqt', 'pyside', 'pyqt5'))) | ||
if QT_ENV_MAJOR_VERSION == QT_RC_MAJOR_VERSION: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the rcparam take precedence over the ENV (if I am reading this correctly). My understanding of the convention is that the ENV should take precedence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only if the env param tries to use a different backend from the one the user has selected.
Currently if the ENV is 'pyqt' (i.e. a qt4 backend) but the user has done ```matplotlib.use('Qt5Agg') then you get PyQT4 imported into the matplotlib qt5 backend which makes no sense and is just wrong. This means that if you have that variable defined (as I have to control what backend mayavi uses pyside or pyqt4 ) I can't run the qt5 backend but get a broken mixture of the matplotlib qt5 code and the pyqt4.
It makes no sense to use the env variable to determine what major Qt version should be imported since that is selected by the choice of backend.
BUG : Fix handling QT_API ENVS
Make sure that the imported qt backend is consistent with selected backend. Otherwise the combination of the ETS env variable and a selected backend can result in matplotlib importing PyQt4 and using it inside the qt5 backend and vice versa resulting in bugs such as #3623