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

Skip to content

Commit 705a8dd

Browse files
committed
Remove fallback to nonexistent setDevicePixelRatioF.
setDevicePixelRatioF never existed.
1 parent 59bfcfa commit 705a8dd

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from . import qt_compat
1818
from .qt_compat import (
1919
QtCore, QtGui, QtWidgets, __version__, QT_API,
20-
_devicePixelRatioF, _isdeleted, _setDevicePixelRatioF,
20+
_devicePixelRatioF, _isdeleted, _setDevicePixelRatio,
2121
)
2222

2323
backend_version = __version__
@@ -707,7 +707,7 @@ def _icon(self, name):
707707
if QtCore.qVersion() >= '5.':
708708
name = name.replace('.png', '_large.png')
709709
pm = QtGui.QPixmap(str(cbook._get_data_path('images', name)))
710-
_setDevicePixelRatioF(pm, _devicePixelRatioF(self))
710+
_setDevicePixelRatio(pm, _devicePixelRatioF(self))
711711
if self.palette().color(self.backgroundRole()).value() < 128:
712712
icon_color = self.palette().color(self.foregroundRole())
713713
mask = pm.createMaskFromColor(QtGui.QColor('black'),

lib/matplotlib/backends/qt_compat.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,6 @@ def _setDevicePixelRatioF(obj, val):
212212
213213
This can be replaced by the direct call when we require Qt>=5.6.
214214
"""
215-
if hasattr(obj, 'setDevicePixelRatioF'):
216-
# Not available on Qt<5.6
217-
obj.setDevicePixelRatioF(val)
218-
elif hasattr(obj, 'setDevicePixelRatio'):
215+
if hasattr(obj, 'setDevicePixelRatio'):
219216
# Not available on Qt4 or some older Qt5.
220217
obj.setDevicePixelRatio(val)

0 commit comments

Comments
 (0)