fixed registration of sync action

This commit is contained in:
Milan Kolar 2019-11-27 17:51:18 +01:00
parent fe55ad0df4
commit 6367d24a1d

View file

@ -2067,12 +2067,13 @@ class SyncToAvalonServer(BaseAction):
#: Action description.
description = "Send data from Ftrack to Avalon"
#: Action icon.
icon = "{}/ftrack/action_icons/PypeAdmin.svg".format(
os.environ.get(
"PYPE_STATICS_SERVER",
"http://localhost:{}".format(
config.get_presets().get("services", {}).get(
"statics_server", {}
"rest_api", {}
).get("default_port", 8021)
)
)
@ -2080,6 +2081,26 @@ class SyncToAvalonServer(BaseAction):
#: roles that are allowed to register this action
role_list = ["Pypeclub"]
def register(self):
'''
Registers the action, subscribing the the discover and launch topics.
- highest priority event will show last
'''
self.session.event_hub.subscribe(
'topic=ftrack.action.discover',
self._discover,
priority=self.priority
)
launch_subscription = (
'topic=ftrack.action.launch'
' and data.actionIdentifier={0}'
).format(self.identifier)
self.session.event_hub.subscribe(
launch_subscription,
self._launch
)
def discover(self, session, entities, event):
""" Validation """
# Check if selection is valid