Skip to content

Commit 2a10c66

Browse files
committed
use _package var in pythreejs.py
1 parent ba3d02d commit 2a10c66

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

pythreejs/pythreejs.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
from ipywidgets import Widget, DOMWidget, widget_serialization, Color
1616
from traitlets import (Unicode, Int, CInt, Instance, Enum, List, Dict, Float,
1717
CFloat, Bool)
18+
from ._package import npm_pkg_name
1819
from math import pi, sqrt
1920

21+
from core import *
22+
2023
def vector3(trait_type=CFloat, default=None, **kwargs):
2124
if default is None:
2225
default = [0, 0, 0]
@@ -29,8 +32,8 @@ def vector2(trait_type=CFloat, default=None, **kwargs):
2932

3033

3134
class Texture(Widget):
32-
_view_module = Unicode('jupyter-threejs').tag(sync=True)
33-
_model_module = Unicode('jupyter-threejs').tag(sync=True)
35+
_view_module = Unicode(npm_pkg_name).tag(sync=True)
36+
_model_module = Unicode(npm_pkg_name).tag(sync=True)
3437
_view_name = Unicode('TextureView').tag(sync=True)
3538
_model_name = Unicode('TextureModel').tag(sync=True)
3639

@@ -92,8 +95,8 @@ class Object3d(Widget):
9295
"""
9396
If matrix is not None, it overrides the position, rotation, scale, and up variables.
9497
"""
95-
_view_module = Unicode('jupyter-threejs').tag(sync=True)
96-
_model_module = Unicode('jupyter-threejs').tag(sync=True)
98+
_view_module = Unicode(npm_pkg_name).tag(sync=True)
99+
_model_module = Unicode(npm_pkg_name).tag(sync=True)
97100
_view_name = Unicode('Object3dView').tag(sync=True)
98101
_model_name = Unicode('Object3dModel').tag(sync=True)
99102

@@ -205,8 +208,8 @@ class ScaledObject(Object3d):
205208

206209

207210
class Controls(Widget):
208-
_view_module = Unicode('jupyter-threejs').tag(sync=True)
209-
_model_module = Unicode('jupyter-threejs').tag(sync=True)
211+
_view_module = Unicode(npm_pkg_name).tag(sync=True)
212+
_model_module = Unicode(npm_pkg_name).tag(sync=True)
210213
_view_name = Unicode('ControlsView').tag(sync=True)
211214
_model_name = Unicode('ControlsModel').tag(sync=True)
212215

@@ -257,8 +260,8 @@ class Picker(Controls):
257260

258261

259262
class Geometry(Widget):
260-
_view_module = Unicode('jupyter-threejs').tag(sync=True)
261-
_model_module = Unicode('jupyter-threejs').tag(sync=True)
263+
_view_module = Unicode(npm_pkg_name).tag(sync=True)
264+
_model_module = Unicode(npm_pkg_name).tag(sync=True)
262265
_view_name = Unicode('GeometryView').tag(sync=True)
263266
_model_name = Unicode('GeometryModel').tag(sync=True)
264267

@@ -452,8 +455,8 @@ class ParametricGeometry(Geometry):
452455

453456

454457
class Material(Widget):
455-
_view_module = Unicode('jupyter-threejs').tag(sync=True)
456-
_model_module = Unicode('jupyter-threejs').tag(sync=True)
458+
_view_module = Unicode(npm_pkg_name).tag(sync=True)
459+
_model_module = Unicode(npm_pkg_name).tag(sync=True)
457460
_view_name = Unicode('MaterialView').tag(sync=True)
458461
_model_name = Unicode('MaterialModel').tag(sync=True)
459462

@@ -742,8 +745,8 @@ class Scene(Object3d):
742745

743746

744747
class Effect(Widget):
745-
_view_module = Unicode('jupyter-threejs').tag(sync=True)
746-
_model_module = Unicode('jupyter-threejs').tag(sync=True)
748+
_view_module = Unicode(npm_pkg_name).tag(sync=True)
749+
_model_module = Unicode(npm_pkg_name).tag(sync=True)
747750

748751

749752
class AnaglyphEffect(Effect):
@@ -752,8 +755,8 @@ class AnaglyphEffect(Effect):
752755

753756

754757
class Renderer(DOMWidget):
755-
_view_module = Unicode('jupyter-threejs').tag(sync=True)
756-
_model_module = Unicode('jupyter-threejs').tag(sync=True)
758+
_view_module = Unicode(npm_pkg_name).tag(sync=True)
759+
_model_module = Unicode(npm_pkg_name).tag(sync=True)
757760
_view_name = Unicode('RendererView').tag(sync=True)
758761
_model_name = Unicode('RendererModel').tag(sync=True)
759762

0 commit comments

Comments
 (0)