@@ -1804,6 +1804,7 @@ def is_saving(self):
1804
1804
"""
1805
1805
return self ._is_saving
1806
1806
1807
+ @cbook .deprecated ("2.2" )
1807
1808
def onRemove (self , ev ):
1808
1809
"""
1809
1810
Mouse event processor which removes the top artist
@@ -2696,6 +2697,7 @@ def key_press(self, event):
2696
2697
if rcParams ['toolbar' ] != 'toolmanager' :
2697
2698
key_press_handler (event , self .canvas , self .canvas .toolbar )
2698
2699
2700
+ @cbook .deprecated ("2.2" )
2699
2701
def show_popup (self , msg ):
2700
2702
"""Display message in a popup -- GUI only."""
2701
2703
@@ -3218,6 +3220,13 @@ class ToolContainerBase(object):
3218
3220
The tools with which this `ToolContainer` wants to communicate.
3219
3221
"""
3220
3222
3223
+ _icon_extension = '.png'
3224
+ """
3225
+ Toolcontainer button icon image format extension
3226
+
3227
+ **String**: Image extension
3228
+ """
3229
+
3221
3230
def __init__ (self , toolmanager ):
3222
3231
self .toolmanager = toolmanager
3223
3232
self .toolmanager .toolmanager_connect ('tool_removed_event' ,
@@ -3262,14 +3271,19 @@ def _remove_tool_cbk(self, event):
3262
3271
3263
3272
def _get_image_filename (self , image ):
3264
3273
"""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
+
3267
3277
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
3273
3287
3274
3288
def trigger_tool (self , name ):
3275
3289
"""
0 commit comments