def _serve_prod(data, host, port, no_open, logging): view_url = util.local_server_url(host, port) if not no_open: try: util.open_url(view_url) except util.URLOpenError: sys.stdout.write("Unable to open browser window for Guild View\n") sys.stdout.write("Running Guild View at {}\n".format(view_url)) _start_view(data, host, port, logging) sys.stdout.write("\n")
def _handle_default(hiplot, data): with util.TempDir("guild-compare-") as tmp: csv_path = _hiplot_data_path(tmp.path) _write_hiplot_data(data, csv_path) html_path = _hiplot_html_path(tmp.path) _generate_hiplot_html(hiplot, csv_path, html_path) cli.out("Opening %s" % html_path, err=True) util.open_url(html_path) cli.out("To return to the prompt, press Ctrl-C", err=True) _wait_forever()
def _serve_dev(data, host, port, no_open, logging): view_port = util.free_port(port + 1) dev_server = DevServer(host, port, view_port) dev_server.start() dev_server.wait_for_ready() view_url = util.local_server_url(host, view_port) if not no_open: util.open_url(util.local_server_url(host, port)) sys.stdout.write(" I Guild View backend: {}\n".format(view_url)) _start_view(data, host, view_port, logging) sys.stdout.write("\n")
def _open_url(url): util.open_url(url)
def f(url): if args.tab: url += "#" + args.tab util.open_url(url)