Skip to content

open_file

OpenFile

Bases: LoaderPlugin

Open Image Sequence or Video with system default

Source code in client/ayon_core/plugins/load/open_file.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class OpenFile(load.LoaderPlugin):
    """Open Image Sequence or Video with system default"""

    product_types = {"render2d"}
    representations = {"*"}

    label = "Open"
    order = -10
    icon = "play-circle"
    color = "orange"

    def load(self, context, name, namespace, data):

        path = self.filepath_from_context(context)
        if not os.path.exists(path):
            raise RuntimeError("File not found: {}".format(path))

        self.log.info("Opening : {}".format(path))
        open(path)

open(filepath)

Open file with system default executable

Source code in client/ayon_core/plugins/load/open_file.py
 8
 9
10
11
12
13
14
15
def open(filepath):
    """Open file with system default executable"""
    if sys.platform.startswith('darwin'):
        subprocess.call(('open', filepath))
    elif os.name == 'nt':
        os.startfile(filepath)
    elif os.name == 'posix':
        subprocess.call(('xdg-open', filepath))