Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MNT: tweak the toolbar for Qt
Do not over-size the icons
  • Loading branch information
tacaswell committed Apr 17, 2017
commit 39b86d606bf4a09bf332f43d2cd11698f3426bc1
8 changes: 5 additions & 3 deletions lib/matplotlib/backends/backend_qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,9 @@ def __init__(self, canvas, parent, coordinates=True):
def _icon(self, name):
if is_pyqt5():
name = name.replace('.png', '_large.png')
return QtGui.QIcon(os.path.join(self.basedir, name))
pm = QtGui.QPixmap(os.path.join(self.basedir, name))
pm.setDevicePixelRatio(self.canvas._dpi_ratio)
return QtGui.QIcon(pm)

def _init_toolbar(self):
self.basedir = os.path.join(matplotlib.rcParams['datapath'], 'images')
Expand All @@ -592,7 +594,7 @@ def _init_toolbar(self):
self.addSeparator()
else:
a = self.addAction(self._icon(image_file + '.png'),
text, getattr(self, callback))
text, getattr(self, callback))
self._actions[callback] = a
if callback in ['zoom', 'pan']:
a.setCheckable(True)
Expand All @@ -614,7 +616,7 @@ def _init_toolbar(self):
QtCore.Qt.AlignRight | QtCore.Qt.AlignTop)
self.locLabel.setSizePolicy(
QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Ignored))
QtWidgets.QSizePolicy.Ignored))
labelAction = self.addWidget(self.locLabel)
labelAction.setVisible(True)

Expand Down