Skip to content

Commit 0efd32d

Browse files
committed
Deprecate the backend.qt{4,5} rcParams.
1) For the rcParams rewrite (MEP32), they may make it tricky to transform rcParams into a nested dictionary type of object, as "backend" is already the name of another (more important) rcParam. This specific issue could be solved with deprecation + renaming, but also... 2) The use of these rcParams can easily be replaced by a) first importing one of the bindings (qt_compat will ensure that the already imported binding gets used, as importing multiple bindings in the same process is a bad idea anyways), or b) setting the QT_API environment variable appropriately.
1 parent af1197d commit 0efd32d

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

lib/matplotlib/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,11 +847,13 @@ def gen_candidates():
847847

848848
_obsolete_set = {'text.dvipnghack'}
849849

850+
_other_deprecated = {'backend.qt4', 'backend.qt5'}
851+
850852
# The following may use a value of None to suppress the warning.
851853
_deprecated_set = {'axes.hold'} # do NOT include in _all_deprecated
852854

853855
_all_deprecated = set(itertools.chain(
854-
_deprecated_ignore_map, _deprecated_map, _obsolete_set))
856+
_deprecated_ignore_map, _deprecated_map, _obsolete_set, _other_deprecated))
855857

856858

857859
class RcParams(MutableMapping, dict):

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 s in ['PyQt4', 'PySide', 'PyQt4v2']
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 s in ['PyQt5', 'PySide2']
271283

272284

273285
def validate_toolbar(s):

0 commit comments

Comments
 (0)