Skip to content
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

Refactor metadata handling in DisplayBuffer #32

Merged
merged 1 commit into from
Jun 25, 2024
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
15 changes: 12 additions & 3 deletions xradios/tui/buffers/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ def __init__(self, **kwargs):
super().__init__(
document=Document(content, 0), read_only=True, name=DISPLAY_BUFFER
)
self.metadata = None
self._metadata = None

@property
def metadata(self):
return self._metadata

@metadata.setter
def metadata(self, value):
if value != self._metadata:
self._metadata = value
self.update(value)

def clear(self):
self.set_document(Document('', 0), bypass_readonly=True)
Expand All @@ -31,9 +41,8 @@ async def run(self):
except Exception:
pass
else:
if result != self.metadata and all(result.values()):
if all(result.values()):
self.metadata = result
self.update(result)
await asyncio.sleep(30)

def update(self, metadata):
Expand Down