Skip to content

Commit

Permalink
fixed dpi_ratio error for newer matplotlib versions
Browse files Browse the repository at this point in the history
  • Loading branch information
rgerum committed Nov 25, 2021
1 parent 6c96d3e commit 23ecf67
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pylustrator/QComplexWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,11 @@ def icon(self, name: str):
""" get an icon with the given filename """
pm = QtGui.QPixmap(os.path.join(os.path.dirname(__file__), "icons", name))
if hasattr(pm, 'setDevicePixelRatio'):
pm.setDevicePixelRatio(self.canvas._dpi_ratio)
try: # older mpl < 3.5.0
pm.setDevicePixelRatio(self.canvas._dpi_ratio)
except AttributeError:
pm.setDevicePixelRatio(self.canvas.device_pixel_ratio)

return QtGui.QIcon(pm)

def setSelect(self):
Expand Down

0 comments on commit 23ecf67

Please sign in to comment.