ayon-core/openpype/plugins/load/copy_file_path.py
2022-03-14 11:36:17 +01:00

28 lines
760 B
Python

import os
from openpype.pipeline import load
class CopyFilePath(load.LoaderPlugin):
"""Copy published file path to clipboard"""
representations = ["*"]
families = ["*"]
label = "Copy File Path"
order = 20
icon = "clipboard"
color = "#999999"
def load(self, context, name=None, namespace=None, data=None):
self.log.info("Added file path to clipboard: {0}".format(self.fname))
self.copy_path_to_clipboard(self.fname)
@staticmethod
def copy_path_to_clipboard(path):
from Qt import QtWidgets
clipboard = QtWidgets.QApplication.clipboard()
assert clipboard, "Must have running QApplication instance"
# Set to Clipboard
clipboard.setText(os.path.normpath(path))