Skip to content

Add parameter to allow skipping display autorefresh on fetch #54

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
Feb 11, 2021
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
8 changes: 6 additions & 2 deletions adafruit_magtag/magtag.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ def set_text(self, val, index=0, auto_refresh=True):
def _fetch_set_text(self, val, index=0):
self.set_text(val, index=index, auto_refresh=False)

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

values = super().fetch(refresh_url=refresh_url, timeout=timeout)
self.refresh()
if auto_refresh:
self.refresh()
return values

# pylint: enable=arguments-differ

def refresh(self):
"""
Refresh the display
Expand Down