From 278d1f71b9e74738f35c32eff7d5f3174f1227e9 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Sat, 18 May 2024 14:59:43 +0200 Subject: [PATCH] TypeTray: Make labels optional for the CLI Since 55616e2 --label_file defaults to labels.txt when it should not have a default as the default is not using labels. Thanks to Jason Dunsmore for reporting! Resolves: #678 --- boxes/generators/typetray.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/boxes/generators/typetray.py b/boxes/generators/typetray.py index 80fd7010..5719cbac 100644 --- a/boxes/generators/typetray.py +++ b/boxes/generators/typetray.py @@ -114,7 +114,6 @@ def __init__(self) -> None: else: label_group.add_argument( "--label_file", action="store", type=argparse.FileType('r'), - default="labels.txt", help="file with compartment labels. One line per compartment") self.addSettingsArgs(FingerHoleEdgeSettings) @@ -234,11 +233,13 @@ def render(self): bh = self.back_height if self.top_edge == "e" else 0.0 + self.textcontent = [] if hasattr(self, "label_text"): self.textcontent = self.label_text.split("\r\n") else: - with open(self.label_file) as f: - self.textcontent = f.readlines() + if self.label_file: + with open(self.label_file) as f: + self.textcontent = f.readlines() self.textnumber = 0 # x sides