Skip to content

Changing logic to include tab replacement and glyph calculation #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
2 changes: 2 additions & 0 deletions adafruit_display_text/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ def __init__(
if not max_glyphs and not text:
raise RuntimeError("Please provide a max size, or initial text")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could save a line and just put the text = " ".join(text.split("\t")) before the if not max_glyphs: statement.

It does this calculation either way, so just do it once and then do the max_glyphs check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback, good point, I will change it and re-do the test just to be 100% sure. Thanks @kmatch98 :)

if not max_glyphs:
text = " ".join(text.split("\t"))
max_glyphs = len(text)
text = " ".join(text.split("\t"))
# add one to max_size for the background bitmap tileGrid

# instance the Group
Expand Down