Skip to content

Commit

Permalink
StructureViewer Download tab: pass file format explicitly to `_prepar…
Browse files Browse the repository at this point in the history
…e_payload` (#504)
  • Loading branch information
danielhollas authored Aug 29, 2023
1 parent 413c26c commit 27ff1ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aiidalab_widgets_base/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def _download_tab(self):
# 1. Choose download file format.
self.file_format = ipw.Dropdown(
label="Extended xyz",
# File extension and format may be differen. Therefore, we define both.
# File extension and format may be different. Therefore, we define both.
options=(
("xyz", {"extension": "xyz", "format": "xyz"}),
("cif", {"extension": "cif", "format": "cif"}),
Expand Down Expand Up @@ -717,12 +717,12 @@ def apply_displayed_selection(self, _=None):

def download(self, change=None): # pylint: disable=unused-argument
"""Prepare a structure for downloading."""
payload = self._prepare_payload()
payload = self._prepare_payload(self.file_format.value["format"])
if payload is None:
return
suffix = f"pk-{self.pk}" if self.pk else "not-stored"
self._download(
payload=self._prepare_payload(),
payload=payload,
filename=f"""structure-{suffix}.{self.file_format.value["extension"]}""",
)

Expand Down

0 comments on commit 27ff1ba

Please sign in to comment.