예제 #1
0
    def copy_file_to_clipboard(path):
        from avalon.vendor.Qt 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)
    def copy_id_to_clipboard(path):
        from avalon.vendor.Qt import QtCore, QtWidgets

        app = QtWidgets.QApplication.instance()
        assert app, "Must have running QApplication instance"

        # Build mime data for clipboard
        mime = QtCore.QMimeData()
        mime.setText(path)
        mime.setUrls([QtCore.QUrl.fromLocalFile(path)])

        # Set to Clipboard
        clipboard = app.clipboard()
        clipboard.setMimeData(mime)
예제 #3
0
    def copy_file_to_clipboard(path):
        from avalon.vendor.Qt import QtCore, QtWidgets

        app = QtWidgets.QApplication.instance()
        assert app, "Must have running QApplication instance"

        # Build mime data for clipboard
        file_path = QtCore.QUrl.fromLocalFile(path)
        byte_array = QtCore.QByteArray("copy\n").append(file_path)

        mime = QtCore.QMimeData()
        mime.setData("text/uri-list", byte_array)

        # Set to Clipboard
        clipboard = app.clipboard()
        clipboard.setMimeData(mime)