Show More
@@ -5,6 +5,7 b'' | |||||
5 | # Distributed under the terms of the Modified BSD License. |
|
5 | # Distributed under the terms of the Modified BSD License. | |
6 |
|
6 | |||
7 | from __future__ import print_function |
|
7 | from __future__ import print_function | |
|
8 | ||||
8 | import errno |
|
9 | import errno | |
9 | import io |
|
10 | import io | |
10 | import json |
|
11 | import json | |
@@ -60,14 +61,12 b' from .base.handlers import AuthenticatedFileHandler, FileFindHandler' | |||||
60 |
|
61 | |||
61 | from IPython.config import Config |
|
62 | from IPython.config import Config | |
62 | from IPython.config.application import catch_config_error, boolean_flag |
|
63 | from IPython.config.application import catch_config_error, boolean_flag | |
63 |
from IPython.core.application import |
|
64 | from IPython.core.application import ( | |
64 | from IPython.core.profiledir import ProfileDir |
|
65 | BaseIPythonApplication, base_flags, base_aliases, | |
65 | from IPython.consoleapp import IPythonConsoleApp |
|
|||
66 | from IPython.kernel.zmq.session import default_secure |
|
|||
67 | from IPython.kernel.zmq.kernelapp import ( |
|
|||
68 | kernel_flags, |
|
|||
69 | kernel_aliases, |
|
|||
70 | ) |
|
66 | ) | |
|
67 | from IPython.core.profiledir import ProfileDir | |||
|
68 | from IPython.kernel import KernelManager | |||
|
69 | from IPython.kernel.zmq.session import default_secure, Session | |||
71 | from IPython.nbformat.sign import NotebookNotary |
|
70 | from IPython.nbformat.sign import NotebookNotary | |
72 | from IPython.utils.importstring import import_item |
|
71 | from IPython.utils.importstring import import_item | |
73 | from IPython.utils import submodule |
|
72 | from IPython.utils import submodule | |
@@ -232,11 +231,15 b' class NbserverListApp(BaseIPythonApplication):' | |||||
232 | # Aliases and Flags |
|
231 | # Aliases and Flags | |
233 | #----------------------------------------------------------------------------- |
|
232 | #----------------------------------------------------------------------------- | |
234 |
|
233 | |||
235 |
flags = dict( |
|
234 | flags = dict(base_flags) | |
236 | flags['no-browser']=( |
|
235 | flags['no-browser']=( | |
237 | {'NotebookApp' : {'open_browser' : False}}, |
|
236 | {'NotebookApp' : {'open_browser' : False}}, | |
238 | "Don't open the notebook in a browser after startup." |
|
237 | "Don't open the notebook in a browser after startup." | |
239 | ) |
|
238 | ) | |
|
239 | flags['pylab']=( | |||
|
240 | {'NotebookApp' : {'pylab' : 'warn'}}, | |||
|
241 | "DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib." | |||
|
242 | ) | |||
240 | flags['no-mathjax']=( |
|
243 | flags['no-mathjax']=( | |
241 | {'NotebookApp' : {'enable_mathjax' : False}}, |
|
244 | {'NotebookApp' : {'enable_mathjax' : False}}, | |
242 | """Disable MathJax |
|
245 | """Disable MathJax | |
@@ -254,12 +257,7 b" flags.update(boolean_flag('script', 'FileNotebookManager.save_script'," | |||||
254 | 'Auto-save a .py script everytime the .ipynb notebook is saved', |
|
257 | 'Auto-save a .py script everytime the .ipynb notebook is saved', | |
255 | 'Do not auto-save .py scripts for every notebook')) |
|
258 | 'Do not auto-save .py scripts for every notebook')) | |
256 |
|
259 | |||
257 | # the flags that are specific to the frontend |
|
260 | aliases = dict(base_aliases) | |
258 | # these must be scrubbed before being passed to the kernel, |
|
|||
259 | # or it will raise an error on unrecognized flags |
|
|||
260 | notebook_flags = ['no-browser', 'no-mathjax', 'script', 'no-script'] |
|
|||
261 |
|
||||
262 | aliases = dict(kernel_aliases) |
|
|||
263 |
|
261 | |||
264 | aliases.update({ |
|
262 | aliases.update({ | |
265 | 'ip': 'NotebookApp.ip', |
|
263 | 'ip': 'NotebookApp.ip', | |
@@ -270,15 +268,9 b' aliases.update({' | |||||
270 | 'certfile': 'NotebookApp.certfile', |
|
268 | 'certfile': 'NotebookApp.certfile', | |
271 | 'notebook-dir': 'NotebookApp.notebook_dir', |
|
269 | 'notebook-dir': 'NotebookApp.notebook_dir', | |
272 | 'browser': 'NotebookApp.browser', |
|
270 | 'browser': 'NotebookApp.browser', | |
|
271 | 'pylab': 'NotebookApp.pylab', | |||
273 | }) |
|
272 | }) | |
274 |
|
273 | |||
275 | # remove ipkernel flags that are singletons, and don't make sense in |
|
|||
276 | # multi-kernel evironment: |
|
|||
277 | aliases.pop('f', None) |
|
|||
278 |
|
||||
279 | notebook_aliases = [u'port', u'port-retries', u'ip', u'keyfile', u'certfile', |
|
|||
280 | u'notebook-dir', u'profile', u'profile-dir', 'browser'] |
|
|||
281 |
|
||||
282 | #----------------------------------------------------------------------------- |
|
274 | #----------------------------------------------------------------------------- | |
283 | # NotebookApp |
|
275 | # NotebookApp | |
284 | #----------------------------------------------------------------------------- |
|
276 | #----------------------------------------------------------------------------- | |
@@ -294,9 +286,13 b' class NotebookApp(BaseIPythonApplication):' | |||||
294 | HTML5/Javascript Notebook client. |
|
286 | HTML5/Javascript Notebook client. | |
295 | """ |
|
287 | """ | |
296 | examples = _examples |
|
288 | examples = _examples | |
|
289 | aliases = aliases | |||
|
290 | flags = flags | |||
297 |
|
291 | |||
298 | classes = IPythonConsoleApp.classes + [MappingKernelManager, NotebookManager, |
|
292 | classes = [ | |
299 | FileNotebookManager, NotebookNotary] |
|
293 | KernelManager, ProfileDir, Session, MappingKernelManager, | |
|
294 | NotebookManager, FileNotebookManager, NotebookNotary, | |||
|
295 | ] | |||
300 | flags = Dict(flags) |
|
296 | flags = Dict(flags) | |
301 | aliases = Dict(aliases) |
|
297 | aliases = Dict(aliases) | |
302 |
|
298 | |||
@@ -508,6 +504,22 b' class NotebookApp(BaseIPythonApplication):' | |||||
508 | notebook_dir = Unicode(py3compat.getcwd(), config=True, |
|
504 | notebook_dir = Unicode(py3compat.getcwd(), config=True, | |
509 | help="The directory to use for notebooks and kernels." |
|
505 | help="The directory to use for notebooks and kernels." | |
510 | ) |
|
506 | ) | |
|
507 | ||||
|
508 | pylab = Unicode('disabled', config=True, | |||
|
509 | help=""" | |||
|
510 | DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib. | |||
|
511 | """ | |||
|
512 | ) | |||
|
513 | def _pylab_changed(self, name, old, new): | |||
|
514 | """when --pylab is specified, display a warning and ignore the value""" | |||
|
515 | if new != 'warn': | |||
|
516 | backend = ' %s' % new | |||
|
517 | else: | |||
|
518 | backend = '' | |||
|
519 | self.log.warn("Support for specifying --pylab on the command line has been removed.") | |||
|
520 | self.log.warn( | |||
|
521 | "Please use `%pylab{0}` or `%matplotlib{0}` in the notebook itself.".format(backend) | |||
|
522 | ) | |||
511 |
|
523 | |||
512 | def _notebook_dir_changed(self, name, old, new): |
|
524 | def _notebook_dir_changed(self, name, old, new): | |
513 | """Do a bit of validation of the notebook dir.""" |
|
525 | """Do a bit of validation of the notebook dir.""" |
General Comments 0
You need to be logged in to leave comments.
Login now