Skip to content

Commit 3189476

Browse files
committed
Add script to automatically generate icons
Add new icons
1 parent 75a35ef commit 3189476

Some content is hidden

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

82 files changed

+3776
-2101
lines changed

doc/_static/toolbar.png

6.32 KB
Loading

doc/users/navigation_toolbar.rst

+8-13
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
@@ -137,8 +137,3 @@ example code for GTK::
137137

138138
win.show_all()
139139
gtk.main()
140-
141-
142-
143-
144-

examples/pylab_examples/matplotlib_icon.py

-21
This file was deleted.

lib/matplotlib/backend_bases.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2733,8 +2733,8 @@ class NavigationToolbar2(object):
27332733
(None, None, None, None),
27342734
('Pan', 'Pan axes with left mouse, zoom with right', 'move', 'pan'),
27352735
('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'),
2736-
(None, None, None, None),
27372736
('Subplots', 'Configure subplots', 'subplots', 'configure_subplots'),
2737+
(None, None, None, None),
27382738
('Save', 'Save the figure', 'filesave', 'save_figure'),
27392739
)
27402740

lib/matplotlib/backend_tools.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -924,8 +924,7 @@ def _mouse_move(self, event):
924924
"""Default tools"""
925925

926926
default_toolbar_tools = [['navigation', ['home', 'back', 'forward']],
927-
['zoompan', ['pan', 'zoom']],
928-
['layout', ['subplots']],
927+
['zoompan', ['pan', 'zoom', 'subplots']],
929928
['io', ['save']]]
930929
"""Default tools in the toolbar"""
931930

lib/matplotlib/backends/backend_qt5.py

+19-6
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):
@@ -581,6 +585,8 @@ def __init__(self, canvas, parent, coordinates=True):
581585
NavigationToolbar2.__init__(self, canvas)
582586

583587
def _icon(self, name):
588+
if is_pyqt5():
589+
name = name.replace('.png', '_large.png')
584590
return QtGui.QIcon(os.path.join(self.basedir, name))
585591

586592
def _init_toolbar(self):
@@ -597,11 +603,10 @@ def _init_toolbar(self):
597603
a.setCheckable(True)
598604
if tooltip_text is not None:
599605
a.setToolTip(tooltip_text)
600-
601-
if figureoptions is not None:
602-
a = self.addAction(self._icon("qt4_editor_options.png"),
603-
'Customize', self.edit_parameters)
604-
a.setToolTip('Edit axis, curve and image parameters')
606+
if figureoptions is not None and text == 'Subplots':
607+
a = self.addAction(self._icon("qt4_editor_options.png"),
608+
'Customize', self.edit_parameters)
609+
a.setToolTip('Edit axis, curve and image parameters')
605610

606611
self.buttons = {}
607612

@@ -621,6 +626,14 @@ def _init_toolbar(self):
621626
# reference holder for subplots_adjust window
622627
self.adj_window = None
623628

629+
# Esthetic adjustments - we need to set these explicitly in PyQt5
630+
# otherwise the layout looks different - but we don't want to set it if
631+
# not using HiDPI icons otherwise they look worse than before.
632+
if is_pyqt5():
633+
self.setIconSize(QtCore.QSize(24, 24))
634+
self.layout().setSpacing(12)
635+
self.setMinimumHeight(48)
636+
624637
if figureoptions is not None:
625638
def edit_parameters(self):
626639
allaxes = self.canvas.figure.get_axes()

lib/matplotlib/backends/backend_tkagg.py

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

+4
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,7 @@ def _getSaveFileName(*args, **kwargs):
204204
205205
'''
206206
QtWidgets = QtGui
207+
208+
209+
def is_pyqt5():
210+
return QT_API == QT_API_PYQT5
-2.89 KB
Binary file not shown.
-1.06 KB
Loading
0 Bytes
Binary file not shown.
+46-63
Loading
620 Bytes
Loading
6.76 KB
Binary file not shown.
-8.46 KB
Binary file not shown.
-663 Bytes
Loading
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)