Skip to content

Commit 9a7b145

Browse files
committed
Register all python widgets
1 parent d02679c commit 9a7b145

File tree

7 files changed

+22
-4
lines changed

7 files changed

+22
-4
lines changed

js/scripts/generate-wrappers.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,9 @@ function PythonWrapper(modulePath, className) {
653653
this.pyBaseRelativePath = path.relative(this.destDirAbsolutePath, pySrcDir);
654654
this.pyBaseRelativePath = relativePathToPythonImportPath(this.pyBaseRelativePath);
655655

656+
// check if manual file exists
657+
this.hasOverride = fs.existsSync(this.pyDestPath);
658+
656659
this.hasParameters = false;
657660

658661
this.config = getClassConfig(this.className);
@@ -680,6 +683,7 @@ function PythonWrapper(modulePath, className) {
680683
superClass: this.superClass,
681684
properties: this.properties,
682685
dependencies: this.dependencies,
686+
hasOverride: this.hasOverride,
683687
};
684688

685689
// Render template

js/scripts/templates/py_wrapper.mustache

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import inspect
22

3-
from ipywidgets import Widget, DOMWidget, widget_serialization, Color
3+
from ipywidgets import Widget, DOMWidget, widget_serialization, Color, register
44
from traitlets import (
55
Unicode, Int, CInt, Instance, ForwardDeclaredInstance, This, Enum,
66
Tuple, List, Dict, Float, CFloat, Bool, Union, Any,
@@ -17,6 +17,9 @@ from {{ superClass.pyRelativePath }} import {{ superClass.className }}
1717
from {{ dep.pyRelativePath }} import {{ dep.className }}
1818
{{/each}}
1919

20+
{{#unless hasOverride}}
21+
@register
22+
{{/unless}}
2023
class {{ className }}({{ superClass.className }}):
2124
"""{{ className }}
2225

pythreejs/core/BufferAttribute.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import numpy as np
2+
from ipywidgets import register
23
from traitlets import validate, TraitError
34

45
from .BufferAttribute_autogen import BufferAttribute as BaseBufferAttribute
56

67

8+
@register
79
class BufferAttribute(BaseBufferAttribute):
810

911
@validate('array')

pythreejs/core/Object3D.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
from ipywidgets import register
2+
13
from .._base.Three import ThreeWidget
24
from .Object3D_autogen import Object3D as Object3DBase
35

6+
7+
@register
48
class Object3D(Object3DBase):
5-
9+
610
def add(self, child):
711
children_list = list(self.children)
812
children_list.append(child)
@@ -15,7 +19,7 @@ def remove(self, child):
1519

1620
def lookAt(self, vector):
1721
self.exec_three_obj_method('lookAt', vector)
18-
22+
1923
def rotateX(self, rad):
2024
self.exec_three_obj_method('rotateX', rad)
2125

pythreejs/geometries/PlainBufferGeometry.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11

2+
from ipywidgets import register
23
from .PlainBufferGeometry_autogen import PlainBufferGeometry as PlainBufferGeometryBase
34

45

6+
@register
57
class PlainBufferGeometry(PlainBufferGeometryBase):
68

79
@classmethod

pythreejs/geometries/PlainGeometry.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
1+
from ipywidgets import register
22
from .PlainGeometry_autogen import PlainGeometry as PlainGeometryBase
33

44

5+
@register
56
class PlainGeometry(PlainGeometryBase):
67

78
@classmethod

pythreejs/textures/DataTexture.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import numpy as np
2+
from ipywidgets import register
23
from traitlets import validate, TraitError
34

45
from .DataTexture_autogen import DataTexture as BaseDataTexture
56

67

8+
@register
79
class DataTexture(BaseDataTexture):
810

911
@validate('data')

0 commit comments

Comments
 (0)