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

Add custom hook to specify successful publish message #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions hooks/successful_publish_result.py
Original file line number Diff line number Diff line change
@@ -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


6 changes: 6 additions & 0 deletions info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
5 changes: 2 additions & 3 deletions python/tk_multi_publish/publish_result_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down