Skip to content

Commit a8bf967

Browse files
committed
fixed output bug
1 parent d573297 commit a8bf967

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55
[project]
66
requires-python = ">= 3.10.11"
77
name = "samplerqrgenerator"
8-
version = "v0.1.2"
8+
version = "v0.1.4"
99
dependencies = [
1010
"qrcode",
1111
"Pillow",

src/samplerqrgenerator/__init__.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def health_check(self):
1414
return "Ok"
1515

1616
def send_preregistration_request(self, preregistration_data):
17+
HilltopHost.PostMessage("====================")
1718
HilltopHost.PostMessage("You clicked the Notify Lab button.")
1819
HilltopHost.PostMessage(
1920
"In addition to notifying the lab, this button also generates QR labels."
@@ -24,9 +25,9 @@ def send_preregistration_request(self, preregistration_data):
2425
tech_name = preregistration_data.Run.TechnicianFirstName
2526

2627
HilltopHost.PostMessage(
27-
f"Generating QR codes for run {run_name} which was set up by {tech_name}.\n"
28+
f"Generating QR codes for run {run_name} which was set up by {tech_name}."
2829
)
29-
30+
HilltopHost.PostMessage("--------------------")
3031
output_dir = preregistration_data.GetSectionInfo("Sampler")["LabelOutputDir"]
3132

3233
file_prefix = os.path.join(output_dir, f"{run_name}_[{tech_name}]")
@@ -36,7 +37,8 @@ def send_preregistration_request(self, preregistration_data):
3637

3738
for sample in preregistration_data.Samples:
3839
HilltopHost.PostMessage(
39-
f"Generating QR code for sample {sample.Sample} at {sample.SiteName}"
40+
f" - Generating QR code for sample {sample.SampleID}"
41+
f" at {sample.SiteName}"
4042
)
4143
payload_dict = {
4244
"RunName": run_name,
@@ -47,10 +49,11 @@ def send_preregistration_request(self, preregistration_data):
4749
qr_image = generate_qr_code_from_string("json:" + json.dumps(payload_dict))
4850
image_list += [qr_image]
4951

50-
HilltopHost.PostMessage(
51-
f"Saving QR codes to {file_prefix}_qr_a4_sheet.pdf "
52-
f"and {file_prefix}_qr_labels.pdf..."
53-
)
52+
HilltopHost.PostMessage("--------------------")
53+
HilltopHost.PostMessage("Saving QR codes to files:")
54+
HilltopHost.PostMessage(f" - {file_prefix}_qr_a4_sheet.pdf")
55+
HilltopHost.PostMessage(f" - {file_prefix}_qr_labels.pdf")
56+
HilltopHost.PostMessage("--------------------")
5457

5558
create_printable_a4_page(
5659
qr_images=image_list,
@@ -66,11 +69,10 @@ def send_preregistration_request(self, preregistration_data):
6669
multiples=2,
6770
)
6871

69-
HilltopHost.PostMessage(
70-
f"Done! The QR codes have been saved to {output_dir}.\n"
71-
"You may now close this dialog."
72-
)
72+
HilltopHost.PostMessage(f"Done! The QR codes have been saved to {output_dir}.")
73+
HilltopHost.PostMessage("You may now close this dialog.")
7374

75+
HilltopHost.PostMessage("====================")
7476
response = HilltopHost.PreregistrationResult()
7577

7678
return response

0 commit comments

Comments
 (0)