Skip to content

Commit 79975bb

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

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

lib/matplotlib/backends/backend_qt5.py

+2-2
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

+3-6
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,12 @@ def _devicePixelRatioF(obj):
206206
return 1
207207

208208

209-
def _setDevicePixelRatioF(obj, val):
209+
def _setDevicePixelRatio(obj, val):
210210
"""
211-
Call obj.setDevicePixelRatioF(val) with graceful fallback for older Qt.
211+
Call obj.setDevicePixelRatio(val) with graceful fallback for older Qt.
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)