8000 Minor cleanups, ipython now handles draw_if_interactive properly with… · matplotlib/matplotlib@1ebd345 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1ebd345

Browse files
committed
Minor cleanups, ipython now handles draw_if_interactive properly without ugly pylab hacks.
svn path=/trunk/matplotlib/; revision=959
1 parent 3ba0a32 commit 1ebd345

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

lib/matplotlib/backends/__init__.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import sys
22
import matplotlib
33

4-
54
__all__ = ['backend','show','draw_if_interactive','error_msg',
65
'new_figure_manager', 'backend_version']
76

@@ -14,7 +13,6 @@
1413
if backend not in all_backends:
1514
raise ValueError, 'Unrecognized backend %s' % backend
1615

17-
1816
# Import the requested backend into a generic module object
1917
backend_name = 'backend_'+backend.lower()
2018
backend_mod = __import__('matplotlib.backends.'+backend_name,
@@ -27,23 +25,11 @@
2725
backend_version = getattr(backend_mod,'backend_version')
2826
else: backend_version = 'unknown'
2927

30-
3128
# Now define the public API according to the kind of backend in use
3229
if backend in interactive_bk:
3330
error_msg = backend_mod.error_msg
3431
show = backend_mod.show
35-
__draw_int = backend_mod.draw_if_interactive
36-
37-
# wrap draw_if_interactive with a flag which detects if it was called.
38-
# This allows tools like ipython to properly manage interactive scripts.
39-
# In python 2.4, this can be cleanly done with a simple decorator.
40-
def draw_if_interactive():
41-
draw_if_interactive._called = True
42-
__draw_int()
43-
# Flag to store state, so external callers (like ipython) can keep track
44-
# of draw calls.
45-
draw_if_interactive._called = False
46-
draw_if_interactive.__doc__ = __draw_int.__doc__
32+
draw_if_interactive = backend_mod.draw_if_interactive
4733
else: # non-interactive backends
4834
def draw_if_interactive(): pass
4935
def show(): pass
@@ -59,5 +45,4 @@ def error_msg(m):
5945
Toolbar = backend_mod.Toolbar
6046
__all__.append('Toolbar')
6147

62-
matplotlib.verbose.report('backend %s version %s' %
63-
(backend, backend_version))
48+
matplotlib.verbose.report('backend %s version %s' % (backend,backend_version))

0 commit comments

Comments
 (0)
0