Skip to content

Commit

Permalink
Add script to automatically generate icons
Browse files Browse the repository at this point in the history
Add new icons
  • Loading branch information
mdboom committed Jun 1, 2016
1 parent 75a35ef commit 3189476
Show file tree
Hide file tree
Showing 82 changed files with 3,776 additions and 2,101 deletions.
Binary file modified doc/_static/toolbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 8 additions & 13 deletions doc/users/navigation_toolbar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ All figure windows come with a navigation toolbar, which can be used
to navigate through the data set. Here is a description of each of
the buttons at the bottom of the toolbar

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

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

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

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

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

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

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

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

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

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

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

The ``Save`` button
Click this button to launch a file save dialog. You can save
Expand Down Expand Up @@ -137,8 +137,3 @@ example code for GTK::

win.show_all()
gtk.main()





21 changes: 0 additions & 21 deletions examples/pylab_examples/matplotlib_icon.py

This file was deleted.

2 changes: 1 addition & 1 deletion lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2733,8 +2733,8 @@ class NavigationToolbar2(object):
(None, None, None, None),
('Pan', 'Pan axes with left mouse, zoom with right', 'move', 'pan'),
('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'),
(None, None, None, None),
('Subplots', 'Configure subplots', 'subplots', 'configure_subplots'),
(None, None, None, None),
('Save', 'Save the figure', 'filesave', 'save_figure'),
)

Expand Down
3 changes: 1 addition & 2 deletions lib/matplotlib/backend_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,7 @@ def _mouse_move(self, event):
"""Default tools"""

default_toolbar_tools = [['navigation', ['home', 'back', 'forward']],
['zoompan', ['pan', 'zoom']],
['layout', ['subplots']],
['zoompan', ['pan', 'zoom', 'subplots']],
['io', ['save']]]
"""Default tools in the toolbar"""

Expand Down
25 changes: 19 additions & 6 deletions lib/matplotlib/backends/backend_qt5.py
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 @@ -581,6 +585,8 @@ def __init__(self, canvas, parent, coordinates=True):
NavigationToolbar2.__init__(self, canvas)

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

def _init_toolbar(self):
Expand All @@ -597,11 +603,10 @@ def _init_toolbar(self):
a.setCheckable(True)
if tooltip_text is not None:
a.setToolTip(tooltip_text)

if figureoptions is not None:
a = self.addAction(self._icon("qt4_editor_options.png"),
'Customize', self.edit_parameters)
a.setToolTip('Edit axis, curve and image parameters')
if figureoptions is not None and text == 'Subplots':
a = self.addAction(self._icon("qt4_editor_options.png"),
'Customize', self.edit_parameters)
a.setToolTip('Edit axis, curve and image parameters')

self.buttons = {}

Expand All @@ -621,6 +626,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
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_tkagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def new_figure_manager_given_figure(num, figure):
# doesn't allow colour icons on linux systems, but tk >=8.5 has a iconphoto
# command which we call directly. Source:
# http://mail.python.org/pipermail/tkinter-discuss/2006-November/000954.html
icon_fname = os.path.join(rcParams['datapath'], 'images', 'matplotlib.gif')
icon_fname = os.path.join(rcParams['datapath'], 'images', 'matplotlib.ppm')
icon_img = Tk.PhotoImage(file=icon_fname)
try:
window.tk.call('wm', 'iconphoto', window._w, icon_img)
Expand Down
4 changes: 4 additions & 0 deletions lib/matplotlib/backends/qt_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,7 @@ def _getSaveFileName(*args, **kwargs):
'''
QtWidgets = QtGui


def is_pyqt5():
return QT_API == QT_API_PYQT5
Binary file modified lib/matplotlib/mpl-data/images/back.pdf
Binary file not shown.
Binary file modified lib/matplotlib/mpl-data/images/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/matplotlib/mpl-data/images/back.ppm
Binary file not shown.
109 changes: 46 additions & 63 deletions lib/matplotlib/mpl-data/images/back.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/matplotlib/mpl-data/images/back_large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/matplotlib/mpl-data/images/back_large.ppm
Binary file not shown.
Binary file modified lib/matplotlib/mpl-data/images/filesave.pdf
Binary file not shown.
Binary file modified lib/matplotlib/mpl-data/images/filesave.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/matplotlib/mpl-data/images/filesave.ppm
Binary file not shown.
Loading

0 comments on commit 3189476

Please sign in to comment.