Skip to content

Commit

Permalink
StructureMoleculeComponent use "material_id" or "id" in image filenam…
Browse files Browse the repository at this point in the history
…e if found in Structure.properties
  • Loading branch information
janosh committed Nov 11, 2023
1 parent 4b8d4d5 commit 47e4305
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crystal_toolkit/components/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,12 @@ def download_image(image_data_timestamp, image_data, data):
spg_symbol = getattr(struct_or_mol, "get_space_group_info", lambda: [""])()[
0
]
request_filename = f"{formula}-{spg_symbol}-crystal-toolkit.png"
request_filename = f"{formula}-{spg_symbol}.png"
material_id = struct_or_mol.properties.get(
"material_id", struct_or_mol.properties.get("id")
)
if material_id:
request_filename = f"{material_id}-{request_filename}"

return {
"content": image_data[len("data:image/png;base64,") :],
Expand Down

0 comments on commit 47e4305

Please sign in to comment.