FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use HiDPI icons for PyQt5 by astrofrog · Pull Request #5057 · matplotlib/matplotlib · GitHub

Repository navigation

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .png  (10) .py  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
16 changes: 15 additions & 1 deletion lib/matplotlib/backends/backend_qt5.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
except ImportError:
figureoptions = None

from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
from .qt_compat import (QtCore, QtGui, QtWidgets, _getSaveFileName,
__version__, is_pyqt5)
from matplotlib.backends.qt_editor.formsubplottool import UiSubplotTool

backend_version = __version__
Expand Down Expand Up @@ -142,6 +143,9 @@ def _create_qApp():
else:
qApp = app

if is_pyqt5():
qApp.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)


class Show(ShowBase):
def mainloop(self):
Expand Down Expand Up @@ -566,6 +570,8 @@ def __init__(self, canvas, parent, coordinates=True):
NavigationToolbar2.__init__(self, canvas)

def _icon(self, name):
if is_pyqt5():
name = name.replace('.png', '_hidpi.png')
return QtGui.QIcon(os.path.join(self.basedir, name))

def _init_toolbar(self):
Expand Down Expand Up @@ -606,6 +612,14 @@ def _init_toolbar(self):
# reference holder for subplots_adjust window
self.adj_window = None

# Esthetic adjustments - we need to set these explicitly in PyQt5
# otherwise the layout looks different - but we don't want to set it if
# not using HiDPI icons otherwise they look worse than before.
if is_pyqt5():
self.setIconSize(QtCore.QSize(24, 24))
self.layout().setSpacing(12)
self.setMinimumHeight(48)

if figureoptions is not None:
def edit_parameters(self):
allaxes = self.canvas.figure.get_axes()
Expand Down
4 changes: 4 additions & 0 deletions lib/matplotlib/backends/qt_compat.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,7 @@ def _getSaveFileName(*args, **kwargs):

'''
QtWidgets = QtGui


def is_pyqt5():
return QT_API == QT_API_PYQT5
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.

Back | FazBrowse Home | New Git URL