Skip to content

Respect QT_API even when the backend is not Qt{4,5}{Agg,Cairo}. #12091

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

Merged
merged 1 commit into from
Sep 12, 2018

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 11, 2018

  • When rcParams["backend"] was not QtXAgg, we previously ignored QT_API.
    Don't do so anymore. (example: mplcairo.qt...)
  • Also add the QtCairo backends to the checks.

Note: before #9993, we would follow QT_API in the non-qt-backend case only if it specified a qt5 binding (PyQt5 or PySide2) -- per the default value of QT_RC_MAJOR_VERSION (so #9993 is a partial regression, also in 2.2.3).

I don't think this is critical to hold up 3.0 (as no one seems to have noticed this in 2.2.3 :)), but should be backported to 2.2.4.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

- When rcParams["backend"] was not QtXAgg, we previously ignored QT_API.
  Don't do so anymore.  (example: mplcairo.qt...)
- Also add the QtCairo backends to the checks.
@@ -41,13 +46,13 @@
# Otherwise, check the QT_API environment variable (from Enthought). This can
# only override the binding, not the backend (in other words, we check that the
# requested backend actually matches).
elif rcParams["backend"] == "Qt5Agg":
elif rcParams["backend"] in ["Qt5Agg", "Qt5Cairo"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would .startswith("Qt5") be better here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't really help with mplcairo... and I think we can revisit this if a third rendering backend ever show up :)
(In a sense the whole Qt4/5 setup is a bit weird, basically what we really have is just a Qt{Agg,Cair} backend and the 4/5 part just sets the default for QT_API.)
Anyways I don't feel strongly either way.

@tacaswell tacaswell added this to the v2.2.4 milestone Sep 12, 2018
@tacaswell tacaswell merged commit d281b94 into matplotlib:master Sep 12, 2018
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 12, 2018
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 12, 2018
@anntzer anntzer deleted the qt_compat branch September 12, 2018 02:18
@Carreau
Copy link
Contributor

Carreau commented Sep 12, 2018

I've updated the backport code to no erase the local repository and re-clone every time a backport is done, so backport should regularly be much faster (seconds instead os minutes for matplotlib). This PR was the first to use the new backport code, and apparently went great. Let me know if there is any issues.

jklymak added a commit that referenced this pull request Sep 12, 2018
…091-on-v3.0.x

Backport PR #12091 on branch v3.0.x (Respect QT_API even when the backend is not Qt{4,5}{Agg,Cairo}.)
jklymak added a commit that referenced this pull request Sep 12, 2018
…091-on-v2.2.x

Backport PR #12091 on branch v2.2.x (Respect QT_API even when the backend is not Qt{4,5}{Agg,Cairo}.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants