##// END OF EJS Templates
BUG: Make Shell use the new make_user_namespaces API.
Robert Kern -
Show More
@@ -510,7 +510,7 b' class MatplotlibShellBase:'
510 Given Python's MRO, this should be used as the FIRST class in the
510 Given Python's MRO, this should be used as the FIRST class in the
511 inheritance hierarchy, so that it overrides the relevant methods."""
511 inheritance hierarchy, so that it overrides the relevant methods."""
512
512
513 def _matplotlib_config(self,name,user_ns):
513 def _matplotlib_config(self,name,user_ns,user_global_ns=None):
514 """Return items needed to setup the user's shell with matplotlib"""
514 """Return items needed to setup the user's shell with matplotlib"""
515
515
516 # Initialize matplotlib to interactive mode always
516 # Initialize matplotlib to interactive mode always
@@ -564,7 +564,8 b' class MatplotlibShellBase:'
564 self.pylab.draw_if_interactive = flag_calls(self.pylab.draw_if_interactive)
564 self.pylab.draw_if_interactive = flag_calls(self.pylab.draw_if_interactive)
565
565
566 # Build a user namespace initialized with matplotlib/matlab features.
566 # Build a user namespace initialized with matplotlib/matlab features.
567 user_ns = IPython.ipapi.make_user_ns(user_ns)
567 user_ns, user_global_ns = IPython.ipapi.make_user_namespaces(user_ns,
568 user_global_ns)
568
569
569 # Import numpy as np/pyplot as plt are conventions we're trying to
570 # Import numpy as np/pyplot as plt are conventions we're trying to
570 # somewhat standardize on. Making them available to users by default
571 # somewhat standardize on. Making them available to users by default
@@ -584,7 +585,7 b' class MatplotlibShellBase:'
584 Welcome to pylab, a matplotlib-based Python environment.
585 Welcome to pylab, a matplotlib-based Python environment.
585 For more information, type 'help(pylab)'.
586 For more information, type 'help(pylab)'.
586 """
587 """
587 return user_ns,b
588 return user_ns,,user_global_ns,b
588
589
589 def mplot_exec(self,fname,*where,**kw):
590 def mplot_exec(self,fname,*where,**kw):
590 """Execute a matplotlib script.
591 """Execute a matplotlib script.
@@ -624,7 +625,7 b' class MatplotlibShell(MatplotlibShellBase,InteractiveShell):'
624
625
625 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
626 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
626 user_ns=None,user_global_ns=None,**kw):
627 user_ns=None,user_global_ns=None,**kw):
627 user_ns,b2 = self._matplotlib_config(name,user_ns)
628 user_ns,user_global_ns,b2 = self._matplotlib_config(name,user_ns,user_global_ns)
628 InteractiveShell.__init__(self,name,usage,rc,user_ns,user_global_ns,
629 InteractiveShell.__init__(self,name,usage,rc,user_ns,user_global_ns,
629 banner2=b2,**kw)
630 banner2=b2,**kw)
630
631
General Comments 0
You need to be logged in to leave comments. Login now