Skip to content

Commit 090e9f1

Browse files
authored
Merge pull request #10282 from anntzer/deprecate-backend-qt45
API: Deprecate the backend.qt{4,5} rcParams.
2 parents da3e628 + 188a4af commit 090e9f1

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

lib/matplotlib/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,8 +1116,10 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11161116
return config_from_file
11171117

11181118
iter_params = six.iteritems(defaultParams)
1119-
config = RcParams([(key, default) for key, (default, _) in iter_params
1120-
if key not in _all_deprecated])
1119+
with warnings.catch_warnings():
1120+
warnings.simplefilter("ignore", mplDeprecation)
1121+
config = RcParams([(key, default) for key, (default, _) in iter_params
1122+
if key not in _all_deprecated])
11211123
config.update(config_from_file)
11221124

11231125
if config['datapath'] is None:
@@ -1155,9 +1157,11 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11551157

11561158
rcParamsOrig = rcParams.copy()
11571159

1158-
rcParamsDefault = RcParams([(key, default) for key, (default, converter) in
1159-
six.iteritems(defaultParams)
1160-
if key not in _all_deprecated])
1160+
with warnings.catch_warnings():
1161+
warnings.simplefilter("ignore", mplDeprecation)
1162+
rcParamsDefault = RcParams([(key, default) for key, (default, converter) in
1163+
six.iteritems(defaultParams)
1164+
if key not in _all_deprecated])
11611165

11621166
rcParams['ps.usedistiller'] = checkdep_ps_distiller(
11631167
rcParams['ps.usedistiller'])

lib/matplotlib/rcsetup.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,20 @@ def validate_backend(s):
266266
return _validate_standard_backends(s)
267267

268268

269-
validate_qt4 = ValidateInStrings('backend.qt4', ['PyQt4', 'PySide', 'PyQt4v2'])
270-
validate_qt5 = ValidateInStrings('backend.qt5', ['PyQt5', 'PySide2'])
269+
@deprecated("2.2",
270+
"The backend.qt4 rcParam was deprecated in version 2.2. In order "
271+
"to force the use of a specific Qt4 binding, either import that "
272+
"binding first, or set the QT_API environment variable.")
273+
def validate_qt4(s):
274+
return ValidateInStrings("backend.qt4", ['PyQt4', 'PySide', 'PyQt4v2'])(s)
275+
276+
277+
@deprecated("2.2",
278+
"The backend.qt5 rcParam was deprecated in version 2.2. In order "
279+
"to force the use of a specific Qt5 binding, either import that "
280+
"binding first, or set the QT_API environment variable.")
281+
def validate_qt5(s):
282+
return ValidateInStrings("backend.qt5", ['PyQt5', 'PySide2'])(s)
271283

272284

273285
def validate_toolbar(s):

0 commit comments

Comments
 (0)
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