Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5a58d8d

Browse files
authored
Merge pull request #10351 from jklymak/fix-deprecate-qt45rcparams
FIX: deprecate qt4/5 rcparams
2 parents 482bde0 + 3cce6f8 commit 5a58d8d

3 files changed

Lines changed: 20 additions & 31 deletions

File tree

lib/matplotlib/rcsetup.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -267,27 +267,26 @@ def validate_backend(s):
267267

268268

269269
def validate_qt4(s):
270-
# Don't spam the test suite with warnings every time the rcparams are
271-
# reset. While it may seem better to use filterwarnings from within the
272-
# test suite, pytest 3.1+ explicitly disregards warnings filters (pytest
273-
# issue #2430).
274-
if not testing.is_called_from_pytest():
275-
cbook.warn_deprecated(
276-
"2.2",
277-
"The backend.qt4 rcParam was deprecated in version 2.2. In order "
278-
"to force the use of a specific Qt4 binding, either import that "
279-
"binding first, or set the QT_API environment variable.")
270+
if s is None:
271+
# return a reasonable default for deprecation period
272+
return 'PyQt4'
273+
cbook.warn_deprecated(
274+
"2.2",
275+
"The backend.qt4 rcParam was deprecated in version 2.2. In order "
276+
"to force the use of a specific Qt4 binding, either import that "
277+
"binding first, or set the QT_API environment variable.")
280278
return ValidateInStrings("backend.qt4", ['PyQt4', 'PySide', 'PyQt4v2'])(s)
281279

282280

283281
def validate_qt5(s):
284-
# See comment re: validate_qt4.
285-
if not testing.is_called_from_pytest():
286-
cbook.warn_deprecated(
287-
"2.2",
288-
"The backend.qt5 rcParam was deprecated in version 2.2. In order "
289-
"to force the use of a specific Qt5 binding, either import that "
290-
"binding first, or set the QT_API environment variable.")
282+
if s is None:
283+
# return a reasonable default for deprecation period
284+
return 'PyQt5'
285+
cbook.warn_deprecated(
286+
"2.2",
287+
"The backend.qt5 rcParam was deprecated in version 2.2. In order "
288+
"to force the use of a specific Qt5 binding, either import that "
289+
"binding first, or set the QT_API environment variable.")
291290
return ValidateInStrings("backend.qt5", ['PyQt5', 'PySide2'])(s)
292291

293292

@@ -958,8 +957,8 @@ def _validate_linestyle(ls):
958957
'backend': ['Agg', validate_backend], # agg is certainly
959958
# present
960959
'backend_fallback': [True, validate_bool], # agg is certainly present
961-
'backend.qt4': ['PyQt4', validate_qt4],
962-
'backend.qt5': ['PyQt5', validate_qt5],
960+
'backend.qt4': [None, validate_qt4],
961+
'backend.qt5': [None, validate_qt5],
963962
'webagg.port': [8988, validate_int],
964963
'webagg.address': ['127.0.0.1', validate_webagg_address],
965964
'webagg.open_in_browser': [True, validate_bool],

matplotlibrc.template

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@
4040
# non-interactive backend.
4141
backend : $TEMPLATE_BACKEND
4242

43-
# If you are using the Qt4Agg backend, you can choose here
44-
# to use the PyQt4 bindings or the newer PySide bindings to
45-
# the underlying Qt4 toolkit.
46-
#backend.qt4 : PyQt4 # PyQt4 | PySide
47-
4843
# Note that this can be overridden by the environment variable
4944
# QT_API used by Enthought Tool Suite (ETS); valid values are
5045
# "pyqt" and "pyside". The "pyqt" setting has the side effect of

tutorials/introductory/usage.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,8 @@ def my_plotter(ax, data1, data2, param_dict):
495495
# How do I select PyQt4 or PySide?
496496
# --------------------------------
497497
#
498-
# You can choose either PyQt4 or PySide when using the `qt4` backend by setting
499-
# the appropriate value for `backend.qt4` in your :file:`matplotlibrc` file. The
500-
# default value is `PyQt4`.
501-
#
502-
# The setting in your :file:`matplotlibrc` file can be overridden by setting the
503-
# `QT_API` environment variable to either `pyqt` or `pyside` to use `PyQt4` or
504-
# `PySide`, respectively.
498+
# The `QT_API` environment variable can be set to either `pyqt` or `pyside`
499+
# to use `PyQt4` or `PySide`, respectively.
505500
#
506501
# Since the default value for the bindings to be used is `PyQt4`,
507502
# :mod:`matplotlib` first tries to import it, if the import fails, it tries to

0 commit comments

Comments
 (0)