forked from p15670423/monkey
Island: Rename _pypubsub_publisher_wrappe{d,r}
This commit is contained in:
parent
b16d19e0ed
commit
1036189fcc
|
@ -12,17 +12,17 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class PyPubSubIslandEventQueue(IIslandEventQueue):
|
class PyPubSubIslandEventQueue(IIslandEventQueue):
|
||||||
def __init__(self, pypubsub_publisher: Publisher):
|
def __init__(self, pypubsub_publisher: Publisher):
|
||||||
self._pypubsub_publisher_wrapped = PyPubSubPublisherWrapper(pypubsub_publisher)
|
self._pypubsub_publisher_wrapper = PyPubSubPublisherWrapper(pypubsub_publisher)
|
||||||
|
|
||||||
def subscribe(self, topic: IslandEventTopic, subscriber: IslandEventSubscriber):
|
def subscribe(self, topic: IslandEventTopic, subscriber: IslandEventSubscriber):
|
||||||
topic_name = topic.name # needs to be a string for pypubsub
|
topic_name = topic.name # needs to be a string for pypubsub
|
||||||
self._pypubsub_publisher_wrapped.subscribe(topic_name, subscriber)
|
self._pypubsub_publisher_wrapper.subscribe(topic_name, subscriber)
|
||||||
|
|
||||||
def publish(self, topic: IslandEventTopic, event: Any = None):
|
def publish(self, topic: IslandEventTopic, event: Any = None):
|
||||||
topic_name = topic.name # needs to be a string for pypubsub
|
topic_name = topic.name # needs to be a string for pypubsub
|
||||||
logger.debug(f"Publishing {topic_name} event")
|
logger.debug(f"Publishing {topic_name} event")
|
||||||
|
|
||||||
if event is None:
|
if event is None:
|
||||||
self._pypubsub_publisher_wrapped.publish(topic_name)
|
self._pypubsub_publisher_wrapper.publish(topic_name)
|
||||||
else:
|
else:
|
||||||
self._pypubsub_publisher_wrapped.publish(topic_name, event=event)
|
self._pypubsub_publisher_wrapper.publish(topic_name, event=event)
|
||||||
|
|
Loading…
Reference in New Issue