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>
34 lines
1,017 B
Python
34 lines
1,017 B
Python
from openpype.style import get_default_entity_icon_color
|
|
from openpype.pipeline import load
|
|
|
|
|
|
class CopyFile(load.LoaderPlugin):
|
|
"""Copy the published file to be pasted at the desired location"""
|
|
|
|
representations = ["*"]
|
|
families = ["*"]
|
|
|
|
label = "Copy File"
|
|
order = 10
|
|
icon = "copy"
|
|
color = get_default_entity_icon_color()
|
|
|
|
def load(self, context, name=None, namespace=None, data=None):
|
|
path = self.filepath_from_context(context)
|
|
self.log.info("Added copy to clipboard: {0}".format(path))
|
|
self.copy_file_to_clipboard(path)
|
|
|
|
@staticmethod
|
|
def copy_file_to_clipboard(path):
|
|
from qtpy import QtCore, QtWidgets
|
|
|
|
clipboard = QtWidgets.QApplication.clipboard()
|
|
assert clipboard, "Must have running QApplication instance"
|
|
|
|
# Build mime data for clipboard
|
|
data = QtCore.QMimeData()
|
|
url = QtCore.QUrl.fromLocalFile(path)
|
|
data.setUrls([url])
|
|
|
|
# Set to Clipboard
|
|
clipboard.setMimeData(data)
|