From 62df82e82ca8d559b106ea5d6a9cce0b14335a42 Mon Sep 17 00:00:00 2001 From: Jesse Spielman Date: Mon, 27 Jun 2016 11:40:29 +0100 Subject: [PATCH] Add custom hook to specify successful publish message --- hooks/successful_publish_result.py | 31 +++++++++++++++++++ info.yml | 6 ++++ .../tk_multi_publish/publish_result_form.py | 5 ++- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 hooks/successful_publish_result.py diff --git a/hooks/successful_publish_result.py b/hooks/successful_publish_result.py new file mode 100644 index 0000000..1b6844a --- /dev/null +++ b/hooks/successful_publish_result.py @@ -0,0 +1,31 @@ +# Copyright (c) 2013 Shotgun Software Inc. +# +# CONFIDENTIAL AND PROPRIETARY +# +# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit +# Source Code License included in this distribution package. See LICENSE. +# By accessing, using, copying or modifying this work you indicate your +# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights +# not expressly granted therein are reserved by Shotgun Software Inc. + +import tank +from tank import Hook + +class SuccessHook(Hook): + """ + Hook that can be used to provide a custom successful completion message + for publishing + """ + def execute(self, **kwargs): + """ + Main hook entry point + :returns: String + Hook should return the message + """ + details = ("Your Publish has successfully completed. Your " + "work has been shared, your scene has been " + "versioned up and your mates have been notified!") + + return details + + diff --git a/info.yml b/info.yml index bec1d40..fddb374 100644 --- a/info.yml +++ b/info.yml @@ -31,6 +31,12 @@ configuration: default_value: thumbnail description: Specify a hook to pre-generate a thumbnail for the publish. + hook_successful_publish_result: + type: hook + parameters: [] + default_value: successful_publish_result + description: Specify a hook to provide a custom message upon a sucessful publish + hook_copy_file: type: hook parameters: [source_path, target_path, task] diff --git a/python/tk_multi_publish/publish_result_form.py b/python/tk_multi_publish/publish_result_form.py index 8585fb9..b145303 100644 --- a/python/tk_multi_publish/publish_result_form.py +++ b/python/tk_multi_publish/publish_result_form.py @@ -63,9 +63,8 @@ def _update_ui(self): details = "" if self._status: - details = ("Your Publish has successfully completed. Your " - "work has been shared, your scene has been " - "versioned up and your mates have been notified!") + app = tank.platform.current_bundle() + details = app.execute_hook("hook_successful_publish_result") else: details = "\n\n".join(self._errors) self._ui.status_details.setText(details)