From d4112eb3fafbaf2c817d7771c12e40b36701f2a0 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 16 Dec 2021 17:15:27 +0100 Subject: [PATCH] moved the launch hook into timers manager --- .../launch_hooks}/post_start_timer.py | 3 --- .../timers_manager/timers_manager.py | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) rename openpype/{hooks => modules/default_modules/timers_manager/launch_hooks}/post_start_timer.py (96%) diff --git a/openpype/hooks/post_start_timer.py b/openpype/modules/default_modules/timers_manager/launch_hooks/post_start_timer.py similarity index 96% rename from openpype/hooks/post_start_timer.py rename to openpype/modules/default_modules/timers_manager/launch_hooks/post_start_timer.py index be2cec82b7..d6ae013403 100644 --- a/openpype/hooks/post_start_timer.py +++ b/openpype/modules/default_modules/timers_manager/launch_hooks/post_start_timer.py @@ -1,6 +1,3 @@ -import os - -from openpype.api import get_project_settings from openpype.lib import PostLaunchHook diff --git a/openpype/modules/default_modules/timers_manager/timers_manager.py b/openpype/modules/default_modules/timers_manager/timers_manager.py index 0ae0af4cdb..964e6d9a58 100644 --- a/openpype/modules/default_modules/timers_manager/timers_manager.py +++ b/openpype/modules/default_modules/timers_manager/timers_manager.py @@ -1,7 +1,10 @@ import os import platform from openpype.modules import OpenPypeModule -from openpype_interfaces import ITrayService +from openpype_interfaces import ( + ITrayService, + ILaunchHookPaths +) from avalon.api import AvalonMongoDB @@ -64,7 +67,7 @@ class ExampleTimersManagerConnector: self._timers_manager_module.timer_stopped(self._module.id) -class TimersManager(OpenPypeModule, ITrayService): +class TimersManager(OpenPypeModule, ITrayService, ILaunchHookPaths): """ Handles about Timers. Should be able to start/stop all timers at once. @@ -167,6 +170,13 @@ class TimersManager(OpenPypeModule, ITrayService): project_name, asset_name, task_name ) + def get_launch_hook_paths(self): + """Implementation of `ILaunchHookPaths`.""" + return os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "launch_hooks" + ) + def get_timer_data_for_context(self, project_name, asset_name, task_name): """Prepare data for timer related callbacks.