@@ -548,13 +548,6 @@ def set_joinstyle(self, js):
548548 self .gdkGC .join_style = self ._joind [self ._joinstyle ]
549549
550550
551- def raise_msg_to_str (msg ):
552- """msg is a return arg from a raise. Join with new lines"""
553- if not is_string_like (msg ):
554- msg = '\n ' .join (map (str , msg ))
555- return msg
556-
557-
558551def error_msg_gtk (msg , parent = None ):
559552 dialog = gtk .MessageDialog (
560553 parent = parent ,
@@ -847,11 +840,16 @@ def gdk_pixmap_save (pixmap, filename, ext, width, height):
847840 # pixbuf.save() recognises 'jpeg' not 'jpg'
848841 if ext == 'jpg' : ext = 'jpeg'
849842 try : pixbuf .save (filename , ext )
850- except gobject .GError , msg :
851- msg = raise_msg_to_str (msg )
843+ except gobject .GError , exc :
852844 error_msg ('Could not save figure to %s\n \n %s' % (
853- filename , msg ))
845+ filename , exc ))
854846
847+ #def raise_msg_to_str(msg):
848+ # """msg is a return arg from a raise. Join with new lines"""
849+ # if not is_string_like(msg):
850+ # msg = '\n'.join(map(str, msg))
851+ # return msg
852+
855853
856854class FigureManagerGTK (FigureManagerBase ):
857855 """
@@ -879,9 +877,8 @@ def __init__(self, canvas, num):
879877 # must be inited after the window, drawingArea and figure
880878 # attrs are set
881879 if matplotlib .rcParams ['toolbar' ]== 'classic' :
882- self .toolbar = NavigationToolbar ( canvas , self .window )
880+ self .toolbar = NavigationToolbar ( canvas , self .window )
883881 elif matplotlib .rcParams ['toolbar' ]== 'toolbar2' :
884- #self.toolbar = NavigationToolbar2GTK( canvas )
885882 self .toolbar = NavigationToolbar2GTK (canvas , self .window )
886883 else :
887884 self .toolbar = None
@@ -1139,7 +1136,7 @@ class NavigationToolbar(gtk.Toolbar):
11391136 gtk .STOCK_SAVE , 'save_figure' , None , False ),
11401137 )
11411138
1142- def __init__ (self , canvas , window = None ):
1139+ def __init__ (self , canvas , window ):
11431140 """
11441141 figManager is the FigureManagerGTK instance that contains the
11451142 toolbar, with attributes figure, window and drawingArea
@@ -1148,7 +1145,7 @@ def __init__(self, canvas, window=None):
11481145 gtk .Toolbar .__init__ (self )
11491146
11501147 self .canvas = canvas
1151- self .win = window
1148+ self .win = window # Note: gtk.Toolbar already has a 'window' attribute
11521149
11531150 self .set_style (gtk .TOOLBAR_ICONS )
11541151
@@ -1424,6 +1421,7 @@ def __init__ (self,
14241421
14251422 self .IMAGE_FORMAT = matplotlib .backends .backend_mod .IMAGE_FORMAT
14261423 self .IMAGE_FORMAT_DEFAULT = matplotlib .backends .backend_mod .IMAGE_FORMAT_DEFAULT
1424+ self .IMAGE_FORMAT .sort ()
14271425
14281426 # create an extra widget to list supported image formats
14291427 self .set_current_folder (self .path )
0 commit comments