Source code for openmdao.utils.webview

"""Define some functions to view Web pages."""
import sys
import os
import webbrowser


[docs]def webview(outfile): """ Pop up a web browser for the given file. Parameters ---------- outfile : str Path to the HTML file to open. """ if sys.platform == 'darwin': if not outfile.startswith('file://'): outfile = 'file://' + os.path.abspath(outfile) webbrowser.get().open(outfile)
[docs]def webview_argv(): """ Provide a convenient way to pop up a browser to view a specified html file(s). This is tied to a console script called webview. """ for name in sys.argv[1:]: if os.path.isfile(name): webview(name)