mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2025-01-18 18:40:47 +00:00
changes to observers thread.
minor version bump
This commit is contained in:
parent
5996385e5b
commit
ee10060724
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "vban-cmd"
|
name = "vban-cmd"
|
||||||
version = "1.0.7"
|
version = "1.0.8"
|
||||||
description = "Python interface for the VBAN RT Packet Service (Sendtext)"
|
description = "Python interface for the VBAN RT Packet Service (Sendtext)"
|
||||||
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -183,7 +183,7 @@ class VbanCmd(metaclass=ABCMeta):
|
|||||||
def _updates(self) -> NoReturn:
|
def _updates(self) -> NoReturn:
|
||||||
while self.running:
|
while self.running:
|
||||||
private_packet = self._get_rt()
|
private_packet = self._get_rt()
|
||||||
strip_comp, bus_comp = (
|
self._strip_comp, self._bus_comp = (
|
||||||
tuple(
|
tuple(
|
||||||
not a == b
|
not a == b
|
||||||
for a, b in zip(
|
for a, b in zip(
|
||||||
@ -198,22 +198,16 @@ class VbanCmd(metaclass=ABCMeta):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
self._pdirty = private_packet.pdirty(self.public_packet)
|
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:
|
if self._public_packet != private_packet:
|
||||||
self._public_packet = private_packet
|
self._public_packet = private_packet
|
||||||
if self.pdirty:
|
if self.pdirty:
|
||||||
self.subject.notify("pdirty")
|
self.subject.notify("pdirty")
|
||||||
if self.ldirty:
|
if self.ldirty:
|
||||||
self.subject.notify(
|
self.subject.notify("ldirty")
|
||||||
"ldirty",
|
|
||||||
(
|
|
||||||
self.public_packet.inputlevels,
|
|
||||||
strip_comp,
|
|
||||||
self.public_packet.outputlevels,
|
|
||||||
bus_comp,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
time.sleep(self.ratelimit)
|
time.sleep(self.ratelimit)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -12,10 +12,10 @@ class Subject:
|
|||||||
|
|
||||||
return self._observers
|
return self._observers
|
||||||
|
|
||||||
def notify(self, modifier=None, data=None):
|
def notify(self, modifier=None):
|
||||||
"""run callbacks on update"""
|
"""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):
|
def add(self, observer):
|
||||||
"""adds an observer to _observers"""
|
"""adds an observer to _observers"""
|
||||||
|
Loading…
Reference in New Issue
Block a user