mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
Merge pull request #826 from pypeclub/feature/remove_start_timer_action
Removed start timer action
This commit is contained in:
commit
a33bbfd5a4
2 changed files with 7 additions and 58 deletions
|
|
@ -176,22 +176,10 @@ class PostFtrackHook(PostLaunchHook):
|
|||
)
|
||||
return
|
||||
|
||||
source = {
|
||||
"user": {
|
||||
"id": user_entity["id"],
|
||||
"username": user_entity["username"]
|
||||
}
|
||||
}
|
||||
event_data = {
|
||||
"actionIdentifier": "start.timer",
|
||||
"selection": [{"entityId": entity["id"], "entityType": "task"}]
|
||||
}
|
||||
session.event_hub.publish(
|
||||
_ftrack_api.event.base.Event(
|
||||
topic="ftrack.action.launch",
|
||||
data=event_data,
|
||||
source=source
|
||||
),
|
||||
on_error="ignore"
|
||||
)
|
||||
self.log.debug("Timer start triggered successfully.")
|
||||
try:
|
||||
user_entity.start_timer(entity, force=True)
|
||||
session.commit()
|
||||
self.log.debug("Timer start triggered successfully.")
|
||||
|
||||
except Exception:
|
||||
self.log.warning("Couldn't trigger Ftrack timer.", exc_info=True)
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
from pype.modules.ftrack.lib import BaseAction
|
||||
|
||||
|
||||
class StartTimer(BaseAction):
|
||||
'''Starts timer.'''
|
||||
|
||||
identifier = 'start.timer'
|
||||
label = 'Start timer'
|
||||
description = 'Starts timer'
|
||||
|
||||
def discover(self, session, entities, event):
|
||||
return False
|
||||
|
||||
def _handle_result(*arg):
|
||||
return
|
||||
|
||||
def launch(self, session, entities, event):
|
||||
entity = entities[0]
|
||||
if entity.entity_type.lower() != 'task':
|
||||
return
|
||||
|
||||
user = self.session.query(
|
||||
"User where username is \"{}\"".format(self.session.api_user)
|
||||
).one()
|
||||
|
||||
user.start_timer(entity, force=True)
|
||||
self.session.commit()
|
||||
|
||||
self.log.info(
|
||||
"Starting Ftrack timer for task: {}".format(entity['name'])
|
||||
)
|
||||
|
||||
return
|
||||
|
||||
|
||||
def register(session, plugins_presets={}):
|
||||
'''Register plugin. Called when used as an plugin.'''
|
||||
|
||||
StartTimer(session, plugins_presets).register()
|
||||
Loading…
Add table
Add a link
Reference in a new issue