@@ -1081,25 +1081,16 @@ def resize(self, width, height):
1081
1081
1082
1082
def _load_bitmap (filename ):
1083
1083
"""
1084
- Load a bitmap file from the backends/images subdirectory in which the
1085
- matplotlib library is installed. The filename parameter should not
1086
- contain any path information as this is determined automatically.
1087
-
1088
- Returns a wx.Bitmap object.
1084
+ Load a wx.Bitmap from a file in the "images" directory of the Matplotlib
1085
+ data.
1089
1086
"""
1090
- path = cbook ._get_data_path ('images' , filename )
1091
- if not path .exists ():
1092
- raise IOError (f"Could not find bitmap file '{ path } '; dying" )
1093
- return wx .Bitmap (str (path ))
1087
+ return wx .Bitmap (str (cbook ._get_data_path ('images' , filename )))
1094
1088
1095
1089
1096
1090
def _set_frame_icon (frame ):
1097
1091
bundle = wx .IconBundle ()
1098
1092
for image in ('matplotlib.png' , 'matplotlib_large.png' ):
1099
- try :
1100
- icon = wx .Icon (_load_bitmap (image ))
1101
- except IOError :
1102
- continue
1093
+ icon = wx .Icon (_load_bitmap (image ))
1103
1094
if not icon .IsOk ():
1104
1095
return
1105
1096
bundle .AddIcon (icon )
@@ -1144,7 +1135,7 @@ def _init_toolbar(self):
1144
1135
self .wx_ids [text ] = (
1145
1136
self .AddTool (
1146
1137
- 1 ,
1147
- bitmap = _load_bitmap (image_file + " .png" ),
1138
+ bitmap = _load_bitmap (f" { image_file } .png" ),
1148
1139
bmpDisabled = wx .NullBitmap ,
1149
1140
label = text , shortHelp = text , longHelp = tooltip_text ,
1150
1141
kind = (wx .ITEM_CHECK if text in ["Pan" , "Zoom" ]
@@ -1325,8 +1316,7 @@ def set_history_buttons(self):
1325
1316
class StatusBarWx (wx .StatusBar ):
1326
1317
"""
1327
1318
A status bar is added to _FigureFrame to allow measurements and the
1328
- previously selected scroll function to be displayed as a user
1329
- convenience.
1319
+ previously selected scroll function to be displayed as a user convenience.
1330
1320
"""
1331
1321
1332
1322
def __init__ (self , parent , * args , ** kwargs ):
@@ -1356,7 +1346,7 @@ def add_toolitem(self, name, group, position, image_file, description,
1356
1346
tool = self .InsertTool (idx , - 1 , name , bmp , wx .NullBitmap , kind ,
1357
1347
description or "" )
1358
1348
else :
1359
- size = (self .GetTextExtent (name )[0 ]+ 10 , - 1 )
1349
+ size = (self .GetTextExtent (name )[0 ] + 10 , - 1 )
1360
1350
if toggle :
1361
1351
control = wx .ToggleButton (self , - 1 , name , size = size )
1362
1352
else :
0 commit comments