mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2024-11-15 16:40:46 +00:00
add, remove now accept iterables
update README patch bump
This commit is contained in:
parent
ad69d2cf14
commit
816fd76213
14
README.md
14
README.md
@ -629,6 +629,20 @@ example:
|
|||||||
vm.event.ldirty = True
|
vm.event.ldirty = True
|
||||||
|
|
||||||
vm.event.pdirty = False
|
vm.event.pdirty = False
|
||||||
|
```
|
||||||
|
|
||||||
|
Or add, remove a list of events.
|
||||||
|
|
||||||
|
The following methods are available:
|
||||||
|
|
||||||
|
- `add()`
|
||||||
|
- `remove()`
|
||||||
|
- `get()`
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
|
```python
|
||||||
|
vm.event.remove(["pdirty", "mdirty", "midi"])
|
||||||
|
|
||||||
# get a list of currently subscribed
|
# get a list of currently subscribed
|
||||||
print(vm.event.get())
|
print(vm.event.get())
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "voicemeeter-api"
|
name = "voicemeeter-api"
|
||||||
version = "0.8.3"
|
version = "0.8.4"
|
||||||
description = "A Python wrapper for the Voiceemeter API"
|
description = "A Python wrapper for the Voiceemeter API"
|
||||||
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:
|
||||||
@ -59,8 +60,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]]):
|
||||||
|
if isinstance(events, str):
|
||||||
|
events = [events]
|
||||||
|
for event in events:
|
||||||
setattr(self, event, True)
|
setattr(self, event, True)
|
||||||
|
|
||||||
def remove(self, event):
|
def remove(self, events: Union[str, Iterable[str]]):
|
||||||
|
if isinstance(events, str):
|
||||||
|
events = [events]
|
||||||
|
for event in events:
|
||||||
setattr(self, event, False)
|
setattr(self, event, False)
|
||||||
|
Loading…
Reference in New Issue
Block a user