forked from p15670423/monkey
Common: Make methods static in PypubsubEventQueue
This commit is contained in:
parent
414e8127ed
commit
1fbe9e5ad4
|
@ -17,15 +17,18 @@ class PypubsubEventQueue(IEventQueue):
|
||||||
for event_type in types:
|
for event_type in types:
|
||||||
PypubsubEventQueue._subscribe_type(event_type, subscriber)
|
PypubsubEventQueue._subscribe_type(event_type, subscriber)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def _subscribe_type(event_type: AbstractEvent, subscriber: Callable[..., Any]):
|
def _subscribe_type(event_type: AbstractEvent, subscriber: Callable[..., Any]):
|
||||||
# pypubsub.pub.subscribe needs a string as the topic/event name
|
# pypubsub.pub.subscribe needs a string as the topic/event name
|
||||||
event_type_name = event_type.__name__
|
event_type_name = event_type.__name__
|
||||||
pub.subscribe(listener=subscriber, topicName=event_type_name)
|
pub.subscribe(listener=subscriber, topicName=event_type_name)
|
||||||
|
|
||||||
def subscribe_tags(self, tags: Sequence[str], subscriber: Callable[..., Any]):
|
@staticmethod
|
||||||
|
def subscribe_tags(tags: Sequence[str], subscriber: Callable[..., Any]):
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
PypubsubEventQueue._subscribe_tag(tag, subscriber)
|
PypubsubEventQueue._subscribe_tag(tag, subscriber)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def _subscribe_tag(tag: str, subscriber: Callable[..., Any]):
|
def _subscribe_tag(tag: str, subscriber: Callable[..., Any]):
|
||||||
pub.subscribe(listener=subscriber, topicName=tag)
|
pub.subscribe(listener=subscriber, topicName=tag)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue