Skip to content

Deal with empty strings properly #20

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

Merged
merged 1 commit into from
Sep 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions adafruit_matrixportal/matrixportal.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,20 @@ def set_text(self, val, index=0):
if self._text[index] is not None:
print("Replacing text area with :", string)
index_in_splash = self.splash.index(self._text[index])
self._text[index] = Label(self._text_font, text=string)
self._text[index].color = self._text_color[index]
self._text[index].x = self._text_position[index][0]
self._text[index].y = self._text_position[index][1]
if len(string) > 0:
self._text[index] = Label(self._text_font, text=string)
self._text[index].color = self._text_color[index]
self._text[index].x = self._text_position[index][0]
self._text[index].y = self._text_position[index][1]
elif index_in_splash is not None:
self._text[index] = None

if index_in_splash is not None:
self.splash[index_in_splash] = self._text[index]
else:
if self._text[index] is not None:
self.splash[index_in_splash] = self._text[index]
else:
del self.splash[index_in_splash]
elif self._text[index] is not None:
self.splash.append(self._text[index])

def get_local_time(self, location=None):
Expand Down