Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 60388a7

Browse filesBrowse files
committed
use pngs for wx icons
svn path=/trunk/matplotlib/; revision=5118
1 parent 8dff8d9 commit 60388a7
Copy full SHA for 60388a7

File tree

Expand file treeCollapse file tree

2 files changed

+26
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+26
-7
lines changed

‎lib/matplotlib/axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6017,4 +6017,5 @@ def subplot_class_factory(axes_class=None):
60176017
maxx = max(posx)
60186018
# warning, probably breaks inverted axis
60196019
self.set_xlim((0.1*minx, maxx))
6020+
60206021
"""

‎lib/matplotlib/backends/backend_wx.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wx.py
+25-7Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,24 @@ def _load_bitmap(filename):
13921392
bmp =wx.Bitmap(bmpFilename, wx.BITMAP_TYPE_XPM)
13931393
return bmp
13941394

1395+
def _load_pngicon(filename):
1396+
"""
1397+
Load a png icon file from the backends/images subdirectory in which the
1398+
matplotlib library is installed. The filename parameter should not
1399+
contain any path information as this is determined automatically.
1400+
1401+
Returns a wx.Bitmap object
1402+
"""
1403+
1404+
basedir = os.path.join(rcParams['datapath'],'images')
1405+
1406+
pngFilename = os.path.normpath(os.path.join(basedir, filename))
1407+
if not os.path.exists(pngFilename):
1408+
raise IOError('Could not find bitmap file "%s"; dying'%pngFilename)
1409+
1410+
png =wx.Bitmap(pngFilename, wx.BITMAP_TYPE_PNG)
1411+
return png
1412+
13951413
class MenuButtonWx(wx.Button):
13961414
"""
13971415
wxPython does not permit a menu to be incorporated directly into a toolbar.
@@ -1552,24 +1570,24 @@ def _init_toolbar(self):
15521570

15531571
self.SetToolBitmapSize(wx.Size(24,24))
15541572

1555-
self.AddSimpleTool(_NTB2_HOME, _load_bitmap('home.xpm'),
1573+
self.AddSimpleTool(_NTB2_HOME, _load_pngicon('home.png'),
15561574
'Home', 'Reset original view')
1557-
self.AddSimpleTool(self._NTB2_BACK, _load_bitmap('back.xpm'),
1575+
self.AddSimpleTool(self._NTB2_BACK, _load_pngicon('back.png'),
15581576
'Back', 'Back navigation view')
1559-
self.AddSimpleTool(self._NTB2_FORWARD, _load_bitmap('forward.xpm'),
1577+
self.AddSimpleTool(self._NTB2_FORWARD, _load_pngicon('forward.png'),
15601578
'Forward', 'Forward navigation view')
15611579
# todo: get new bitmap
1562-
self.AddCheckTool(self._NTB2_PAN, _load_bitmap('move.xpm'),
1580+
self.AddCheckTool(self._NTB2_PAN, _load_pngicon('move.png'),
15631581
shortHelp='Pan',
15641582
longHelp='Pan with left, zoom with right')
1565-
self.AddCheckTool(self._NTB2_ZOOM, _load_bitmap('zoom_to_rect.xpm'),
1583+
self.AddCheckTool(self._NTB2_ZOOM, _load_pngicon('zoom_to_rect.png'),
15661584
shortHelp='Zoom', longHelp='Zoom to rectangle')
15671585

15681586
self.AddSeparator()
1569-
self.AddSimpleTool(_NTB2_SUBPLOT, _load_bitmap('subplots.xpm'),
1587+
self.AddSimpleTool(_NTB2_SUBPLOT, _load_pngicon('subplots.png'),
15701588
'Configure subplots', 'Configure subplot parameters')
15711589

1572-
self.AddSimpleTool(_NTB2_SAVE, _load_bitmap('filesave.xpm'),
1590+
self.AddSimpleTool(_NTB2_SAVE, _load_pngicon('filesave.png'),
15731591
'Save', 'Save plot contents to file')
15741592

15751593
if wx.VERSION_STRING >= '2.5':

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.