1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""Entry point for vispy's IPython bindings"""
from distutils.version import LooseVersion
def load_ipython_extension(ipython):
""" Entry point of the IPython extension
Parameters
----------
ipython : IPython interpreter
An instance of the IPython interpreter that is handed
over to the extension
"""
import IPython
# don't continue if IPython version is < 3.0
ipy_version = LooseVersion(IPython.__version__)
if ipy_version < LooseVersion("3.0.0"):
ipython.write_err("Your IPython version is older than "
"version 3.0.0, the minimum for Vispy's"
"IPython backend. Please upgrade your IPython"
"version.")
return
_load_webgl_backend(ipython)
def _load_webgl_backend(ipython):
""" Load the webgl backend for the ipython notebook"""
from .. import app
app_instance = app.use_app("ipynb_webgl")
if app_instance.backend_name == "ipynb_webgl":
ipython.write("Vispy IPython module has loaded successfully")
else:
# TODO: Improve this error message
ipython.write_err("Unable to load webgl backend of Vispy")
def unload_ipython_extension(ipython):
""" Unload the ipython extension
Parameters
----------
ipython : IPython interpreter
An instance of the IPython interpreter that is handed
over to the extension
"""
pass
|