Show More
@@ -2426,7 +2426,10 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||||
2426 | continue |
|
2426 | continue | |
2427 | try: |
|
2427 | try: | |
2428 | func() |
|
2428 | func() | |
2429 | except: |
|
2429 | except KeyboardInterrupt: | |
|
2430 | print >> io.stderr, "\nKeyboardInterrupt" | |||
|
2431 | except Exception: | |||
|
2432 | print >> io.stderr, "Disabling failed post-execution function: %s" % func | |||
2430 | self.showtraceback() |
|
2433 | self.showtraceback() | |
2431 | # Deactivate failing function |
|
2434 | # Deactivate failing function | |
2432 | self._post_execute[func] = False |
|
2435 | self._post_execute[func] = False |
@@ -97,11 +97,13 b' def show(close=None):' | |||||
97 | """ |
|
97 | """ | |
98 | if close is None: |
|
98 | if close is None: | |
99 | close = InlineBackend.instance().close_figures |
|
99 | close = InlineBackend.instance().close_figures | |
100 | for figure_manager in Gcf.get_all_fig_managers(): |
|
100 | try: | |
101 | send_figure(figure_manager.canvas.figure) |
|
101 | for figure_manager in Gcf.get_all_fig_managers(): | |
102 | if close: |
|
102 | send_figure(figure_manager.canvas.figure) | |
103 | matplotlib.pyplot.close('all') |
|
103 | finally: | |
104 | show._to_draw = [] |
|
104 | show._to_draw = [] | |
|
105 | if close: | |||
|
106 | matplotlib.pyplot.close('all') | |||
105 |
|
107 | |||
106 |
|
108 | |||
107 |
|
109 | |||
@@ -146,13 +148,15 b' def flush_figures():' | |||||
146 | # ignore the tracking, just draw and close all figures |
|
148 | # ignore the tracking, just draw and close all figures | |
147 | return show(True) |
|
149 | return show(True) | |
148 |
|
150 | |||
149 | # exclude any figures that were closed: |
|
151 | try: | |
150 | active = set([fm.canvas.figure for fm in Gcf.get_all_fig_managers()]) |
|
152 | # exclude any figures that were closed: | |
151 | for fig in [ fig for fig in show._to_draw if fig in active ]: |
|
153 | active = set([fm.canvas.figure for fm in Gcf.get_all_fig_managers()]) | |
152 | send_figure(fig) |
|
154 | for fig in [ fig for fig in show._to_draw if fig in active ]: | |
153 | # clear flags for next round |
|
155 | send_figure(fig) | |
154 | show._to_draw = [] |
|
156 | finally: | |
155 | show._draw_called = False |
|
157 | # clear flags for next round | |
|
158 | show._to_draw = [] | |||
|
159 | show._draw_called = False | |||
156 |
|
160 | |||
157 |
|
161 | |||
158 | def send_figure(fig): |
|
162 | def send_figure(fig): |
General Comments 0
You need to be logged in to leave comments.
Login now