Show More
@@ -344,11 +344,6 b' class NotebookApp(BaseIPythonApplication):' | |||
|
344 | 344 | |
|
345 | 345 | # file to be opened in the notebook server |
|
346 | 346 | file_to_run = Unicode('', config=True) |
|
347 | def _file_to_run_changed(self, name, old, new): | |
|
348 | path, base = os.path.split(new) | |
|
349 | if path: | |
|
350 | self.file_to_run = base | |
|
351 | self.notebook_dir = path | |
|
352 | 347 | |
|
353 | 348 | # Network related information |
|
354 | 349 | |
@@ -627,10 +622,6 b' class NotebookApp(BaseIPythonApplication):' | |||
|
627 | 622 | info_file = "nbserver-%s.json"%os.getpid() |
|
628 | 623 | return os.path.join(self.profile_dir.security_dir, info_file) |
|
629 | 624 | |
|
630 | notebook_dir = Unicode(py3compat.getcwd(), config=True, | |
|
631 | help="The directory to use for notebooks and kernels." | |
|
632 | ) | |
|
633 | ||
|
634 | 625 | pylab = Unicode('disabled', config=True, |
|
635 | 626 | help=""" |
|
636 | 627 | DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib. |
@@ -648,6 +639,16 b' class NotebookApp(BaseIPythonApplication):' | |||
|
648 | 639 | ) |
|
649 | 640 | self.exit(1) |
|
650 | 641 | |
|
642 | notebook_dir = Unicode(config=True, | |
|
643 | help="The directory to use for notebooks and kernels." | |
|
644 | ) | |
|
645 | ||
|
646 | def _notebook_dir_default(self): | |
|
647 | if self.file_to_run: | |
|
648 | return os.path.dirname(os.path.abspath(self.file_to_run)) | |
|
649 | else: | |
|
650 | return py3compat.getcwd() | |
|
651 | ||
|
651 | 652 | def _notebook_dir_changed(self, name, old, new): |
|
652 | 653 | """Do a bit of validation of the notebook dir.""" |
|
653 | 654 | if not os.path.isabs(new): |
@@ -942,12 +943,12 b' class NotebookApp(BaseIPythonApplication):' | |||
|
942 | 943 | browser = None |
|
943 | 944 | |
|
944 | 945 | if self.file_to_run: |
|
945 |
f |
|
|
946 | if not os.path.exists(fullpath): | |
|
947 | self.log.critical("%s does not exist" % fullpath) | |
|
946 | if not os.path.exists(self.file_to_run): | |
|
947 | self.log.critical("%s does not exist" % self.file_to_run) | |
|
948 | 948 | self.exit(1) |
|
949 | 949 | |
|
950 | uri = url_path_join('notebooks', self.file_to_run) | |
|
950 | relpath = os.path.relpath(self.file_to_run, self.notebook_dir) | |
|
951 | uri = url_path_join('notebooks', *relpath.split(os.sep)) | |
|
951 | 952 | else: |
|
952 | 953 | uri = 'tree' |
|
953 | 954 | if browser: |
@@ -23,7 +23,13 b' from IPython.html.utils import is_hidden, to_os_path, url_path_join' | |||
|
23 | 23 | |
|
24 | 24 | class FileContentsManager(ContentsManager): |
|
25 | 25 | |
|
26 |
root_dir = Unicode( |
|
|
26 | root_dir = Unicode(config=True) | |
|
27 | ||
|
28 | def _root_dir_default(self): | |
|
29 | try: | |
|
30 | return self.parent.notebook_dir | |
|
31 | except AttributeError: | |
|
32 | return getcwd() | |
|
27 | 33 | |
|
28 | 34 | save_script = Bool(False, config=True, help='DEPRECATED, IGNORED') |
|
29 | 35 | def _save_script_changed(self): |
@@ -12,7 +12,7 b' import os' | |||
|
12 | 12 | from tornado import web |
|
13 | 13 | |
|
14 | 14 | from IPython.kernel.multikernelmanager import MultiKernelManager |
|
15 | from IPython.utils.traitlets import Unicode, TraitError | |
|
15 | from IPython.utils.traitlets import List, Unicode, TraitError | |
|
16 | 16 | |
|
17 | 17 | from IPython.html.utils import to_os_path |
|
18 | 18 | from IPython.utils.py3compat import getcwd |
@@ -24,7 +24,15 b' class MappingKernelManager(MultiKernelManager):' | |||
|
24 | 24 | def _kernel_manager_class_default(self): |
|
25 | 25 | return "IPython.kernel.ioloop.IOLoopKernelManager" |
|
26 | 26 | |
|
27 | root_dir = Unicode(getcwd(), config=True) | |
|
27 | kernel_argv = List(Unicode) | |
|
28 | ||
|
29 | root_dir = Unicode(config=True) | |
|
30 | ||
|
31 | def _root_dir_default(self): | |
|
32 | try: | |
|
33 | return self.parent.notebook_dir | |
|
34 | except AttributeError: | |
|
35 | return getcwd() | |
|
28 | 36 | |
|
29 | 37 | def _root_dir_changed(self, name, old, new): |
|
30 | 38 | """Do a bit of validation of the root dir.""" |
General Comments 0
You need to be logged in to leave comments.
Login now