Skip to content

Commit

Permalink
Replace startup prints with warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-wieser committed Dec 8, 2019
1 parent 2c09591 commit 43da07d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pyganja/script_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from multiprocessing import Process
import hashlib
import webbrowser
import warnings

from .GanjaScene import GanjaScene

Expand All @@ -14,15 +15,19 @@
from .cefwindow import *
CEFAVAILABLE = True
except:
print('Failed to import cef_gui, cef functions will be unavailable')
warnings.warn(
'Failed to import cef_gui, cef functions will be unavailable',
stacklevel=2)

JUPYTERAVAILABLE = False
try:
from IPython.display import display, Javascript
from IPython import get_ipython
JUPYTERAVAILABLE = True
except:
print('Failed to import ipython, notebook rendering will be unavailable')
warnings.warn(
'Failed to import ipython, notebook rendering will be unavailable',
stacklevel=2)


def html_to_data_uri(html):
Expand Down Expand Up @@ -81,7 +86,8 @@ def generate_notebook_js(script_json, sig=None, grid=True, scale=1.0, gl=True):
data = data.map(x=>x.length==opts.mv_length?new Element(x):x);
// add the graph to the page.
canvas = this.graph(data, {gl: opts.gl, conformal: opts.conformal, grid: opts.grid, scale: opts.scale, useUnnaturalLineDisplayForPointPairs: true});
canvas.options.h = h; canvas.options.p = p;
canvas.options.h = h;
canvas.options.p = p;
// make it big.
canvas.style.width = '100%';
canvas.style.height = '50vh';
Expand All @@ -106,6 +112,7 @@ def generate_notebook_js(script_json, sig=None, grid=True, scale=1.0, gl=True):
a.onclick = screenshot
var butnelem = element.append(a);
});
})(element);
"""
else:
Expand Down

0 comments on commit 43da07d

Please sign in to comment.