##// END OF EJS Templates
use config instead of App.instance to propagate notebook_dir...
MinRK -
Show More
@@ -530,6 +530,10 b' class NotebookApp(BaseIPythonApplication):'
530 except:
530 except:
531 raise TraitError("Couldn't create notebook dir %r" % new)
531 raise TraitError("Couldn't create notebook dir %r" % new)
532
532
533 # setting App.notebook_dir implies setting notebook and kernel dirs as well
534 self.config.FileNotebookManager.notebook_dir = new
535 self.config.MappingKernelManager.root_dir = new
536
533
537
534 def parse_command_line(self, argv=None):
538 def parse_command_line(self, argv=None):
535 super(NotebookApp, self).parse_command_line(argv)
539 super(NotebookApp, self).parse_command_line(argv)
@@ -42,18 +42,6 b' class MappingKernelManager(MultiKernelManager):'
42 kernel_argv = List(Unicode)
42 kernel_argv = List(Unicode)
43
43
44 root_dir = Unicode(getcwd(), config=True)
44 root_dir = Unicode(getcwd(), config=True)
45 def _root_dir_default(self):
46 from IPython.html.notebookapp import NotebookApp
47 if NotebookApp.initialized():
48 try:
49 app = NotebookApp.instance()
50 except Exception:
51 # can raise MultipleInstanceError, ignore
52 pass
53 else:
54 return app.notebook_dir
55 return app.notebook_dir
56 return getcwd()
57
45
58 def _root_dir_changed(self, name, old, new):
46 def _root_dir_changed(self, name, old, new):
59 """Do a bit of validation of the root dir."""
47 """Do a bit of validation of the root dir."""
@@ -47,17 +47,6 b' class FileNotebookManager(NotebookManager):'
47 """
47 """
48 )
48 )
49 notebook_dir = Unicode(getcwd(), config=True)
49 notebook_dir = Unicode(getcwd(), config=True)
50 def _notebook_dir_default(self):
51 from IPython.html.notebookapp import NotebookApp
52 if NotebookApp.initialized():
53 try:
54 app = NotebookApp.instance()
55 except Exception:
56 # can raise MultipleInstanceError, ignore
57 pass
58 else:
59 return app.notebook_dir
60 return getcwd()
61
50
62 def _notebook_dir_changed(self, name, old, new):
51 def _notebook_dir_changed(self, name, old, new):
63 """Do a bit of validation of the notebook dir."""
52 """Do a bit of validation of the notebook dir."""
General Comments 0
You need to be logged in to leave comments. Login now