@@ -359,15 +359,17 @@ def __init__(self, canvas, num):
359359
360360 self .window = Gtk .Window ()
361361 self .set_window_title ("Figure %d" % num )
362- if (window_icon ):
363- try :
364- self .window .set_icon_from_file (window_icon )
365- except :
366- # some versions of gtk throw a glib.GError but not
367- # all, so I am not sure how to catch it. I am unhappy
368- # diong a blanket catch here, but an not sure what a
369- # better way is - JDH
370- verbose .report ('Could not load matplotlib icon: %s' % sys .exc_info ()[1 ])
362+ try :
363+ self .window .set_icon_from_file (window_icon )
364+ except (SystemExit , KeyboardInterrupt ):
365+ # re-raise exit type Exceptions
366+ raise
367+ except :
368+ # some versions of gtk throw a glib.GError but not
369+ # all, so I am not sure how to catch it. I am unhappy
370+ # doing a blanket catch here, but an not sure what a
371+ # better way is - JDH
372+ verbose .report ('Could not load matplotlib icon: %s' % sys .exc_info ()[1 ])
371373
372374 self .vbox = Gtk .Box ()
373375 self .vbox .set_property ("orientation" , Gtk .Orientation .VERTICAL )
@@ -562,12 +564,15 @@ def configure_subplots(self, button):
562564
563565
564566 window = Gtk .Window ()
565- if (window_icon ):
566- try : window .set_icon_from_file (window_icon )
567- except :
568- # we presumably already logged a message on the
569- # failure of the main plot, don't keep reporting
570- pass
567+ try :
568+ window .set_icon_from_file (window_icon )
569+ except (SystemExit , KeyboardInterrupt ):
570+ # re-raise exit type Exceptions
571+ raise
572+ except :
573+ # we presumably already logged a message on the
574+ # failure of the main plot, don't keep reporting
575+ pass
571576 window .set_title ("Subplot Configuration Tool" )
572577 window .set_default_size (w , h )
573578 vbox = Gtk .Box ()
@@ -963,7 +968,6 @@ def get_active_line(self):
963968 line = self .lines [ind ]
964969 return line
965970
966-
967971 def get_active_linestyle (self ):
968972 'get the active lineinestyle'
969973 ind = self .cbox_linestyles .get_active ()
@@ -997,8 +1001,6 @@ def _update(self):
9971001
9981002 line .figure .canvas .draw ()
9991003
1000-
1001-
10021004 def on_combobox_lineprops_changed (self , item ):
10031005 'update the widgets from the active line'
10041006 if not self ._inited : return
@@ -1044,17 +1046,14 @@ def on_dialog_lineprops_okbutton_clicked(self, button):
10441046 def on_dialog_lineprops_cancelbutton_clicked (self , button ):
10451047 self .dlg .hide ()
10461048
1047- # set icon used when windows are minimized
1048- try :
10491049
1050- if sys .platform == 'win32' :
1051- icon_filename = 'matplotlib.png'
1052- else :
1053- icon_filename = 'matplotlib.svg'
1054- window_icon = os .path .join (rcParams ['datapath' ], 'images' , icon_filename )
1055- except :
1056- window_icon = None
1057- verbose .report ('Could not load matplotlib icon: %s' % sys .exc_info ()[1 ])
1050+ # Define the file to use as the GTk icon
1051+ if sys .platform == 'win32' :
1052+ icon_filename = 'matplotlib.png'
1053+ else :
1054+ icon_filename = 'matplotlib.svg'
1055+ window_icon = os .path .join (matplotlib .rcParams ['datapath' ], 'images' , icon_filename )
1056+
10581057
10591058def error_msg_gtk (msg , parent = None ):
10601059 if parent is not None : # find the toplevel Gtk.Window
0 commit comments