Skip to content
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
11 changes: 7 additions & 4 deletions adafruit_magtag/magtag.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ def set_text(self, val, index=0, auto_refresh=True):
self.add_text()
string = str(val)
if self._text_maxlen[index]:
string = string[: self._text_maxlen[index]]
if len(string) > self._text_maxlen[index]:
# too long! shorten it
string = string[: self._text_maxlen[index] - 3]
string += "..."
print("text index", self._text[index])
index_in_splash = None

Expand Down Expand Up @@ -350,7 +353,7 @@ def fetch(self, refresh_url=None, timeout=10):
print("Drawing text", string)
if self._text_wrap[i]:
if self._debug:
print("Wrapping text")
print("Wrapping text with length of", self._text_wrap[i])
lines = self.wrap_nicely(string, self._text_wrap[i])
string = "\n".join(lines)
self.set_text(string, index=i, auto_refresh=False)
Expand Down Expand Up @@ -396,8 +399,8 @@ def url(self, value):
self._url = value
if value and not self.network.uselocal:
self.network.connect()
if self._debug:
print("My IP address is", self.network.ip_address)
# if self._debug:
# print("My IP address is", self.network.ip_address)

@property
def json_path(self):
Expand Down