8000 Oooops · matplotlib/matplotlib@a726c8a · GitHub
[go: up one dir, main page]

Skip to content

Commit a726c8a

Browse files
committed
Oooops
1 parent b0b7286 commit a726c8a

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,6 +1804,7 @@ def is_saving(self):
18041804
"""
18051805
return self._is_saving
18061806

1807+
@cbook.deprecated("2.2")
18071808
def onRemove(self, ev):
18081809
"""
18091810
Mouse event processor which removes the top artist
@@ -2696,6 +2697,7 @@ def key_press(self, event):
26962697
if rcParams['toolbar'] != 'toolmanager':
26972698
key_press_handler(event, self.canvas, self.canvas.toolbar)
26982699

2700+
@cbook.deprecated("2.2")
26992701
def show_popup(self, msg):
27002702
"""Display message in a popup -- GUI only."""
27012703

@@ -3218,6 +3220,13 @@ class ToolContainerBase(object):
32183220
The tools with which this `ToolContainer` wants to communicate.
32193221
"""
32203222

3223+
_icon_extension = '.png'
3224+
"""
3225+
Toolcontainer button icon image format extension
3226+
3227+
**String**: Image extension
3228+
"""
3229+
32213230
def __init__(self, toolmanager):
32223231
self.toolmanager = toolmanager
32233232
self.toolmanager.toolmanager_connect('tool_removed_event',
@@ -3262,14 +3271,19 @@ def _remove_tool_cbk(self, event):
32623271

32633272
def _get_image_filename(self, image):
32643273
"""Find the image based on its name."""
3265-
# TODO: better search for images, they are not always in the
3266-
# datapath
3274+
if not image:
3275+
return None
3276+
32673277
basedir = os.path.join(rcParams['datapath'], 'images')
3268-
if image is not None:
3269-
fname = os.path.join(basedir, image)
3270-
else:
3271-
fname = None
3272-
return fname
3278+
possible_images = (
3279+
image,
3280+
image + self._icon_extension,
3281+
os.path.join(basedir, image),
3282+
os.path.join(basedir, image) + self._icon_extension)
3283+
3284+
for fname in possible_images:
3285+
if os.path.isfile(fname):
3286+
return fname
32733287

32743288
def trigger_tool(self, name):
32753289
"""

0 commit comments

Comments
 (0)
0