mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
* Remove Loader `context` argument to __init__ * Add backwards compatibility for Loader.load by still setting `.fname` attr * Refactor/remove usage of `self.fname` in loaders * Fix some refactoring * Fix some refactoring * Hound * Revert invalid refactor * Fix refactor * Fix playblast panel collection * Refactor missing method * Fix typo * Use the correct `context` --------- Co-authored-by: Toke Stuart Jepsen <tokejepsen@gmail.com> Co-authored-by: Kayla Man <64118225+moonyuet@users.noreply.github.com> Co-authored-by: Jakub Trllo <jakub.trllo@gmail.com>
36 lines
882 B
Python
36 lines
882 B
Python
import sys
|
|
import os
|
|
import subprocess
|
|
|
|
from openpype.pipeline import load
|
|
|
|
|
|
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))
|
|
|
|
|
|
class OpenFile(load.LoaderPlugin):
|
|
"""Open Image Sequence or Video with system default"""
|
|
|
|
families = ["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)
|