mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2025-01-18 10:30:48 +00:00
changes to observers thread.
minor version bump
This commit is contained in:
parent
5996385e5b
commit
ee10060724
@ -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 <code@onyxandiris.online>"]
|
||||
license = "MIT"
|
||||
|
@ -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
|
||||
|
@ -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"""
|
||||
|
Loading…
Reference in New Issue
Block a user