@@ -359,15 +359,17 @@ def __init__(self, canvas, num):
359
359
360
360
self .window = Gtk .Window ()
361
361
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 ])
371
373
372
374
self .vbox = Gtk .Box ()
373
375
self .vbox .set_property ("orientation" , Gtk .Orientation .VERTICAL )
@@ -562,12 +564,15 @@ def configure_subplots(self, button):
562
564
563
565
564
566
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
571
576
window .set_title ("Subplot Configuration Tool" )
572
577
window .set_default_size (w , h )
573
578
vbox = Gtk .Box ()
@@ -963,7 +968,6 @@ def get_active_line(self):
963
968
line = self .lines [ind ]
964
969
return line
965
970
966
-
967
971
def get_active_linestyle (self ):
968
972
'get the active lineinestyle'
969
973
ind = self .cbox_linestyles .get_active ()
@@ -997,8 +1001,6 @@ def _update(self):
997
1001
998
1002
line .figure .canvas .draw ()
999
1003
1000
-
1001
-
1002
1004
def on_combobox_lineprops_changed (self , item ):
1003
1005
'update the widgets from the active line'
1004
1006
if not self ._inited : return
@@ -1044,17 +1046,14 @@ def on_dialog_lineprops_okbutton_clicked(self, button):
1044
1046
def on_dialog_lineprops_cancelbutton_clicked (self , button ):
1045
1047
self .dlg .hide ()
1046
1048
1047
- # set icon used when windows are minimized
1048
- try :
1049
1049
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
+
1058
1057
1059
1058
def error_msg_gtk (msg , parent = None ):
1060
1059
if parent is not None : # find the toplevel Gtk.Window
0 commit comments