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