Merge pull request #2049 from pypeclub/feature/ftrack_without_interface

Ftrack: Removed ftrack interface
This commit is contained in:
Jakub Trllo 2021-09-22 11:29:10 +02:00 committed by GitHub
commit 1b0515090f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 34 deletions

View file

@ -10,16 +10,14 @@ from .constants import (
from openpype.modules import OpenPypeModule from openpype.modules import OpenPypeModule
from openpype_interfaces import ( from openpype_interfaces import (
ITrayModule, ITrayModule,
IPluginPaths, IPluginPaths
IFtrackEventHandlerPaths
) )
class ClockifyModule( class ClockifyModule(
OpenPypeModule, OpenPypeModule,
ITrayModule, ITrayModule,
IPluginPaths, IPluginPaths
IFtrackEventHandlerPaths
): ):
name = "clockify" name = "clockify"
@ -93,8 +91,8 @@ class ClockifyModule(
"actions": [actions_path] "actions": [actions_path]
} }
def get_event_handler_paths(self): def get_ftrack_event_handler_paths(self):
"""Implementaton of IFtrackEventHandlerPaths to get plugin paths.""" """Function for Ftrack module to add ftrack event handler paths."""
return { return {
"user": [CLOCKIFY_FTRACK_USER_PATH], "user": [CLOCKIFY_FTRACK_USER_PATH],
"server": [CLOCKIFY_FTRACK_SERVER_PATH] "server": [CLOCKIFY_FTRACK_SERVER_PATH]

View file

@ -8,8 +8,7 @@ from openpype_interfaces import (
ITrayModule, ITrayModule,
IPluginPaths, IPluginPaths,
ILaunchHookPaths, ILaunchHookPaths,
ISettingsChangeListener, ISettingsChangeListener
IFtrackEventHandlerPaths
) )
from openpype.settings import SaveWarningExc from openpype.settings import SaveWarningExc
@ -81,9 +80,17 @@ class FtrackModule(
def connect_with_modules(self, enabled_modules): def connect_with_modules(self, enabled_modules):
for module in enabled_modules: for module in enabled_modules:
if not isinstance(module, IFtrackEventHandlerPaths): if not hasattr(module, "get_ftrack_event_handler_paths"):
continue continue
paths_by_type = module.get_event_handler_paths() or {}
try:
paths_by_type = module.get_ftrack_event_handler_paths()
except Exception:
continue
if not isinstance(paths_by_type, dict):
continue
for key, value in paths_by_type.items(): for key, value in paths_by_type.items():
if not value: if not value:
continue continue

View file

@ -1,12 +0,0 @@
from abc import abstractmethod
from openpype.modules import OpenPypeInterface
class IFtrackEventHandlerPaths(OpenPypeInterface):
"""Other modules interface to return paths to ftrack event handlers.
Expected output is dictionary with "server" and "user" keys.
"""
@abstractmethod
def get_event_handler_paths(self):
pass

View file

@ -5,8 +5,7 @@ from .constants import (
CUST_ATTR_TOOLS, CUST_ATTR_TOOLS,
CUST_ATTR_APPLICATIONS CUST_ATTR_APPLICATIONS
) )
from . settings import ( from .settings import (
get_ftrack_url_from_settings,
get_ftrack_event_mongo_info get_ftrack_event_mongo_info
) )
from .custom_attributes import ( from .custom_attributes import (
@ -31,7 +30,6 @@ __all__ = (
"CUST_ATTR_TOOLS", "CUST_ATTR_TOOLS",
"CUST_ATTR_APPLICATIONS", "CUST_ATTR_APPLICATIONS",
"get_ftrack_url_from_settings",
"get_ftrack_event_mongo_info", "get_ftrack_event_mongo_info",
"default_custom_attributes_definition", "default_custom_attributes_definition",

View file

@ -1,13 +1,4 @@
import os import os
from openpype.api import get_system_settings
def get_ftrack_settings():
return get_system_settings()["modules"]["ftrack"]
def get_ftrack_url_from_settings():
return get_ftrack_settings()["ftrack_server"]
def get_ftrack_event_mongo_info(): def get_ftrack_event_mongo_info():