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 for #3623 #3632

Merged
merged 1 commit into from Oct 12, 2014
Merged

Fix for #3623 #3632

merged 1 commit into from Oct 12, 2014

Conversation

jenshnielsen
Copy link
Member

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

@tacaswell tacaswell added this to the v1.4.1 milestone Oct 10, 2014
else:
QT_RC_MAJOR_VERSION = 4

try:
Copy link
Member

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.

@jenshnielsen
Copy link
Member Author

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:
Copy link
Member

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.

Copy link
Member Author

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.

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.

None yet

3 participants