mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
use config instead of App.instance to propagate notebook_dir
Should behave more logically (I hope).
This commit is contained in:
parent
f9e8824fef
commit
d37780c6a6
@ -530,6 +530,10 @@ class NotebookApp(BaseIPythonApplication):
|
||||
except:
|
||||
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):
|
||||
super(NotebookApp, self).parse_command_line(argv)
|
||||
|
@ -42,18 +42,6 @@ class MappingKernelManager(MultiKernelManager):
|
||||
kernel_argv = List(Unicode)
|
||||
|
||||
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):
|
||||
"""Do a bit of validation of the root dir."""
|
||||
|
@ -47,17 +47,6 @@ class FileNotebookManager(NotebookManager):
|
||||
"""
|
||||
)
|
||||
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):
|
||||
"""Do a bit of validation of the notebook dir."""
|
||||
|
Loading…
Reference in New Issue
Block a user