Event class added to misc.

defaultkwarg subs added. iniitialize event subscriptions.

base class observable thread now checks for currently registered events.

make capi call if polling strip/bus levels and ldirty not in events.
This commit is contained in:
onyx-and-iris
2022-08-02 09:17:11 +01:00
parent b7c716daf4
commit 446848fe89
5 changed files with 66 additions and 15 deletions

View File

@@ -161,13 +161,15 @@ class BusLevel(IRemote):
"""
Returns a tuple of level values for the channel.
If observables thread running fetch values from cache otherwise call CAPI func.
If observables thread running and level updates are subscribed to, fetch values from cache
Otherwise call CAPI func.
"""
def fget(x):
return round(20 * log(x, 10), 1) if x > 0 else -200.0
if self._remote.running and "bus_level" in self._remote.cache:
if self._remote.running and self._remote.event.ldirty:
vals = self._remote.cache["bus_level"][self.range[0] : self.range[-1]]
else:
vals = [self._remote.get_level(mode, i) for i in range(*self.range)]