From 84cb7c311a910cd91d093cd17ca1f553fc67faa2 2011-09-11 16:45:24 From: Jens Hedegaard Nielsen Date: 2011-09-11 16:45:24 Subject: [PATCH] Make import_all configurable in InteractiveShellApp --- diff --git a/IPython/core/shellapp.py b/IPython/core/shellapp.py index 5f6d2a4..99ebbd2 100755 --- a/IPython/core/shellapp.py +++ b/IPython/core/shellapp.py @@ -29,7 +29,7 @@ from IPython.config.application import boolean_flag from IPython.config.configurable import Configurable from IPython.config.loader import Config from IPython.utils.path import filefind -from IPython.utils.traitlets import Unicode, Instance, List +from IPython.utils.traitlets import Unicode, Instance, List, Bool #----------------------------------------------------------------------------- # Aliases and Flags @@ -133,6 +133,10 @@ class InteractiveShellApp(Configurable): code_to_run = Unicode('', config=True, help="Execute the given command string." ) + pylab_import_all = Bool(True, config=True, + help="""If true, an 'import *' is done from numpy and pylab, + when using pylab""" + ) shell = Instance('IPython.core.interactiveshell.InteractiveShellABC') def init_shell(self): diff --git a/IPython/frontend/terminal/ipapp.py b/IPython/frontend/terminal/ipapp.py index 6f129c9..1840f96 100755 --- a/IPython/frontend/terminal/ipapp.py +++ b/IPython/frontend/terminal/ipapp.py @@ -346,7 +346,10 @@ class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp): try: self.log.info("Enabling GUI event loop integration, " "toolkit=%s, pylab=%s" % (gui, self.pylab) ) - activate(gui) + if self.pylab: + activate(gui, import_all=self.pylab_import_all) + else: + activate(gui) except: self.log.warn("Error in enabling GUI event loop integration:") self.shell.showtraceback() diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 692e324..264d6b1 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -623,10 +623,6 @@ class IPKernelApp(KernelApp, InteractiveShellApp): selecting a particular matplotlib backend and loop integration. """ ) - pylab_import_all = Bool(True, config=True, - help="""If true, an 'import *' is done from numpy and pylab, - when using pylab""" - ) def initialize(self, argv=None): super(IPKernelApp, self).initialize(argv) self.init_shell()