Skip to content

Commit 489861b

Browse files
committed
Move download component
1 parent 94d0491 commit 489861b

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

crystal_toolkit/components/structure.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,12 @@ def trigger_screenshot(n_clicks, current_requests, struct_or_mol):
426426
def download_image(image_data_timestamp, image_data, image_request):
427427
if not image_data_timestamp:
428428
raise PreventUpdate
429+
429430
return {
430431
"content": image_data[len("data:image/png;base64,") :],
431432
"filename": image_request["filename"],
433+
"base64": True,
434+
"type": "image/png",
432435
}
433436

434437
@app.callback(
@@ -589,13 +592,16 @@ def _make_bonding_algorithm_custom_cuffoff_data(graph):
589592
def _sub_layouts(self):
590593

591594
struct_layout = html.Div(
592-
CrystalToolkitScene(
593-
id=self.id("scene"),
594-
data=self.initial_data["scene"],
595-
settings=self.initial_scene_settings,
596-
sceneSize="100%",
597-
**self.scene_kwargs,
598-
),
595+
[
596+
CrystalToolkitScene(
597+
id=self.id("scene"),
598+
data=self.initial_data["scene"],
599+
settings=self.initial_scene_settings,
600+
sceneSize="100%",
601+
**self.scene_kwargs,
602+
),
603+
dcc.Download(id=self.id("download")),
604+
],
599605
style={
600606
"width": "100%",
601607
"height": "100%",
@@ -611,7 +617,6 @@ def _sub_layouts(self):
611617
kind="primary",
612618
id=self.id("screenshot_button"),
613619
),
614-
dcc.Download(id=self.id("download"), type="image/png", base64=True),
615620
],
616621
# TODO: change to "bottom" when dropdown included
617622
style={"verticalAlign": "top", "display": "inline-block"},

0 commit comments

Comments
 (0)