Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
moved timer change on task change to timers manager module
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT committed Jun 16, 2022
1 parent 89a7d43 commit cbb876c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
18 changes: 18 additions & 0 deletions openpype/modules/timers_manager/timers_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
ITrayService,
ILaunchHookPaths
)
from openpype.lib.events import register_event_callback
from openpype.pipeline import AvalonMongoDB

from .exceptions import InvalidContextError
Expand Down Expand Up @@ -422,3 +423,20 @@ def start_timer_with_webserver(
}

return requests.post(rest_api_url, json=data)

def on_host_install(self, host, host_name, project_name):
self.log.debug("Installing task changed callback")
register_event_callback("taskChanged", self._on_host_task_change)

def _on_host_task_change(self, event):
project_name = event["project_name"]
asset_name = event["asset_name"]
task_name = event["task_name"]
self.log.debug((
"Sending message that timer should change to"
" Project: {} Asset: {} Task: {}"
).format(project_name, asset_name, task_name))

self.start_timer_with_webserver(
project_name, asset_name, task_name, self.log
)
8 changes: 0 additions & 8 deletions openpype/pipeline/context_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
from openpype.settings import get_project_settings
from openpype.lib import (
Anatomy,
register_event_callback,
filter_pyblish_plugins,
change_timer_to_current_context,
)

from . import (
Expand Down Expand Up @@ -117,8 +115,6 @@ def install_host(host):

register_host(host)

register_event_callback("taskChanged", _on_task_change)

def modified_emit(obj, record):
"""Method replacing `emit` in Pyblish's MessageHandler."""
record.msg = record.getMessage()
Expand Down Expand Up @@ -197,10 +193,6 @@ def install_openpype_plugins(project_name=None, host_name=None):
register_inventory_action(path)


def _on_task_change():
change_timer_to_current_context()


def uninstall_host():
"""Undo all of what `install()` did"""
host = registered_host()
Expand Down

0 comments on commit cbb876c

Please sign in to comment.