Skip to content

Commit f34137c

Browse files
authored
fix box3d render (#1689)
This fix the issue with mathics server
1 parent 3a9f0be commit f34137c

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

mathics/builtin/box/graphics3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ def to_js(self, elements=None, **options):
4848
"""Turn the Graphics3DBox to into a something javascript-ish
4949
We include enclosing script tagging.
5050
"""
51-
from mathics.format.render.json import graphics3d_boxes_to_json
51+
from mathics.format.render.json import graphics3d_box_to_json
5252

53-
json_repr = graphics3d_boxes_to_json(self, elements, **options)
53+
json_repr = graphics3d_box_to_json(self, elements, **options)
5454
js = f"<graphics3d data='{json_repr}'/>"
5555
return js
5656

mathics/core/formatter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ def lookup_method(self, format: str) -> Callable:
9191
if getattr(BoxElementMixin, f"to_{format}") is box_to_method:
9292
box_to_method = None
9393
if box_to_method:
94-
94+
# The elements is not used anywhere.
9595
def ret_fn(box, elements=None, **opts):
96-
return box_to_method(elements, **opts)
96+
assert elements is None, "elements parameter is not used anymore."
97+
return box_to_method(**opts)
9798

9899
return ret_fn
99100

mathics/format/render/json.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def cylinder_3d_box(box: Cylinder3DBox):
139139
add_conversion_fn(Cylinder3DBox, cylinder_3d_box)
140140

141141

142-
def graphics3d_box_tojson(box: Graphics3DBox, content=None, **options) -> str:
142+
def graphics3d_box_to_json(box: Graphics3DBox, content=None, **options) -> str:
143143
"""Turn the Graphics3DBox to into a something JSON like.
144144
This can be used to embed in something else like MathML or Javascript.
145145
@@ -200,7 +200,7 @@ def graphics3d_box_tojson(box: Graphics3DBox, content=None, **options) -> str:
200200
return json_repr
201201

202202

203-
add_conversion_fn(Graphics3DBox, graphics3d_box_tojson)
203+
add_conversion_fn(Graphics3DBox, graphics3d_box_to_json)
204204

205205

206206
def line_3d_box(box: Line3DBox):

0 commit comments

Comments
 (0)