mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2025-01-30 23:00:51 +00:00
add, remove now accept iterables
update README patch bump
This commit is contained in:
parent
2f82e0b1fc
commit
550df917fb
16
README.md
16
README.md
@ -316,8 +316,6 @@ Use the event class to toggle updates as necessary.
|
|||||||
The following properties are available:
|
The following properties are available:
|
||||||
|
|
||||||
- `pdirty`: boolean
|
- `pdirty`: boolean
|
||||||
- `mdirty`: boolean
|
|
||||||
- `midi`: boolean
|
|
||||||
- `ldirty`: boolean
|
- `ldirty`: boolean
|
||||||
|
|
||||||
example:
|
example:
|
||||||
@ -326,6 +324,20 @@ example:
|
|||||||
vban.event.ldirty = True
|
vban.event.ldirty = True
|
||||||
|
|
||||||
vban.event.pdirty = False
|
vban.event.pdirty = False
|
||||||
|
```
|
||||||
|
|
||||||
|
Or add, remove a list of events.
|
||||||
|
|
||||||
|
The following methods are available:
|
||||||
|
|
||||||
|
- `add()`
|
||||||
|
- `remove()`
|
||||||
|
- `get()`
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
vban.event.remove(["pdirty", "ldirty"])
|
||||||
|
|
||||||
# get a list of currently subscribed
|
# get a list of currently subscribed
|
||||||
print(vban.event.get())
|
print(vban.event.get())
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "vban-cmd"
|
name = "vban-cmd"
|
||||||
version = "1.5.5"
|
version = "1.5.6"
|
||||||
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"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
|
from typing import Iterable, Union
|
||||||
|
|
||||||
|
|
||||||
class Event:
|
class Event:
|
||||||
@ -41,8 +42,14 @@ class Event:
|
|||||||
def any(self) -> bool:
|
def any(self) -> bool:
|
||||||
return any(self.subs.values())
|
return any(self.subs.values())
|
||||||
|
|
||||||
def add(self, event):
|
def add(self, events: Union[str, Iterable[str]]):
|
||||||
setattr(self, event, True)
|
if isinstance(events, str):
|
||||||
|
events = [events]
|
||||||
|
for event in events:
|
||||||
|
setattr(self, event, True)
|
||||||
|
|
||||||
def remove(self, event):
|
def remove(self, events: Union[str, Iterable[str]]):
|
||||||
setattr(self, event, False)
|
if isinstance(events, str):
|
||||||
|
events = [events]
|
||||||
|
for event in events:
|
||||||
|
setattr(self, event, False)
|
||||||
|
Loading…
Reference in New Issue
Block a user