From ee10060724dc64b28e4e87cbae4fabd47bab2e0d Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Mon, 20 Jun 2022 00:01:30 +0100 Subject: [PATCH] changes to observers thread. minor version bump --- pyproject.toml | 2 +- vban_cmd/base.py | 16 +++++----------- vban_cmd/subject.py | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e136d0f..4d3786c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "vban-cmd" -version = "1.0.7" +version = "1.0.8" description = "Python interface for the VBAN RT Packet Service (Sendtext)" authors = ["onyx-and-iris "] license = "MIT" diff --git a/vban_cmd/base.py b/vban_cmd/base.py index 7684783..50d52b8 100644 --- a/vban_cmd/base.py +++ b/vban_cmd/base.py @@ -183,7 +183,7 @@ class VbanCmd(metaclass=ABCMeta): def _updates(self) -> NoReturn: while self.running: private_packet = self._get_rt() - strip_comp, bus_comp = ( + self._strip_comp, self._bus_comp = ( tuple( not a == b for a, b in zip( @@ -198,22 +198,16 @@ class VbanCmd(metaclass=ABCMeta): ), ) self._pdirty = private_packet.pdirty(self.public_packet) - self._ldirty = any(any(list_) for list_ in (strip_comp, bus_comp)) + self._ldirty = any( + any(list_) for list_ in (self._strip_comp, self._bus_comp) + ) if self._public_packet != private_packet: self._public_packet = private_packet if self.pdirty: self.subject.notify("pdirty") if self.ldirty: - self.subject.notify( - "ldirty", - ( - self.public_packet.inputlevels, - strip_comp, - self.public_packet.outputlevels, - bus_comp, - ), - ) + self.subject.notify("ldirty") time.sleep(self.ratelimit) @property diff --git a/vban_cmd/subject.py b/vban_cmd/subject.py index 643549d..f5f0bf1 100644 --- a/vban_cmd/subject.py +++ b/vban_cmd/subject.py @@ -12,10 +12,10 @@ class Subject: return self._observers - def notify(self, modifier=None, data=None): + def notify(self, modifier=None): """run callbacks on update""" - [o.on_update(modifier, data) for o in self._observers] + [o.on_update(modifier) for o in self._observers] def add(self, observer): """adds an observer to _observers"""