diff --git a/examples/Examples.ipynb b/examples/Examples.ipynb index 76ceebf2..893e26a3 100644 --- a/examples/Examples.ipynb +++ b/examples/Examples.ipynb @@ -185,7 +185,7 @@ "size = int(32) # size of image\n", "im = np.zeros((size,size)) # create zero image\n", "points = size*np.random.random((2, n**2)) # locations of seed values\n", - "im[(points[0]).astype(np.int), (points[1]).astype(np.int)] = size # seed high values\n", + "im[(points[0]).astype(np.int32), (points[1]).astype(np.int32)] = size # seed high values\n", "im = ndimage.gaussian_filter(im, sigma=size/(float(4)*n)) # smooth high values into surrounding areas\n", "im *= 1/np.max(im)# rescale to be in the range [0,1]\n", "rgba_im = img_as_ubyte(jet(im)) # convert the values to rgba image using the jet colormap\n", diff --git a/examples/Picker.ipynb b/examples/Picker.ipynb index bc85ddd0..0c8f063c 100644 --- a/examples/Picker.ipynb +++ b/examples/Picker.ipynb @@ -224,7 +224,7 @@ "scene.add(hover_point)\n", "\n", "# Have sphere follow picker point:\n", - "jslink((hover_point, 'position'), (hover_picker, 'point'))" + "jslink((hover_point, 'position'), (hover_picker, 'point'));" ] }, { @@ -254,7 +254,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Next, we set up a picker for when the user double clikcs on the surface. This should trigger the execution and visualization of the alogrithm." + "Finally, we set up a picker for when the user double clikcs on the surface. This should trigger the execution and visualization of the alogrithm." ] }, { diff --git a/examples/Shadows.ipynb b/examples/Shadows.ipynb index 2ea744e8..fa8a0295 100644 --- a/examples/Shadows.ipynb +++ b/examples/Shadows.ipynb @@ -244,7 +244,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Here, we can see that there is some pixelation of the shadows (although it is smoothed by using `PCFSoftShadowMap`). This can be fixed by increasing the resolution of the shadow map:" + "Here, we can see that there is some pixelation of the shadows (although it is smoothed by using `PCFSoftShadowMap`). This can be adjusted by increasing the resolution of the shadow map:" ] }, { diff --git a/examples/superellipsoid.ipynb b/examples/superellipsoid.ipynb index 65abae58..23245bbe 100644 --- a/examples/superellipsoid.ipynb +++ b/examples/superellipsoid.ipynb @@ -114,13 +114,13 @@ "outputs": [], "source": [ "from pythreejs import *\n", - "from ipydatawidgets import ConstrainedNDArrayWidget\n", + "from ipydatawidgets import create_constrained_arraywidget \n", "from IPython.display import display\n", "\n", "view_width = 600\n", "view_height = 400\n", "\n", - "coordinate_widget = ConstrainedNDArrayWidget(dtype='float32')(array=coords)\n", + "coordinate_widget = create_constrained_arraywidget(dtype='float32')(array=coords)\n", "\n", "surf_g = BufferGeometry(attributes=dict(\n", " position=BufferAttribute(coordinate_widget),\n", diff --git a/examples/threejs/voxel_painter.ipynb b/examples/threejs/voxel_painter.ipynb index 17cc9f89..933666f0 100644 --- a/examples/threejs/voxel_painter.ipynb +++ b/examples/threejs/voxel_painter.ipynb @@ -21,15 +21,6 @@ " - Delete voxel when shift-clicked" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from __future__ import division, print_function" - ] - }, { "cell_type": "code", "execution_count": null, diff --git a/js/scripts/templates/py_top_level_init.mustache b/js/scripts/templates/py_top_level_init.mustache index f4957d37..4556dfbc 100644 --- a/js/scripts/templates/py_top_level_init.mustache +++ b/js/scripts/templates/py_top_level_init.mustache @@ -2,8 +2,6 @@ # This file automatically generated by {{ generateScriptName }} # -from __future__ import absolute_import - {{#each modules as |module|}} from {{ module.pyRelativePath }} import * {{/each}} diff --git a/js/src/_base/Renderable.js b/js/src/_base/Renderable.js index a5695ff4..38e67d02 100644 --- a/js/src/_base/Renderable.js +++ b/js/src/_base/Renderable.js @@ -427,6 +427,10 @@ class RenderableView extends widgets.DOMWidgetView { this.updateSize(); + // We need to ensure that renderer properties are applied + // (we have no idea where the renderer has been...) + this.updateProperties(true); + this.debug('ThreeView.acquireRenderer(' + this.renderer.poolId + ')'); } diff --git a/js/src/_base/Three.js b/js/src/_base/Three.js index 7f09d79c..10a260c2 100644 --- a/js/src/_base/Three.js +++ b/js/src/_base/Three.js @@ -440,7 +440,7 @@ class ThreeModel extends widgets.WidgetModel { toSet[propName] = converterFn.bind(this)(this.obj[propName], propName); }, this); - if (toSet) { + if (Object.keys(toSet).length) { // Apply all direct changes at once this.set(toSet, 'pushFromThree'); } diff --git a/js/src/core/Renderer.js b/js/src/core/Renderer.js index 1395ffc9..e9d0fdf1 100644 --- a/js/src/core/Renderer.js +++ b/js/src/core/Renderer.js @@ -166,14 +166,6 @@ class RendererView extends RenderableView { } } - acquireRenderer() { - RenderableView.prototype.acquireRenderer.call(this); - - // We need to ensure that renderer properties are applied - // (we have no idea where the renderer has been...) - this.updateProperties(true); - } - } module.exports = { diff --git a/js/src/renderers/WebGLRenderer.js b/js/src/renderers/WebGLRenderer.js index 0c5a94bb..db626391 100644 --- a/js/src/renderers/WebGLRenderer.js +++ b/js/src/renderers/WebGLRenderer.js @@ -55,14 +55,6 @@ class WebGLRendererView extends RenderableView { console.log('WGLR(' + this.id + '): ' + str); } - acquireRenderer() { - RenderableView.prototype.acquireRenderer.call(this); - - // We need to ensure that renderer properties are applied - // (we have no idea where the renderer has been...) - this.updateProperties(); - } - // // Handlers // diff --git a/js/src/renderers/webgl/WebGLShadowMap.js b/js/src/renderers/webgl/WebGLShadowMap.js index 446571a3..442fad0c 100644 --- a/js/src/renderers/webgl/WebGLShadowMap.js +++ b/js/src/renderers/webgl/WebGLShadowMap.js @@ -24,7 +24,7 @@ class WebGLShadowMapModel extends WebGLShadowMapAutogenModel { // Leave this to Renderable } - synToModel(syncAllProps) { + syncToModel(syncAllProps) { // Leave this to Renderable } diff --git a/pythreejs/pythreejs.py b/pythreejs/pythreejs.py index eac12154..9119ea18 100644 --- a/pythreejs/pythreejs.py +++ b/pythreejs/pythreejs.py @@ -9,8 +9,6 @@ will use this foundation to build higher-level interfaces to build 3d plots. """ -from __future__ import absolute_import - from ipywidgets import Widget, widget_serialization from traitlets import Unicode, CInt, Instance, List, CFloat, Bool, observe, validate import numpy as np