-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the WebGL backend #607
Comments
I think |
Hi @mfkaptan! |
Could we add a function like |
Add force option (default false) to `_prepare_js()` in `_ipynb_webgl`. If force is `true`, overwrite current files when installing nbextensions. If force is `false`, use `check_nbextension()` first to see whether if it is necessary to install. This commit is about issue vispy#607.
I have added |
@mfkaptan I haven't tested it yet but that looks good to me. |
Note to self: I would like to make the following possible. I create a VisPy SceneCanvas as usual (e.g. a line plot). Next, I want to easily create an IPython DOMWidget that:
Here is how it could work: Simple useWhen there is no need to create a custom IPython widget. import vispy
vispy.app.use_app('ipynb_webgl')
# create the SceneCanvas
canvas = ...
canvas.show() Advanced useimport vispy
from vispy import VispyWidget
from IPython.display import display
# create the SceneCanvas
canvas = ...
class MyWidget(VispyWidget):
"""This class makes the bridge between the VisPy canvas and the WebGL widget.
It exposes several trait attributes which notification callbacks can be customized.
A VispyWidget is instanciated with a Canvas instance. Displaying the widget shows the
WebGL version of the canvas.
VispyWidget derives from IPython's DOMWidget.
"""
# This trait attribute represent the line's color.
line_color = 'blue'
def on_trait_change(self, name, old, new):
if name == 'line_color':
self.canvas.myvisual.color = new
display(MyWidget(canvas)) |
Isn't this already possible just by implementing properties on the subclass, like
? |
Not exactly it really needs to be a trait attribute so that it works with IPython's MVC system. |
This looks very exciting. Thanks and keep up the great work. 😄 |
@dragoljub I think it's only supported on IPython version 3+, but that can be running Python 2.7 or 3.4 under the hood. |
Yup I got it working after I updated to 4.0. Thanks.
|
I think besides possibly the "fail gracefully" task, I think I finished all of these tasks in the 0.6 release. I still consider the jupyter widget experimental (performance is not great), but it "works". |
This is a list of things to do to improve the WebGL backend once PR #592 is merged.
JavaScript loading
vispy.min.js
) are copied into the IPython profile everytime theipynb_webgl
backend is used. We could do a simple check to only copy if necessary (unless IPython'sinstall_nbextension
already does that).vispy.js
Misc
Solve issue Using initialize with gloo #606 so that all examples work in the notebooktackle issue Implement a server-side GLIR cache #615.ipynb_webgl
so that other notebook backends can reuse most of the code (and bring back static and vnc).VispyWidget(DOMWidget)
(see comment below)The text was updated successfully, but these errors were encountered: