Show More
@@ -22,6 +22,7 b' import os' | |||
|
22 | 22 | import signal |
|
23 | 23 | import socket |
|
24 | 24 | import sys |
|
25 | import webbrowser | |
|
25 | 26 | |
|
26 | 27 | import zmq |
|
27 | 28 | |
@@ -51,7 +52,7 b' from IPython.zmq.ipkernel import (' | |||
|
51 | 52 | aliases as ipkernel_aliases, |
|
52 | 53 | IPKernelApp |
|
53 | 54 | ) |
|
54 | from IPython.utils.traitlets import Dict, Unicode, Int, List, Enum | |
|
55 | from IPython.utils.traitlets import Dict, Unicode, Int, List, Enum, Bool | |
|
55 | 56 | |
|
56 | 57 | #----------------------------------------------------------------------------- |
|
57 | 58 | # Module globals |
@@ -111,11 +112,15 b' class NotebookWebApplication(web.Application):' | |||
|
111 | 112 | #----------------------------------------------------------------------------- |
|
112 | 113 | |
|
113 | 114 | flags = dict(ipkernel_flags) |
|
115 | flags['no-browser']=( | |
|
116 | {'IPythonNotebookApp' : {'open_browser' : False}}, | |
|
117 | "Don't open the notebook in a browser after startup." | |
|
118 | ) | |
|
114 | 119 | |
|
115 | 120 | # the flags that are specific to the frontend |
|
116 | 121 | # these must be scrubbed before being passed to the kernel, |
|
117 | 122 | # or it will raise an error on unrecognized flags |
|
118 | notebook_flags = [] | |
|
123 | notebook_flags = ['no-browser'] | |
|
119 | 124 | |
|
120 | 125 | aliases = dict(ipkernel_aliases) |
|
121 | 126 | |
@@ -195,6 +200,9 b' class IPythonNotebookApp(BaseIPythonApplication):' | |||
|
195 | 200 | password = Unicode(u'', config=True, |
|
196 | 201 | help="""Password to use for web authentication""" |
|
197 | 202 | ) |
|
203 | ||
|
204 | open_browser = Bool(True, config=True, | |
|
205 | help="Whether to open in a browser after starting.") | |
|
198 | 206 | |
|
199 | 207 | def get_ws_url(self): |
|
200 | 208 | """Return the WebSocket URL for this server.""" |
@@ -291,6 +299,9 b' class IPythonNotebookApp(BaseIPythonApplication):' | |||
|
291 | 299 | self.log.info("The IPython Notebook is running at: %s://%s:%i" % (proto, |
|
292 | 300 | ip, |
|
293 | 301 | self.port)) |
|
302 | if self.open_browser: | |
|
303 | ip = self.ip or '127.0.0.1' | |
|
304 | webbrowser.open("%s://%s:%i" % (proto, ip, self.port), new=2) | |
|
294 | 305 | ioloop.IOLoop.instance().start() |
|
295 | 306 | |
|
296 | 307 | #----------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now