Skip to content

Commit 4f85b77

Browse files
committed
remove broken ip address print during debug
add '...' when strings are too long
1 parent a7f7cfa commit 4f85b77

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
@@ -235,7 +235,10 @@ def set_text(self, val, index=0, auto_refresh=True):
235235
self.add_text()
236236
string = str(val)
237237
if self._text_maxlen[index]:
238-
string = string[: self._text_maxlen[index]]
238+
if len(string) > self._text_maxlen[index]:
239+
# too long! shorten it
240+
string = string[: self._text_maxlen[index]-3]
241+
string += '...'
239242
print("text index", self._text[index])
240243
index_in_splash = None
241244

@@ -350,7 +353,7 @@ def fetch(self, refresh_url=None, timeout=10):
350353
print("Drawing text", string)
351354
if self._text_wrap[i]:
352355
if self._debug:
353-
print("Wrapping text")
356+
print("Wrapping text with length of", self._text_wrap[i])
354357
lines = self.wrap_nicely(string, self._text_wrap[i])
355358
string = "\n".join(lines)
356359
self.set_text(string, index=i, auto_refresh=False)
@@ -396,8 +399,8 @@ def url(self, value):
396399
self._url = value
397400
if value and not self.network.uselocal:
398401
self.network.connect()
399-
if self._debug:
400-
print("My IP address is", self.network.ip_address)
402+
#if self._debug:
403+
# print("My IP address is", self.network.ip_address)
401404

402405
@property
403406
def json_path(self):

0 commit comments

Comments
 (0)