diff --git a/2022-02-05-145453_3840x1080_scrot.png b/2022-02-05-145453_3840x1080_scrot.png new file mode 100644 index 0000000..222b588 Binary files /dev/null and b/2022-02-05-145453_3840x1080_scrot.png differ diff --git a/src/utils/event_system.py b/src/utils/event_system.py index f8f9a7c..b2d4a71 100644 --- a/src/utils/event_system.py +++ b/src/utils/event_system.py @@ -18,6 +18,12 @@ class EventSystem: def subscribe(self, event_type, fn): self.subscribers[event_type].append(fn) + def unsubscribe(self, event_type, fn): + self.subscribers[event_type].remove(fn) + + def unsubscribe_all(self, event_type): + self.subscribers.pop(event_type, None) + def emit(self, event_type, data = None): if event_type in self.subscribers: for fn in self.subscribers[event_type]: @@ -29,8 +35,8 @@ class EventSystem: else: fn() - # NOTE: Should be used when signal has only one listener and vis-a-vis def emit_and_await(self, event_type, data = None): + """ NOTE: Should be used when signal has only one listener and vis-a-vis """ if event_type in self.subscribers: for fn in self.subscribers[event_type]: if data: