##// END OF EJS Templates
Rename InlineBackendConfig -> InlineBackend...
MinRK -
Show More
@@ -253,9 +253,9 b' def import_pylab(user_ns, backend, import_all=True, shell=None):'
253 # function that will pick up the results for display. This can only be
253 # function that will pick up the results for display. This can only be
254 # done with access to the real shell object.
254 # done with access to the real shell object.
255 #
255 #
256 from IPython.zmq.pylab.backend_inline import InlineBackendConfig
256 from IPython.zmq.pylab.backend_inline import InlineBackend
257
257
258 cfg = InlineBackendConfig.instance(config=shell.config)
258 cfg = InlineBackend.instance(config=shell.config)
259 cfg.shell = shell
259 cfg.shell = shell
260 if cfg not in shell.configurables:
260 if cfg not in shell.configurables:
261 shell.configurables.append(cfg)
261 shell.configurables.append(cfg)
@@ -18,13 +18,24 b' from IPython.config.configurable import SingletonConfigurable'
18 from IPython.core.displaypub import publish_display_data
18 from IPython.core.displaypub import publish_display_data
19 from IPython.lib.pylabtools import print_figure, select_figure_format
19 from IPython.lib.pylabtools import print_figure, select_figure_format
20 from IPython.utils.traitlets import Dict, Instance, CaselessStrEnum, CBool
20 from IPython.utils.traitlets import Dict, Instance, CaselessStrEnum, CBool
21 from IPython.utils.warn import warn
22
21 #-----------------------------------------------------------------------------
23 #-----------------------------------------------------------------------------
22 # Configurable for inline backend options
24 # Configurable for inline backend options
23 #-----------------------------------------------------------------------------
25 #-----------------------------------------------------------------------------
24
26 # inherit from InlineBackendConfig for deprecation purposes
25 class InlineBackendConfig(SingletonConfigurable):
27 class InlineBackendConfig(SingletonConfigurable):
28 pass
29
30 class InlineBackend(InlineBackendConfig):
26 """An object to store configuration of the inline backend."""
31 """An object to store configuration of the inline backend."""
27
32
33 def _config_changed(self, name, old, new):
34 # warn on change of renamed config section
35 if new.InlineBackendConfig != old.InlineBackendConfig:
36 warn("InlineBackendConfig has been renamed to InlineBackend")
37 super(InlineBackend, self)._config_changed(name, old, new)
38
28 # The typical default figure size is too large for inline use,
39 # The typical default figure size is too large for inline use,
29 # so we shrink the figure size to 6x4, and tweak fonts to
40 # so we shrink the figure size to 6x4, and tweak fonts to
30 # make that fit. This is configurable via Global.pylab_inline_rc,
41 # make that fit. This is configurable via Global.pylab_inline_rc,
@@ -83,7 +94,7 b' def show(close=None):'
83 removed from the internal list of figures.
94 removed from the internal list of figures.
84 """
95 """
85 if close is None:
96 if close is None:
86 close = InlineBackendConfig.instance().close_figures
97 close = InlineBackend.instance().close_figures
87 for figure_manager in Gcf.get_all_fig_managers():
98 for figure_manager in Gcf.get_all_fig_managers():
88 send_figure(figure_manager.canvas.figure)
99 send_figure(figure_manager.canvas.figure)
89 if close:
100 if close:
@@ -129,7 +140,7 b' def flush_figures():'
129 if not show._draw_called:
140 if not show._draw_called:
130 return
141 return
131
142
132 if InlineBackendConfig.instance().close_figures:
143 if InlineBackend.instance().close_figures:
133 # ignore the tracking, just draw and close all figures
144 # ignore the tracking, just draw and close all figures
134 return show(True)
145 return show(True)
135
146
@@ -149,7 +160,7 b' def send_figure(fig):'
149 # big blank spaces in the qt console
160 # big blank spaces in the qt console
150 if not fig.axes:
161 if not fig.axes:
151 return
162 return
152 fmt = InlineBackendConfig.instance().figure_format
163 fmt = InlineBackend.instance().figure_format
153 data = print_figure(fig, fmt)
164 data = print_figure(fig, fmt)
154 mimetypes = { 'png' : 'image/png', 'svg' : 'image/svg+xml' }
165 mimetypes = { 'png' : 'image/png', 'svg' : 'image/svg+xml' }
155 mime = mimetypes[fmt]
166 mime = mimetypes[fmt]
General Comments 0
You need to be logged in to leave comments. Login now