Show More
@@ -257,6 +257,9 b' class NotebookApp(BaseIPythonApplication):' | |||||
257 | # create requested profiles by default, if they don't exist: |
|
257 | # create requested profiles by default, if they don't exist: | |
258 | auto_create = Bool(True) |
|
258 | auto_create = Bool(True) | |
259 |
|
259 | |||
|
260 | # file to be opened in the notebook server | |||
|
261 | file_to_run = Unicode('') | |||
|
262 | ||||
260 | # Network related information. |
|
263 | # Network related information. | |
261 |
|
264 | |||
262 | ip = Unicode(LOCALHOST, config=True, |
|
265 | ip = Unicode(LOCALHOST, config=True, | |
@@ -376,6 +379,10 b' class NotebookApp(BaseIPythonApplication):' | |||||
376 | # Kernel should inherit default config file from frontend |
|
379 | # Kernel should inherit default config file from frontend | |
377 | self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name) |
|
380 | self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name) | |
378 |
|
381 | |||
|
382 | if self.extra_args: | |||
|
383 | self.file_to_run = os.path.abspath(self.extra_args[0]) | |||
|
384 | self.config.NotebookManager.notebook_dir = os.path.dirname(self.file_to_run) | |||
|
385 | ||||
379 | def init_configurables(self): |
|
386 | def init_configurables(self): | |
380 | # force Session default to be secure |
|
387 | # force Session default to be secure | |
381 | default_secure(self.config) |
|
388 | default_secure(self.config) | |
@@ -524,9 +531,20 b' class NotebookApp(BaseIPythonApplication):' | |||||
524 | browser = webbrowser.get(self.browser) |
|
531 | browser = webbrowser.get(self.browser) | |
525 | else: |
|
532 | else: | |
526 | browser = webbrowser.get() |
|
533 | browser = webbrowser.get() | |
527 | b = lambda : browser.open("%s://%s:%i%s" % (proto, ip, self.port, |
|
534 | ||
528 | self.base_project_url), |
|
535 | if self.file_to_run: | |
529 | new=2) |
|
536 | filename, _ = os.path.splitext(os.path.basename(self.file_to_run)) | |
|
537 | for nb in self.notebook_manager.list_notebooks(): | |||
|
538 | if filename == nb['name']: | |||
|
539 | url = nb['notebook_id'] | |||
|
540 | break | |||
|
541 | else: | |||
|
542 | url = '' | |||
|
543 | else: | |||
|
544 | url = '' | |||
|
545 | b = lambda : browser.open("%s://%s:%i%s%s" % (proto, ip, | |||
|
546 | self.port, self.base_project_url, url), | |||
|
547 | new=2) | |||
530 | threading.Thread(target=b).start() |
|
548 | threading.Thread(target=b).start() | |
531 | try: |
|
549 | try: | |
532 | ioloop.IOLoop.instance().start() |
|
550 | ioloop.IOLoop.instance().start() |
General Comments 0
You need to be logged in to leave comments.
Login now