use config instead of App.instance to propagate notebook_dir

Should behave more logically (I hope).
This commit is contained in:
MinRK 2014-02-12 23:34:04 -08:00
parent f9e8824fef
commit d37780c6a6
3 changed files with 4 additions and 23 deletions

View File

@ -530,6 +530,10 @@ class NotebookApp(BaseIPythonApplication):
except: except:
raise TraitError("Couldn't create notebook dir %r" % new) raise TraitError("Couldn't create notebook dir %r" % new)
# setting App.notebook_dir implies setting notebook and kernel dirs as well
self.config.FileNotebookManager.notebook_dir = new
self.config.MappingKernelManager.root_dir = new
def parse_command_line(self, argv=None): def parse_command_line(self, argv=None):
super(NotebookApp, self).parse_command_line(argv) super(NotebookApp, self).parse_command_line(argv)

View File

@ -42,18 +42,6 @@ class MappingKernelManager(MultiKernelManager):
kernel_argv = List(Unicode) kernel_argv = List(Unicode)
root_dir = Unicode(getcwd(), config=True) root_dir = Unicode(getcwd(), config=True)
def _root_dir_default(self):
from IPython.html.notebookapp import NotebookApp
if NotebookApp.initialized():
try:
app = NotebookApp.instance()
except Exception:
# can raise MultipleInstanceError, ignore
pass
else:
return app.notebook_dir
return app.notebook_dir
return getcwd()
def _root_dir_changed(self, name, old, new): def _root_dir_changed(self, name, old, new):
"""Do a bit of validation of the root dir.""" """Do a bit of validation of the root dir."""

View File

@ -47,17 +47,6 @@ class FileNotebookManager(NotebookManager):
""" """
) )
notebook_dir = Unicode(getcwd(), config=True) notebook_dir = Unicode(getcwd(), config=True)
def _notebook_dir_default(self):
from IPython.html.notebookapp import NotebookApp
if NotebookApp.initialized():
try:
app = NotebookApp.instance()
except Exception:
# can raise MultipleInstanceError, ignore
pass
else:
return app.notebook_dir
return getcwd()
def _notebook_dir_changed(self, name, old, new): def _notebook_dir_changed(self, name, old, new):
"""Do a bit of validation of the notebook dir.""" """Do a bit of validation of the notebook dir."""