added emit function

This commit is contained in:
iLLiCiTiT 2022-01-07 18:54:11 +01:00
parent 7a1edd6b1e
commit 4aa096d5bc

View file

@ -1,7 +1,8 @@
"""Events holding data about specific event."""
class BaseEvent:
# Inherit from 'object' for Python 2 hosts
class BaseEvent(object):
"""Base event object.
Can be used to anything because data are not much specific. Only required
@ -28,6 +29,13 @@ class BaseEvent:
def topic(self):
return self._topic
@classmethod
def emit(cls, *args, **kwargs):
from avalon import pipeline
obj = cls(*args, **kwargs)
pipeline.emit(obj.topic, [obj])
class BeforeWorkfileSave(BaseEvent):
"""Before workfile changes event data."""