diff --git a/README.md b/README.md index 8b5a8a8..3e1036b 100644 --- a/README.md +++ b/README.md @@ -316,8 +316,6 @@ Use the event class to toggle updates as necessary. The following properties are available: - `pdirty`: boolean -- `mdirty`: boolean -- `midi`: boolean - `ldirty`: boolean example: @@ -326,6 +324,20 @@ example: vban.event.ldirty = True 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 print(vban.event.get()) diff --git a/pyproject.toml b/pyproject.toml index 984ed99..b84c122 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "vban-cmd" -version = "1.5.5" +version = "1.5.6" description = "Python interface for the VBAN RT Packet Service (Sendtext)" authors = ["onyx-and-iris "] license = "MIT" diff --git a/vban_cmd/event.py b/vban_cmd/event.py index a27c40c..ec5b22e 100644 --- a/vban_cmd/event.py +++ b/vban_cmd/event.py @@ -1,4 +1,5 @@ import logging +from typing import Iterable, Union class Event: @@ -41,8 +42,14 @@ class Event: def any(self) -> bool: return any(self.subs.values()) - def add(self, event): - setattr(self, event, True) + def add(self, events: Union[str, Iterable[str]]): + if isinstance(events, str): + events = [events] + for event in events: + setattr(self, event, True) - def remove(self, event): - setattr(self, event, False) + def remove(self, events: Union[str, Iterable[str]]): + if isinstance(events, str): + events = [events] + for event in events: + setattr(self, event, False)