Skip to content

Commit

Permalink
TypeTray: Make labels optional for the CLI
Browse files Browse the repository at this point in the history
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 <https://github.com/jasondunsmore> for
reporting!

Resolves: #678
  • Loading branch information
florianfesti committed May 18, 2024
1 parent 387beee commit 278d1f7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions boxes/generators/typetray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 278d1f7

Please sign in to comment.