forked from shotgunsoftware/tk-multi-launchapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
59 lines (49 loc) · 2.18 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
59
# Copyright (c) 2016 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.
"""
App that launches applications.
"""
import sgtk
class LaunchApplication(sgtk.platform.Application):
"""
Multi App to launch applications.
"""
# documentation explaining how to reconfigure app paths
HELP_DOC_URL = "https://developer.shotgridsoftware.com/1b9c259a/?title=Launch+App#Setting%20up%20Application%20Paths"
def init_app(self):
"""
Called as app is being initialized
"""
# Use the Launchers defined in the tk_multi_launchapp payload
# to do all of the heavy lifting for this app
app_payload = self.import_module("tk_multi_launchapp")
if self.get_setting("use_software_entity"):
# For zero config type setups
self._launcher = app_payload.SoftwareEntityLauncher()
else:
# For traditional setups
self._launcher = app_payload.SingleConfigLauncher()
# Register the appropriate DCC launch commands
self._launcher.register_launch_commands()
def launch_from_path_and_context(self, path, context, version=None):
"""
Launch an app with the specified path and context. The context can
contain more information than is available from the path itself,
such as Task information.
"""
self._launcher.launch_from_path_and_context(path, context, version)
def launch_from_path(self, path, version=None):
"""
Launch an app to open the specified file path. Also derive the
context from this path. Note that there are no checks that the
input path is actually compatible with the app that is being launched.
This should be handled in logic which is external to this app.
"""
self._launcher.launch_from_path(path, version)