Skip to content

Commit aac9763

Browse files
committed
2 parents e4ff3d9 + 397f139 commit aac9763

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

adafruit_magtag/magtag.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ def set_text(self, val, index=0, auto_refresh=True):
243243
self.add_text()
244244
string = str(val)
245245
if self._text_maxlen[index]:
246-
string = string[: self._text_maxlen[index]]
246+
if len(string) > self._text_maxlen[index]:
247+
# too long! shorten it
248+
string = string[: self._text_maxlen[index] - 3]
249+
string += "..."
247250
print("text index", self._text[index])
248251
index_in_splash = None
249252

@@ -358,7 +361,7 @@ def fetch(self, refresh_url=None, timeout=10):
358361
print("Drawing text", string)
359362
if self._text_wrap[i]:
360363
if self._debug:
361-
print("Wrapping text")
364+
print("Wrapping text with length of", self._text_wrap[i])
362365
lines = self.wrap_nicely(string, self._text_wrap[i])
363366
string = "\n".join(lines)
364367
self.set_text(string, index=i, auto_refresh=False)
@@ -404,8 +407,8 @@ def url(self, value):
404407
self._url = value
405408
if value and not self.network.uselocal:
406409
self.network.connect()
407-
if self._debug:
408-
print("My IP address is", self.network.ip_address)
410+
# if self._debug:
411+
# print("My IP address is", self.network.ip_address)
409412

410413
@property
411414
def json_path(self):

0 commit comments

Comments
 (0)