mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merged in feature/trigger_event_method (pull request #372)
added trigger event method to base handler Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
commit
b8603db6fa
1 changed files with 21 additions and 0 deletions
|
|
@ -603,3 +603,24 @@ class BaseHandler(object):
|
||||||
self.log.debug(
|
self.log.debug(
|
||||||
"Action \"{}\" Triggered successfully".format(action_name)
|
"Action \"{}\" Triggered successfully".format(action_name)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def trigger_event(
|
||||||
|
self, topic, event_data={}, session=None, source=None,
|
||||||
|
event=None, on_error="ignore"
|
||||||
|
):
|
||||||
|
if session is None:
|
||||||
|
session = self.session
|
||||||
|
|
||||||
|
if not source and event:
|
||||||
|
source = event.get("source")
|
||||||
|
# Create and trigger event
|
||||||
|
event = fa_session.ftrack_api.event.base.Event(
|
||||||
|
topic=topic,
|
||||||
|
data=event_data,
|
||||||
|
source=source
|
||||||
|
)
|
||||||
|
session.event_hub.publish(event, on_error=on_error)
|
||||||
|
|
||||||
|
self.log.debug((
|
||||||
|
"Publishing event: {}"
|
||||||
|
).format(str(event.__dict__)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue