Skip to content

Commit 5c6d563

Browse files
authored
Merge pull request #54 from makermelissa/main
Add parameter to allow skipping display autorefresh on fetch
2 parents a141b1c + e8d3d98 commit 5c6d563

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

adafruit_magtag/magtag.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ def set_text(self, val, index=0, auto_refresh=True):
161161
def _fetch_set_text(self, val, index=0):
162162
self.set_text(val, index=index, auto_refresh=False)
163163

164-
def fetch(self, refresh_url=None, timeout=10):
164+
# pylint: disable=arguments-differ
165+
def fetch(self, refresh_url=None, timeout=10, auto_refresh=True):
165166
"""Fetch data from the url we initialized with, perfom any parsing,
166167
and display text or graphics. This function does pretty much everything
167168
Optionally update the URL
@@ -172,9 +173,12 @@ def fetch(self, refresh_url=None, timeout=10):
172173
"""
173174

174175
values = super().fetch(refresh_url=refresh_url, timeout=timeout)
175-
self.refresh()
176+
if auto_refresh:
177+
self.refresh()
176178
return values
177179

180+
# pylint: enable=arguments-differ
181+
178182
def refresh(self):
179183
"""
180184
Refresh the display

0 commit comments

Comments
 (0)