From 70034aee60baf780570a6535d3c078f7f76c6bac Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 21 Dec 2020 11:10:06 +0100 Subject: [PATCH] `plugins_presets` was removed as is not used anymore --- .../ftrack/actions/action_applications.py | 8 ++--- .../actions/action_batch_task_creation.py | 4 +-- .../action_clean_hierarchical_attributes.py | 4 +-- .../actions/action_client_review_sort.py | 4 +-- .../ftrack/actions/action_component_open.py | 4 +-- .../actions/action_create_cust_attrs.py | 4 +-- .../ftrack/actions/action_create_folders.py | 4 +-- .../action_create_project_structure.py | 4 +-- .../ftrack/actions/action_delete_asset.py | 4 +-- .../actions/action_delete_old_versions.py | 4 +-- .../modules/ftrack/actions/action_delivery.py | 4 +-- pype/modules/ftrack/actions/action_djvview.py | 9 +++-- .../ftrack/actions/action_job_killer.py | 4 +-- .../ftrack/actions/action_multiple_notes.py | 4 +-- .../ftrack/actions/action_prepare_project.py | 4 +-- pype/modules/ftrack/actions/action_rv.py | 13 +++---- pype/modules/ftrack/actions/action_seed.py | 4 +-- .../action_store_thumbnails_to_avalon.py | 4 +-- .../ftrack/actions/action_sync_to_avalon.py | 4 +-- pype/modules/ftrack/actions/action_test.py | 4 +-- .../actions/action_thumbnail_to_childern.py | 4 +-- .../actions/action_thumbnail_to_parent.py | 4 +-- .../ftrack/actions/action_where_run_ask.py | 4 +-- .../ftrack/actions/action_where_run_show.py | 4 +-- .../action_push_frame_values_to_task.py | 4 +-- .../ftrack/events/action_sync_to_avalon.py | 4 +-- .../events/event_del_avalon_id_from_new.py | 4 +-- .../events/event_first_version_status.py | 4 +-- .../ftrack/events/event_next_task_update.py | 4 +-- .../events/event_push_frame_values_to_task.py | 4 +-- .../ftrack/events/event_radio_buttons.py | 4 +-- .../ftrack/events/event_sync_to_avalon.py | 8 ++--- .../events/event_task_to_parent_status.py | 4 +-- .../events/event_task_to_version_status.py | 4 +-- pype/modules/ftrack/events/event_test.py | 8 ++--- .../ftrack/events/event_thumbnail_updates.py | 4 +-- .../ftrack/events/event_user_assigment.py | 4 +-- .../events/event_version_to_task_statuses.py | 4 +-- .../ftrack/ftrack_server/ftrack_server.py | 13 +------ .../ftrack/lib/ftrack_action_handler.py | 4 +-- .../modules/ftrack/lib/ftrack_base_handler.py | 34 ++++++------------- .../ftrack/lib/ftrack_event_handler.py | 4 --- 42 files changed, 97 insertions(+), 136 deletions(-) diff --git a/pype/modules/ftrack/actions/action_applications.py b/pype/modules/ftrack/actions/action_applications.py index cf047a658d..5b6657793a 100644 --- a/pype/modules/ftrack/actions/action_applications.py +++ b/pype/modules/ftrack/actions/action_applications.py @@ -28,8 +28,8 @@ class AppplicationsAction(BaseAction): identifier = "pype_app.{}.".format(str(uuid4())) icon_url = os.environ.get("PYPE_STATICS_SERVER") - def __init__(self, session, plugins_presets=None): - super().__init__(session, plugins_presets) + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) self.application_manager = ApplicationManager() self.dbcon = AvalonMongoDB() @@ -210,6 +210,6 @@ class AppplicationsAction(BaseAction): } -def register(session, plugins_presets=None): +def register(session): """Register action. Called when used as an event plugin.""" - AppplicationsAction(session, plugins_presets).register() + AppplicationsAction(session).register() diff --git a/pype/modules/ftrack/actions/action_batch_task_creation.py b/pype/modules/ftrack/actions/action_batch_task_creation.py index ef370d55eb..477971773d 100644 --- a/pype/modules/ftrack/actions/action_batch_task_creation.py +++ b/pype/modules/ftrack/actions/action_batch_task_creation.py @@ -158,7 +158,7 @@ class BatchTasksAction(BaseAction): } -def register(session, plugins_presets=None): +def register(session): '''Register action. Called when used as an event plugin.''' - BatchTasksAction(session, plugins_presets).register() + BatchTasksAction(session).register() diff --git a/pype/modules/ftrack/actions/action_clean_hierarchical_attributes.py b/pype/modules/ftrack/actions/action_clean_hierarchical_attributes.py index e81e587f0a..dc3a638192 100644 --- a/pype/modules/ftrack/actions/action_clean_hierarchical_attributes.py +++ b/pype/modules/ftrack/actions/action_clean_hierarchical_attributes.py @@ -98,7 +98,7 @@ class CleanHierarchicalAttrsAction(BaseAction): return True -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - CleanHierarchicalAttrsAction(session, plugins_presets).register() + CleanHierarchicalAttrsAction(session).register() diff --git a/pype/modules/ftrack/actions/action_client_review_sort.py b/pype/modules/ftrack/actions/action_client_review_sort.py index 72387fe695..1c5c429cf2 100644 --- a/pype/modules/ftrack/actions/action_client_review_sort.py +++ b/pype/modules/ftrack/actions/action_client_review_sort.py @@ -84,7 +84,7 @@ class ClientReviewSort(BaseAction): } -def register(session, plugins_presets={}): +def register(session): '''Register action. Called when used as an event plugin.''' - ClientReviewSort(session, plugins_presets).register() + ClientReviewSort(session).register() diff --git a/pype/modules/ftrack/actions/action_component_open.py b/pype/modules/ftrack/actions/action_component_open.py index 5fe8fe831b..2928f54b15 100644 --- a/pype/modules/ftrack/actions/action_component_open.py +++ b/pype/modules/ftrack/actions/action_component_open.py @@ -60,7 +60,7 @@ class ComponentOpen(BaseAction): } -def register(session, plugins_presets={}): +def register(session): '''Register action. Called when used as an event plugin.''' - ComponentOpen(session, plugins_presets).register() + ComponentOpen(session).register() diff --git a/pype/modules/ftrack/actions/action_create_cust_attrs.py b/pype/modules/ftrack/actions/action_create_cust_attrs.py index a63c77c198..9d6c16b556 100644 --- a/pype/modules/ftrack/actions/action_create_cust_attrs.py +++ b/pype/modules/ftrack/actions/action_create_cust_attrs.py @@ -814,7 +814,7 @@ class CustomAttributes(BaseAction): } -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - CustomAttributes(session, plugins_presets).register() + CustomAttributes(session).register() diff --git a/pype/modules/ftrack/actions/action_create_folders.py b/pype/modules/ftrack/actions/action_create_folders.py index a131a0e35b..d70232ae8f 100644 --- a/pype/modules/ftrack/actions/action_create_folders.py +++ b/pype/modules/ftrack/actions/action_create_folders.py @@ -243,6 +243,6 @@ class CreateFolders(BaseAction): return os.path.normpath(filled_template.split("{")[0]) -def register(session, plugins_presets={}): +def register(session): """Register plugin. Called when used as an plugin.""" - CreateFolders(session, plugins_presets).register() + CreateFolders(session).register() diff --git a/pype/modules/ftrack/actions/action_create_project_structure.py b/pype/modules/ftrack/actions/action_create_project_structure.py index 0815f82a69..64b4ba6727 100644 --- a/pype/modules/ftrack/actions/action_create_project_structure.py +++ b/pype/modules/ftrack/actions/action_create_project_structure.py @@ -238,5 +238,5 @@ class CreateProjectFolders(BaseAction): os.makedirs(path.format(project_root=project_root)) -def register(session, plugins_presets={}): - CreateProjectFolders(session, plugins_presets).register() +def register(session): + CreateProjectFolders(session).register() diff --git a/pype/modules/ftrack/actions/action_delete_asset.py b/pype/modules/ftrack/actions/action_delete_asset.py index 7d2dac3320..4720273c81 100644 --- a/pype/modules/ftrack/actions/action_delete_asset.py +++ b/pype/modules/ftrack/actions/action_delete_asset.py @@ -662,7 +662,7 @@ class DeleteAssetSubset(BaseAction): } -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - DeleteAssetSubset(session, plugins_presets).register() + DeleteAssetSubset(session).register() diff --git a/pype/modules/ftrack/actions/action_delete_old_versions.py b/pype/modules/ftrack/actions/action_delete_old_versions.py index b55f091fdc..31d15da9e5 100644 --- a/pype/modules/ftrack/actions/action_delete_old_versions.py +++ b/pype/modules/ftrack/actions/action_delete_old_versions.py @@ -577,7 +577,7 @@ class DeleteOldVersions(BaseAction): return (os.path.normpath(path), sequence_path) -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - DeleteOldVersions(session, plugins_presets).register() + DeleteOldVersions(session).register() diff --git a/pype/modules/ftrack/actions/action_delivery.py b/pype/modules/ftrack/actions/action_delivery.py index 0f63f7f7ea..853fe64ec7 100644 --- a/pype/modules/ftrack/actions/action_delivery.py +++ b/pype/modules/ftrack/actions/action_delivery.py @@ -692,7 +692,7 @@ class Delivery(BaseAction): } -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - Delivery(session, plugins_presets).register() + Delivery(session).register() diff --git a/pype/modules/ftrack/actions/action_djvview.py b/pype/modules/ftrack/actions/action_djvview.py index 6f667c0604..6036f9a35b 100644 --- a/pype/modules/ftrack/actions/action_djvview.py +++ b/pype/modules/ftrack/actions/action_djvview.py @@ -20,9 +20,8 @@ class DJVViewAction(BaseAction): "sgi", "rgba", "rgb", "bw", "tga", "tiff", "tif", "img" ] - def __init__(self, session, plugins_presets): - '''Expects a ftrack_api.Session instance''' - super().__init__(session, plugins_presets) + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) self.djv_path = self.find_djv_path() @@ -208,7 +207,7 @@ class DJVViewAction(BaseAction): return True -def register(session, plugins_presets={}): +def register(session): """Register hooks.""" - DJVViewAction(session, plugins_presets).register() + DJVViewAction(session).register() diff --git a/pype/modules/ftrack/actions/action_job_killer.py b/pype/modules/ftrack/actions/action_job_killer.py index ff23da2a54..cb193b88ce 100644 --- a/pype/modules/ftrack/actions/action_job_killer.py +++ b/pype/modules/ftrack/actions/action_job_killer.py @@ -112,7 +112,7 @@ class JobKiller(BaseAction): } -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - JobKiller(session, plugins_presets).register() + JobKiller(session).register() diff --git a/pype/modules/ftrack/actions/action_multiple_notes.py b/pype/modules/ftrack/actions/action_multiple_notes.py index c1a5cc6ce0..d88a91dd92 100644 --- a/pype/modules/ftrack/actions/action_multiple_notes.py +++ b/pype/modules/ftrack/actions/action_multiple_notes.py @@ -104,7 +104,7 @@ class MultipleNotes(BaseAction): return True -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - MultipleNotes(session, plugins_presets).register() + MultipleNotes(session).register() diff --git a/pype/modules/ftrack/actions/action_prepare_project.py b/pype/modules/ftrack/actions/action_prepare_project.py index 970bb3d86b..98493f65c7 100644 --- a/pype/modules/ftrack/actions/action_prepare_project.py +++ b/pype/modules/ftrack/actions/action_prepare_project.py @@ -454,6 +454,6 @@ class PrepareProject(BaseAction): self.log.debug("*** Creating project specifig configs Finished ***") -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - PrepareProject(session, plugins_presets).register() + PrepareProject(session).register() diff --git a/pype/modules/ftrack/actions/action_rv.py b/pype/modules/ftrack/actions/action_rv.py index eeb5672047..1c5ccfaed0 100644 --- a/pype/modules/ftrack/actions/action_rv.py +++ b/pype/modules/ftrack/actions/action_rv.py @@ -19,13 +19,8 @@ class RVAction(BaseAction): allowed_types = ["img", "mov", "exr", "mp4"] - def __init__(self, session, plugins_presets): - """ Constructor - - :param session: ftrack Session - :type session: :class:`ftrack_api.Session` - """ - super().__init__(session, plugins_presets) + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) # QUESTION load RV application data from AppplicationManager? rv_path = None @@ -317,7 +312,7 @@ class RVAction(BaseAction): return paths -def register(session, plugins_presets={}): +def register(session): """Register hooks.""" - RVAction(session, plugins_presets).register() + RVAction(session).register() diff --git a/pype/modules/ftrack/actions/action_seed.py b/pype/modules/ftrack/actions/action_seed.py index d6288a03aa..2610a25024 100644 --- a/pype/modules/ftrack/actions/action_seed.py +++ b/pype/modules/ftrack/actions/action_seed.py @@ -428,7 +428,7 @@ class SeedDebugProject(BaseAction): return True -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - SeedDebugProject(session, plugins_presets).register() + SeedDebugProject(session).register() diff --git a/pype/modules/ftrack/actions/action_store_thumbnails_to_avalon.py b/pype/modules/ftrack/actions/action_store_thumbnails_to_avalon.py index e6f98d23cd..6df8271381 100644 --- a/pype/modules/ftrack/actions/action_store_thumbnails_to_avalon.py +++ b/pype/modules/ftrack/actions/action_store_thumbnails_to_avalon.py @@ -457,5 +457,5 @@ class StoreThumbnailsToAvalon(BaseAction): return output -def register(session, plugins_presets={}): - StoreThumbnailsToAvalon(session, plugins_presets).register() +def register(session): + StoreThumbnailsToAvalon(session).register() diff --git a/pype/modules/ftrack/actions/action_sync_to_avalon.py b/pype/modules/ftrack/actions/action_sync_to_avalon.py index dfe1f2c464..6077511092 100644 --- a/pype/modules/ftrack/actions/action_sync_to_avalon.py +++ b/pype/modules/ftrack/actions/action_sync_to_avalon.py @@ -187,7 +187,7 @@ class SyncToAvalonLocal(BaseAction): pass -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - SyncToAvalonLocal(session, plugins_presets).register() + SyncToAvalonLocal(session).register() diff --git a/pype/modules/ftrack/actions/action_test.py b/pype/modules/ftrack/actions/action_test.py index e4936274b3..c12906e340 100644 --- a/pype/modules/ftrack/actions/action_test.py +++ b/pype/modules/ftrack/actions/action_test.py @@ -22,5 +22,5 @@ class TestAction(BaseAction): return True -def register(session, plugins_presets={}): - TestAction(session, plugins_presets).register() +def register(session): + TestAction(session).register() diff --git a/pype/modules/ftrack/actions/action_thumbnail_to_childern.py b/pype/modules/ftrack/actions/action_thumbnail_to_childern.py index 3c6af10b43..604688d221 100644 --- a/pype/modules/ftrack/actions/action_thumbnail_to_childern.py +++ b/pype/modules/ftrack/actions/action_thumbnail_to_childern.py @@ -59,7 +59,7 @@ class ThumbToChildren(BaseAction): } -def register(session, plugins_presets={}): +def register(session): '''Register action. Called when used as an event plugin.''' - ThumbToChildren(session, plugins_presets).register() + ThumbToChildren(session).register() diff --git a/pype/modules/ftrack/actions/action_thumbnail_to_parent.py b/pype/modules/ftrack/actions/action_thumbnail_to_parent.py index fb473f9aa5..5734ea6abc 100644 --- a/pype/modules/ftrack/actions/action_thumbnail_to_parent.py +++ b/pype/modules/ftrack/actions/action_thumbnail_to_parent.py @@ -85,7 +85,7 @@ class ThumbToParent(BaseAction): } -def register(session, plugins_presets={}): +def register(session): '''Register action. Called when used as an event plugin.''' - ThumbToParent(session, plugins_presets).register() + ThumbToParent(session).register() diff --git a/pype/modules/ftrack/actions/action_where_run_ask.py b/pype/modules/ftrack/actions/action_where_run_ask.py index 42640fb506..64957208da 100644 --- a/pype/modules/ftrack/actions/action_where_run_ask.py +++ b/pype/modules/ftrack/actions/action_where_run_ask.py @@ -27,7 +27,7 @@ class ActionAskWhereIRun(BaseAction): return True -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - ActionAskWhereIRun(session, plugins_presets).register() + ActionAskWhereIRun(session).register() diff --git a/pype/modules/ftrack/actions/action_where_run_show.py b/pype/modules/ftrack/actions/action_where_run_show.py index a084547a45..f872d17d27 100644 --- a/pype/modules/ftrack/actions/action_where_run_show.py +++ b/pype/modules/ftrack/actions/action_where_run_show.py @@ -76,7 +76,7 @@ class ActionShowWhereIRun(BaseAction): return True -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - ActionShowWhereIRun(session, plugins_presets).register() + ActionShowWhereIRun(session).register() diff --git a/pype/modules/ftrack/events/action_push_frame_values_to_task.py b/pype/modules/ftrack/events/action_push_frame_values_to_task.py index de61728a62..87d9d5afe9 100644 --- a/pype/modules/ftrack/events/action_push_frame_values_to_task.py +++ b/pype/modules/ftrack/events/action_push_frame_values_to_task.py @@ -430,5 +430,5 @@ class PushHierValuesToNonHier(ServerAction): session.commit() -def register(session, plugins_presets={}): - PushHierValuesToNonHier(session, plugins_presets).register() +def register(session): + PushHierValuesToNonHier(session).register() diff --git a/pype/modules/ftrack/events/action_sync_to_avalon.py b/pype/modules/ftrack/events/action_sync_to_avalon.py index 80b5939d84..486b977f04 100644 --- a/pype/modules/ftrack/events/action_sync_to_avalon.py +++ b/pype/modules/ftrack/events/action_sync_to_avalon.py @@ -182,6 +182,6 @@ class SyncToAvalonServer(ServerAction): pass -def register(session, plugins_presets={}): +def register(session): '''Register plugin. Called when used as an plugin.''' - SyncToAvalonServer(session, plugins_presets).register() + SyncToAvalonServer(session).register() diff --git a/pype/modules/ftrack/events/event_del_avalon_id_from_new.py b/pype/modules/ftrack/events/event_del_avalon_id_from_new.py index ee82c9589d..21e581e76a 100644 --- a/pype/modules/ftrack/events/event_del_avalon_id_from_new.py +++ b/pype/modules/ftrack/events/event_del_avalon_id_from_new.py @@ -47,6 +47,6 @@ class DelAvalonIdFromNew(BaseEvent): continue -def register(session, plugins_presets): +def register(session): '''Register plugin. Called when used as an plugin.''' - DelAvalonIdFromNew(session, plugins_presets).register() + DelAvalonIdFromNew(session).register() diff --git a/pype/modules/ftrack/events/event_first_version_status.py b/pype/modules/ftrack/events/event_first_version_status.py index 8754d092ab..cfca047c09 100644 --- a/pype/modules/ftrack/events/event_first_version_status.py +++ b/pype/modules/ftrack/events/event_first_version_status.py @@ -182,7 +182,7 @@ class FirstVersionStatus(BaseEvent): return filtered_ents -def register(session, plugins_presets): +def register(session): '''Register plugin. Called when used as an plugin.''' - FirstVersionStatus(session, plugins_presets).register() + FirstVersionStatus(session).register() diff --git a/pype/modules/ftrack/events/event_next_task_update.py b/pype/modules/ftrack/events/event_next_task_update.py index deb789f981..025bac0d07 100644 --- a/pype/modules/ftrack/events/event_next_task_update.py +++ b/pype/modules/ftrack/events/event_next_task_update.py @@ -225,5 +225,5 @@ class NextTaskUpdate(BaseEvent): ) -def register(session, plugins_presets): - NextTaskUpdate(session, plugins_presets).register() +def register(session): + NextTaskUpdate(session).register() diff --git a/pype/modules/ftrack/events/event_push_frame_values_to_task.py b/pype/modules/ftrack/events/event_push_frame_values_to_task.py index 00457c8bfc..061002c13f 100644 --- a/pype/modules/ftrack/events/event_push_frame_values_to_task.py +++ b/pype/modules/ftrack/events/event_push_frame_values_to_task.py @@ -364,5 +364,5 @@ class PushFrameValuesToTaskEvent(BaseEvent): return output, hiearchical -def register(session, plugins_presets): - PushFrameValuesToTaskEvent(session, plugins_presets).register() +def register(session): + PushFrameValuesToTaskEvent(session).register() diff --git a/pype/modules/ftrack/events/event_radio_buttons.py b/pype/modules/ftrack/events/event_radio_buttons.py index b2ab4e75ec..90811e5f45 100644 --- a/pype/modules/ftrack/events/event_radio_buttons.py +++ b/pype/modules/ftrack/events/event_radio_buttons.py @@ -34,7 +34,7 @@ class RadioButtons(BaseEvent): session.commit() -def register(session, plugins_presets): +def register(session): '''Register plugin. Called when used as an plugin.''' - RadioButtons(session, plugins_presets).register() + RadioButtons(session).register() diff --git a/pype/modules/ftrack/events/event_sync_to_avalon.py b/pype/modules/ftrack/events/event_sync_to_avalon.py index 2a69a559bd..0209dfd53a 100644 --- a/pype/modules/ftrack/events/event_sync_to_avalon.py +++ b/pype/modules/ftrack/events/event_sync_to_avalon.py @@ -53,7 +53,7 @@ class SyncToAvalonEvent(BaseEvent): created_entities = [] report_splitter = {"type": "label", "value": "---"} - def __init__(self, session, plugins_presets={}): + def __init__(self, session): '''Expects a ftrack_api.Session instance''' # Debug settings # - time expiration in seconds @@ -67,7 +67,7 @@ class SyncToAvalonEvent(BaseEvent): self.dbcon = AvalonMongoDB() # Set processing session to not use global self.set_process_session(session) - super().__init__(session, plugins_presets) + super().__init__(session) def debug_logs(self): """This is debug method for printing small debugs messages. """ @@ -2513,6 +2513,6 @@ class SyncToAvalonEvent(BaseEvent): return mongo_id_configuration_id -def register(session, plugins_presets): +def register(session): '''Register plugin. Called when used as an plugin.''' - SyncToAvalonEvent(session, plugins_presets).register() + SyncToAvalonEvent(session).register() diff --git a/pype/modules/ftrack/events/event_task_to_parent_status.py b/pype/modules/ftrack/events/event_task_to_parent_status.py index 4620f84395..2bb7be1a26 100644 --- a/pype/modules/ftrack/events/event_task_to_parent_status.py +++ b/pype/modules/ftrack/events/event_task_to_parent_status.py @@ -419,5 +419,5 @@ class TaskStatusToParent(BaseEvent): return output -def register(session, plugins_presets): - TaskStatusToParent(session, plugins_presets).register() +def register(session): + TaskStatusToParent(session).register() diff --git a/pype/modules/ftrack/events/event_task_to_version_status.py b/pype/modules/ftrack/events/event_task_to_version_status.py index b49fd01a91..8d226424c3 100644 --- a/pype/modules/ftrack/events/event_task_to_version_status.py +++ b/pype/modules/ftrack/events/event_task_to_version_status.py @@ -372,5 +372,5 @@ class TaskToVersionStatus(BaseEvent): return last_asset_versions_by_task_id -def register(session, plugins_presets): - TaskToVersionStatus(session, plugins_presets).register() +def register(session): + TaskToVersionStatus(session).register() diff --git a/pype/modules/ftrack/events/event_test.py b/pype/modules/ftrack/events/event_test.py index 0a86bd1754..c07f8b8d16 100644 --- a/pype/modules/ftrack/events/event_test.py +++ b/pype/modules/ftrack/events/event_test.py @@ -1,7 +1,3 @@ -import os -import sys -import re -import ftrack_api from pype.modules.ftrack import BaseEvent @@ -20,7 +16,7 @@ class TestEvent(BaseEvent): return True -def register(session, plugins_presets): +def register(session): '''Register plugin. Called when used as an plugin.''' - TestEvent(session, plugins_presets).register() + TestEvent(session).register() diff --git a/pype/modules/ftrack/events/event_thumbnail_updates.py b/pype/modules/ftrack/events/event_thumbnail_updates.py index 0044c5e21c..09d992b8c4 100644 --- a/pype/modules/ftrack/events/event_thumbnail_updates.py +++ b/pype/modules/ftrack/events/event_thumbnail_updates.py @@ -151,5 +151,5 @@ class ThumbnailEvents(BaseEvent): return filtered_entities_info -def register(session, plugins_presets): - ThumbnailEvents(session, plugins_presets).register() +def register(session): + ThumbnailEvents(session).register() diff --git a/pype/modules/ftrack/events/event_user_assigment.py b/pype/modules/ftrack/events/event_user_assigment.py index 9b0dfe84d1..59880fabe5 100644 --- a/pype/modules/ftrack/events/event_user_assigment.py +++ b/pype/modules/ftrack/events/event_user_assigment.py @@ -250,9 +250,9 @@ class UserAssigmentEvent(BaseEvent): return True -def register(session, plugins_presets): +def register(session): """ Register plugin. Called when used as an plugin. """ - UserAssigmentEvent(session, plugins_presets).register() + UserAssigmentEvent(session).register() diff --git a/pype/modules/ftrack/events/event_version_to_task_statuses.py b/pype/modules/ftrack/events/event_version_to_task_statuses.py index d094c2a8fd..03f873f2cd 100644 --- a/pype/modules/ftrack/events/event_version_to_task_statuses.py +++ b/pype/modules/ftrack/events/event_version_to_task_statuses.py @@ -241,7 +241,7 @@ class VersionToTaskStatus(BaseEvent): return output -def register(session, plugins_presets): +def register(session): '''Register plugin. Called when used as an plugin.''' - VersionToTaskStatus(session, plugins_presets).register() + VersionToTaskStatus(session).register() diff --git a/pype/modules/ftrack/ftrack_server/ftrack_server.py b/pype/modules/ftrack/ftrack_server/ftrack_server.py index 93c7cd3a67..3e0c752596 100644 --- a/pype/modules/ftrack/ftrack_server/ftrack_server.py +++ b/pype/modules/ftrack/ftrack_server/ftrack_server.py @@ -108,21 +108,10 @@ class FtrackServer: " in registered paths: \"{}\"" ).format("| ".join(paths))) - # TODO replace with settings or get rid of passing the dictionary - plugins_presets = {} - - function_counter = 0 for function_dict in register_functions_dict: register = function_dict["register"] try: - if len(inspect.signature(register).parameters) == 1: - register(self.session) - else: - register(self.session, plugins_presets=plugins_presets) - - if function_counter % 7 == 0: - time.sleep(0.1) - function_counter += 1 + register(self.session) except Exception as exc: msg = '"{}" - register was not successful ({})'.format( function_dict['name'], str(exc) diff --git a/pype/modules/ftrack/lib/ftrack_action_handler.py b/pype/modules/ftrack/lib/ftrack_action_handler.py index a550d9e7d3..e04ed6b404 100644 --- a/pype/modules/ftrack/lib/ftrack_action_handler.py +++ b/pype/modules/ftrack/lib/ftrack_action_handler.py @@ -29,7 +29,7 @@ class BaseAction(BaseHandler): icon = None type = 'Action' - def __init__(self, session, plugins_presets={}): + def __init__(self, session): '''Expects a ftrack_api.Session instance''' if self.label is None: raise ValueError('Action missing label.') @@ -37,7 +37,7 @@ class BaseAction(BaseHandler): if self.identifier is None: raise ValueError('Action missing identifier.') - super().__init__(session, plugins_presets) + super().__init__(session) def register(self): ''' diff --git a/pype/modules/ftrack/lib/ftrack_base_handler.py b/pype/modules/ftrack/lib/ftrack_base_handler.py index 72b6272b76..022c4f0829 100644 --- a/pype/modules/ftrack/lib/ftrack_base_handler.py +++ b/pype/modules/ftrack/lib/ftrack_base_handler.py @@ -44,7 +44,7 @@ class BaseHandler(object): """Helper to join keys to query.""" return ",".join(["\"{}\"".format(key) for key in keys]) - def __init__(self, session, plugins_presets=None): + def __init__(self, session): '''Expects a ftrack_api.Session instance''' self.log = Logger().get_logger(self.__class__.__name__) if not( @@ -65,31 +65,19 @@ class BaseHandler(object): # Using decorator self.register = self.register_decorator(self.register) self.launch = self.launch_log(self.launch) - if plugins_presets is None: - plugins_presets = {} - self.plugins_presets = plugins_presets # Decorator def register_decorator(self, func): @functools.wraps(func) def wrapper_register(*args, **kwargs): - - presets_data = self.plugins_presets.get(self.__class__.__name__) - if presets_data: - for key, value in presets_data.items(): - if not hasattr(self, key): - continue - setattr(self, key, value) - if self.ignore_me: return - label = self.__class__.__name__ - if hasattr(self, 'label'): - if self.variant is None: - label = self.label - else: - label = '{} {}'.format(self.label, self.variant) + label = getattr(self, "label", self.__class__.__name__) + variant = getattr(self, "variant", None) + if variant: + label = "{} {}".format(label, variant) + try: self._preregister() @@ -126,12 +114,10 @@ class BaseHandler(object): def launch_log(self, func): @functools.wraps(func) def wrapper_launch(*args, **kwargs): - label = self.__class__.__name__ - if hasattr(self, 'label'): - label = self.label - if hasattr(self, 'variant'): - if self.variant is not None: - label = '{} {}'.format(self.label, self.variant) + label = getattr(self, "label", self.__class__.__name__) + variant = getattr(self, "variant", None) + if variant: + label = "{} {}".format(label, variant) self.log.info(('{} "{}": Launched').format(self.type, label)) try: diff --git a/pype/modules/ftrack/lib/ftrack_event_handler.py b/pype/modules/ftrack/lib/ftrack_event_handler.py index 770b942844..53b78ccc17 100644 --- a/pype/modules/ftrack/lib/ftrack_event_handler.py +++ b/pype/modules/ftrack/lib/ftrack_event_handler.py @@ -15,10 +15,6 @@ class BaseEvent(BaseHandler): type = 'Event' - def __init__(self, session, plugins_presets={}): - '''Expects a ftrack_api.Session instance''' - super().__init__(session, plugins_presets) - # Decorator def launch_log(self, func): @functools.wraps(func)