forked from shotgunsoftware/tk-multi-publish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
58 lines (46 loc) · 1.95 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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.
"""
Multi Publish
"""
import os
import tank
from tank import TankError
class MultiPublish(tank.platform.Application):
def init_app(self):
"""
Called as the application is being initialized
"""
tk_multi_publish = self.import_module("tk_multi_publish")
self._publish_handler = tk_multi_publish.PublishHandler(self)
# register commands:
display_name = self.get_setting("display_name")
# "Publish Render" ---> publish_render
command_name = display_name.lower().replace(" ", "_")
if command_name.endswith("..."):
command_name = command_name[:-3]
params = {"short_name": command_name,
"title": "%s..." % display_name,
"description": "Publishing of data into Shotgun"}
self.engine.register_command("%s..." % display_name,
self._publish_handler.show_publish_dlg,
params)
def destroy_app(self):
self.log_debug("Destroying tk-multi-publish")
def copy_file(self, source_path, target_path, task):
"""
Utility method to copy a file from source_path to
target_path. Uses the copy file hook specified in
the configuration
"""
self.execute_hook("hook_copy_file",
source_path=source_path,
target_path=target_path,
task=task)