Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cbb3c18

Browse files
committed
fixed wxagg ans gtkagg switch bug
svn path=/trunk/matplotlib/; revision=3271
1 parent b727276 commit cbb3c18

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

lib/matplotlib/backends/backend_gtkagg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
114114
orientation, **kwargs)
115115
except IOError, msg:
116116
error_msg_gtk('Failed to save\nError message: %s'%(msg,), self)
117+
except:
118+
self.figure.set_canvas(self)
119+
raise
117120

118121
self.figure.set_canvas(self)
119122
if DEBUG: print 'FigureCanvasGTKAgg.print_figure done'

lib/matplotlib/backends/backend_wxagg.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,14 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
102102
"""
103103
if dpi is None: dpi = matplotlib.rcParams['savefig.dpi']
104104
agg = self.switch_backends(FigureCanvasAgg)
105-
agg.print_figure(filename, dpi, facecolor, edgecolor, orientation,
106-
**kwargs)
107-
self.figure.set_canvas(self)
105+
try:
106+
agg.print_figure(filename, dpi, facecolor, edgecolor, orientation,
107+
**kwargs)
108+
except:
109+
self.figure.set_canvas(self)
110+
raise
111+
else:
112+
self.figure.set_canvas(self)
108113

109114
def _get_imagesave_wildcards(self):
110115
'return the wildcard string for the filesave dialog'

0 commit comments

Comments
 (0)