##// END OF EJS Templates
Fix %pylab magic....
Fernando Perez -
Show More
@@ -2004,9 +2004,9 class InteractiveShell(SingletonConfigurable):
2004 2004 self.function_as_magic = self.magics_manager.function_as_magic
2005 2005 self.define_magic = self.magics_manager._define_magic
2006 2006
2007 self.register_magics(mf.BasicMagics, mf.CodeMagics,
2008 mf.ConfigMagics, mf.NamespaceMagics, mf.ExecutionMagics,
2009 mf.AutoMagics, mf.OSMagics, mf.LoggingMagics, mf.ExtensionsMagics,
2007 self.register_magics(mf.BasicMagics, mf.CodeMagics, mf.ConfigMagics,
2008 mf.ExecutionMagics, mf.NamespaceMagics, mf.AutoMagics,
2009 mf.OSMagics, mf.LoggingMagics, mf.ExtensionsMagics,
2010 2010 mf.PylabMagics, mf.DeprecatedMagics)
2011 2011
2012 2012 # FIXME: Move the color initialization to the DisplayHook, which
@@ -2695,7 +2695,8 class InteractiveShell(SingletonConfigurable):
2695 2695 # Now we must activate the gui pylab wants to use, and fix %run to take
2696 2696 # plot updates into account
2697 2697 self.enable_gui(gui)
2698 self._magic.default_runner = mpl_runner(self.safe_execfile)
2698 self.magics_manager.registry['ExecutionMagics'].default_runner = \
2699 mpl_runner(self.safe_execfile)
2699 2700
2700 2701 #-------------------------------------------------------------------------
2701 2702 # Utilities
@@ -144,8 +144,15 class MagicsManager(Configurable):
144 144 """Object that handles all magic-related functionality for IPython.
145 145 """
146 146 # Non-configurable class attributes
147
148 # A two-level dict, first keyed by magic type, then by magic function, and
149 # holding the actual callable object as value. This is the dict used for
150 # magic function dispatch
147 151 magics = Dict
148 152
153 # A registry of the original objects that we've been given holding magics.
154 registry = Dict
155
149 156 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC')
150 157
151 158 auto_magic = Bool
@@ -161,6 +168,9 class MagicsManager(Configurable):
161 168 super(MagicsManager, self).__init__(shell=shell, config=config,
162 169 user_magics=user_magics, **traits)
163 170 self.magics = dict(line={}, cell={})
171 # Let's add the user_magics to the registry for uniformity, so *all*
172 # registered magic containers can be found there.
173 self.registry[user_magics.__class__.__name__] = user_magics
164 174
165 175 def auto_status(self):
166 176 """Return descriptive string with automagic status."""
@@ -187,6 +197,9 class MagicsManager(Configurable):
187 197 # If we're given an uninstantiated class
188 198 m = m(self.shell)
189 199
200 # Now that we have an instance, we can register it and update the
201 # table of callables
202 self.registry[m.__class__.__name__] = m
190 203 for mtype in magic_types:
191 204 self.magics[mtype].update(m.magics[mtype])
192 205
General Comments 0
You need to be logged in to leave comments. Login now