From 17112e8cc44357696c42758bdf3b274a59f3563c Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Tue, 30 Jan 2018 10:46:52 -0800 Subject: [PATCH 1/2] FIX: deprecate qt4/5 rcparams --- lib/matplotlib/rcsetup.py | 8 ++++++-- matplotlibrc.template | 5 ----- tutorials/introductory/usage.py | 9 ++------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 32e476cacc5a..1d6e883bde9f 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -271,6 +271,8 @@ def validate_qt4(s): # reset. While it may seem better to use filterwarnings from within the # test suite, pytest 3.1+ explicitly disregards warnings filters (pytest # issue #2430). + if s is None: + return 'PyQt4' if not testing.is_called_from_pytest(): cbook.warn_deprecated( "2.2", @@ -282,6 +284,8 @@ def validate_qt4(s): def validate_qt5(s): # See comment re: validate_qt4. + if s is None: + return 'PyQt5' if not testing.is_called_from_pytest(): cbook.warn_deprecated( "2.2", @@ -958,8 +962,8 @@ def _validate_linestyle(ls): 'backend': ['Agg', validate_backend], # agg is certainly # present 'backend_fallback': [True, validate_bool], # agg is certainly present - 'backend.qt4': ['PyQt4', validate_qt4], - 'backend.qt5': ['PyQt5', validate_qt5], + 'backend.qt4': [None, validate_qt4], + 'backend.qt5': [None, validate_qt5], 'webagg.port': [8988, validate_int], 'webagg.address': ['127.0.0.1', validate_webagg_address], 'webagg.open_in_browser': [True, validate_bool], diff --git a/matplotlibrc.template b/matplotlibrc.template index 7ac32f71cf8d..671a450080a1 100644 --- a/matplotlibrc.template +++ b/matplotlibrc.template @@ -40,11 +40,6 @@ # non-interactive backend. backend : $TEMPLATE_BACKEND -# If you are using the Qt4Agg backend, you can choose here -# to use the PyQt4 bindings or the newer PySide bindings to -# the underlying Qt4 toolkit. -#backend.qt4 : PyQt4 # PyQt4 | PySide - # Note that this can be overridden by the environment variable # QT_API used by Enthought Tool Suite (ETS); valid values are # "pyqt" and "pyside". The "pyqt" setting has the side effect of diff --git a/tutorials/introductory/usage.py b/tutorials/introductory/usage.py index 05cb65664712..185f38d29b65 100644 --- a/tutorials/introductory/usage.py +++ b/tutorials/introductory/usage.py @@ -495,13 +495,8 @@ def my_plotter(ax, data1, data2, param_dict): # How do I select PyQt4 or PySide? # -------------------------------- # -# You can choose either PyQt4 or PySide when using the `qt4` backend by setting -# the appropriate value for `backend.qt4` in your :file:`matplotlibrc` file. The -# default value is `PyQt4`. -# -# The setting in your :file:`matplotlibrc` file can be overridden by setting the -# `QT_API` environment variable to either `pyqt` or `pyside` to use `PyQt4` or -# `PySide`, respectively. +# The `QT_API` environment variable can be set to either `pyqt` or `pyside` +# to use `PyQt4` or `PySide`, respectively. # # Since the default value for the bindings to be used is `PyQt4`, # :mod:`matplotlib` first tries to import it, if the import fails, it tries to From 3cce6f8f96cf60481ce3f5a1efe911cadd83f9c2 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Tue, 30 Jan 2018 14:23:45 -0800 Subject: [PATCH 2/2] FIX: deprecate qt4/5 rcparams --- lib/matplotlib/rcsetup.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 1d6e883bde9f..f7deba2db322 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -267,31 +267,26 @@ def validate_backend(s): def validate_qt4(s): - # Don't spam the test suite with warnings every time the rcparams are - # reset. While it may seem better to use filterwarnings from within the - # test suite, pytest 3.1+ explicitly disregards warnings filters (pytest - # issue #2430). if s is None: + # return a reasonable default for deprecation period return 'PyQt4' - if not testing.is_called_from_pytest(): - cbook.warn_deprecated( - "2.2", - "The backend.qt4 rcParam was deprecated in version 2.2. In order " - "to force the use of a specific Qt4 binding, either import that " - "binding first, or set the QT_API environment variable.") + cbook.warn_deprecated( + "2.2", + "The backend.qt4 rcParam was deprecated in version 2.2. In order " + "to force the use of a specific Qt4 binding, either import that " + "binding first, or set the QT_API environment variable.") return ValidateInStrings("backend.qt4", ['PyQt4', 'PySide', 'PyQt4v2'])(s) def validate_qt5(s): - # See comment re: validate_qt4. if s is None: + # return a reasonable default for deprecation period return 'PyQt5' - if not testing.is_called_from_pytest(): - cbook.warn_deprecated( - "2.2", - "The backend.qt5 rcParam was deprecated in version 2.2. In order " - "to force the use of a specific Qt5 binding, either import that " - "binding first, or set the QT_API environment variable.") + cbook.warn_deprecated( + "2.2", + "The backend.qt5 rcParam was deprecated in version 2.2. In order " + "to force the use of a specific Qt5 binding, either import that " + "binding first, or set the QT_API environment variable.") return ValidateInStrings("backend.qt5", ['PyQt5', 'PySide2'])(s) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy