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

Skip to content

Commit f0607fa

Browse files
committed
Add script to automatically generate icons
Add new icons
1 parent 1fe4df7 commit f0607fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3785
-2094
lines changed

doc/_static/toolbar.png

1.77 KB
Loading

doc/users/navigation_toolbar.rst

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ All figure windows come with a navigation toolbar, which can be used
99
to navigate through the data set. Here is a description of each of
1010
the buttons at the bottom of the toolbar
1111

12-
.. image:: ../../lib/matplotlib/mpl-data/images/home.png
12+
.. image:: ../../lib/matplotlib/mpl-data/images/home_large.png
1313

14-
.. image:: ../../lib/matplotlib/mpl-data/images/back.png
14+
.. image:: ../../lib/matplotlib/mpl-data/images/back_large.png
1515

16-
.. image:: ../../lib/matplotlib/mpl-data/images/forward.png
16+
.. image:: ../../lib/matplotlib/mpl-data/images/forward_large.png
1717

1818
The ``Home``, ``Forward`` and ``Back`` buttons
1919
These are akin to a web browser's home, forward and back controls.
@@ -26,7 +26,7 @@ The ``Home``, ``Forward`` and ``Back`` buttons
2626
first, default view of your data. Again, all of these buttons should
2727
feel very familiar to any user of a web browser.
2828

29-
.. image:: ../../lib/matplotlib/mpl-data/images/move.png
29+
.. image:: ../../lib/matplotlib/mpl-data/images/move_large.png
3030

3131
The ``Pan/Zoom`` button
3232
This button has two modes: pan and zoom. Click the toolbar button
@@ -50,7 +50,7 @@ The ``Pan/Zoom`` button
5050
mouse button. The radius scale can be zoomed in and out using the
5151
right mouse button.
5252

53-
.. image:: ../../lib/matplotlib/mpl-data/images/zoom_to_rect.png
53+
.. image:: ../../lib/matplotlib/mpl-data/images/zoom_to_rect_large.png
5454

5555
The ``Zoom-to-rectangle`` button
5656
Click this toolbar button to activate this mode. Put your mouse
@@ -61,15 +61,15 @@ The ``Zoom-to-rectangle`` button
6161
with the right button, which will place your entire axes in the
6262
region defined by the zoom out rectangle.
6363

64-
.. image:: ../../lib/matplotlib/mpl-data/images/subplots.png
64+
.. image:: ../../lib/matplotlib/mpl-data/images/subplots_large.png
6565

6666
The ``Subplot-configuration`` button
6767
Use this tool to configure the appearance of the subplot:
6868
you can stretch or compress the left, right, top, or bottom
69-
side of the subplot, or the space between the rows or
69+
side of the subplot, or the space between the rows or
7070
space between the columns.
7171

72-
.. image:: ../../lib/matplotlib/mpl-data/images/filesave.png
72+
.. image:: ../../lib/matplotlib/mpl-data/images/filesave_large.png
7373

7474
The ``Save`` button
7575
Click this button to launch a file save dialog. You can save
@@ -95,7 +95,7 @@ Zoom-to-rect **o**
9595
Save **ctrl** + **s**
9696
Toggle fullscreen **ctrl** + **f**
9797
Close plot **ctrl** + **w**
98-
Constrain pan/zoom to x axis hold **x** when panning/zooming with mouse
98+
Constrain pan/zoom to x axis hold **x** when panning/zooming with mouse
9999
Constrain pan/zoom to y axis hold **y** when panning/zooming with mouse
100100
Preserve aspect ratio hold **CONTROL** when panning/zooming with mouse
101101
Toggle grid **g** when mouse is over an axes
@@ -134,8 +134,3 @@ example code for GTK::
134134

135135
win.show_all()
136136
gtk.main()
137-
138-
139-
140-
141-

examples/pylab_examples/matplotlib_icon.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

lib/matplotlib/backends/backend_qt5.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
except ImportError:
2929
figureoptions = None
3030

31-
from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
31+
from .qt_compat import (QtCore, QtGui, QtWidgets, _getSaveFileName,
32+
__version__, is_pyqt5)
3233
from matplotlib.backends.qt_editor.formsubplottool import UiSubplotTool
3334

3435
backend_version = __version__
@@ -142,6 +143,9 @@ def _create_qApp():
142143
else:
143144
qApp = app
144145

146+
if is_pyqt5():
147+
qApp.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
148+
145149

146150
class Show(ShowBase):
147151
def mainloop(self):
@@ -566,6 +570,8 @@ def __init__(self, canvas, parent, coordinates=True):
566570
NavigationToolbar2.__init__(self, canvas)
567571

568572
def _icon(self, name):
573+
if is_pyqt5():
574+
name = name.replace('.png', '_large.png')
569575
return QtGui.QIcon(os.path.join(self.basedir, name))
570576

571577
def _init_toolbar(self):
@@ -606,6 +612,14 @@ def _init_toolbar(self):
606612
# reference holder for subplots_adjust window
607613
self.adj_window = None
608614

615+
# Esthetic adjustments - we need to set these explicitly in PyQt5
616+
# otherwise the layout looks different - but we don't want to set it if
617+
# not using HiDPI icons otherwise they look worse than before.
618+
if is_pyqt5():
619+
self.setIconSize(QtCore.QSize(24, 24))
620+
self.layout().setSpacing(12)
621+
self.setMinimumHeight(48)
622+
609623
if figureoptions is not None:
610624
def edit_parameters(self):
611625
allaxes = self.canvas.figure.get_axes()

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def new_figure_manager_given_figure(num, figure):
9797
# doesn't allow colour icons on linux systems, but tk >=8.5 has a iconphoto
9898
# command which we call directly. Source:
9999
# http://mail.python.org/pipermail/tkinter-discuss/2006-November/000954.html
100-
icon_fname = os.path.join(rcParams['datapath'], 'images', 'matplotlib.gif')
100+
icon_fname = os.path.join(rcParams['datapath'], 'images', 'matplotlib.ppm')
101101
icon_img = Tk.PhotoImage(file=icon_fname)
102102
try:
103103
window.tk.call('wm', 'iconphoto', window._w, icon_img)

lib/matplotlib/backends/qt_compat.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,7 @@ def _getSaveFileName(*args, **kwargs):
179179
180180
'''
181181
QtWidgets = QtGui
182+
183+
184+
def is_pyqt5():
185+
return QT_API == QT_API_PYQT5
-2.9 KB
Binary file not shown.
-1.06 KB
Loading
0 Bytes
Binary file not shown.
Lines changed: 47 additions & 63 deletions
Loading
620 Bytes
Loading
6.76 KB
Binary file not shown.
-8.36 KB
Binary file not shown.
-703 Bytes
Loading
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)