mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
further dict wrapper update
This commit is contained in:
@@ -94,6 +94,28 @@ class DictWrapper:
|
||||
# Support .get() method
|
||||
return getattr(self, key, default)
|
||||
|
||||
def __str__(self):
|
||||
# Return empty string for missing values to avoid template errors
|
||||
if hasattr(self, '_value'):
|
||||
return str(self._value) if self._value is not None else ''
|
||||
return ''
|
||||
|
||||
def __repr__(self):
|
||||
# Return empty string for missing values
|
||||
if hasattr(self, '_value'):
|
||||
return repr(self._value) if self._value is not None else ''
|
||||
return ''
|
||||
|
||||
def __html__(self):
|
||||
# Support for MarkupSafe HTML escaping
|
||||
return str(self)
|
||||
|
||||
def __bool__(self):
|
||||
# Return False for empty wrappers
|
||||
if hasattr(self, '_value'):
|
||||
return bool(self._value)
|
||||
return False
|
||||
|
||||
class DisplayMonitor:
|
||||
def __init__(self):
|
||||
self.running = False
|
||||
|
||||
Reference in New Issue
Block a user