Pastes files from clipboard.
352157
def paste_from_clipboard(self):
        
        to = self.get_current_path()
        if os.path.isfile(to):
            to = os.path.abspath(os.path.join(to, os.pardir))
        mime = QtWidgets.QApplication.clipboard().mimeData()

        paste_operation = None
        if mime.hasFormat(self._UrlListMimeData.format(copy=True)):
            paste_operation = True
        elif mime.hasFormat(self._UrlListMimeData.format(copy=False)):
            paste_operation = False
        if paste_operation is not None:
            self._paste(
                self._UrlListMimeData.list_from(mime, copy=paste_operation),
                to, copy=paste_operation)
894897
def _paste_clipboard(self, *event):
        
        if react_to_event(self.view, self.view.editor, event):
            logger.debug("Paste")
            gui_helper_state_machine.paste_into_selected_state(self.model)
            return True
163261
def _restore_clipboard_text(self, backup: str):
        """"""
        # Pasting takes some time, so wait a bit before restoring the content. Otherwise the restore is done before
        # the pasting happens, causing the backup to be pasted instead of the desired clipboard content.
        time.sleep(0.2)
        self.clipboard.text = backup if backup is not None else ""
91317
def move_to_clipboard(self, request, files_queryset, folders_queryset):
        

        if not self.has_change_permission(request):
            raise PermissionDenied

        if request.method != 'POST':
            return None

        clipboard = tools.get_user_clipboard(request.user)

        check_files_edit_permissions(request, files_queryset)
        check_folder_edit_permissions(request, folders_queryset)

        # TODO: Display a confirmation page if moving more than X files to
        # clipboard?

        # We define it like that so that we can modify it inside the
        # move_files function
        files_count = [0]

        def move_files(files):
            files_count[0] += tools.move_file_to_clipboard(files, clipboard)

        def move_folders(folders):
            for f in folders:
                move_files(f.files)
                move_folders(f.children.all())

        move_files(files_queryset)
        move_folders(folders_queryset)

        self.message_user(request, _("Successfully moved %(count)d files to "
                                     "clipboard.") % {"count": files_count[0]})

        return None
850347
def get_clipboard_text_and_convert(paste_list=False):
    """
    txt = GetClipboardText()
    if txt:
        if paste_list and u"\t" in txt:
            array, flag = make_list_of_list(txt)
            if flag:
                txt = repr(array)
            else:
                txt = u"array(%s)"%repr(array)
            txt = u"".join([c for c in txt if c not in u" \t\r\n"])
    return txt
1321161
def paste
      if @yanked_items
        if current_item.directory?
          FileUtils.cp_r @yanked_items.map(&:path), current_item
        else
          @yanked_items.each do |item|
            if items.include? item
              i = 1
              while i += 1
                new_item = load_item dir: current_dir, name: "#{item.basename}_#{i}#{item.extname}", stat: item.stat
                break unless File.exist? new_item.path
              end
              FileUtils.cp_r item, new_item
            else
              FileUtils.cp_r item, current_dir
            end
          end
        end
        ls
      end
    end
1054812
def streamer(main_method):
    """"""
    def main(arguments):
        streams = [StringIO(get_clipboard_data())] if (arguments and '-c' in arguments) else []
        streams = streams or ([file(_, 'r') for _ in arguments if os.path.isfile(argument)] if arguments else [])
        streams = streams or ([sys.stdin] if not (streams or arguments) else [])
        return main_method(arguments, streams)
    return main
166807
function parse_ClipboardFormatOrString(o, w/*:number*/)/*:string*/ {
	// $FlowIgnore
	var ClipFmt = {2:"BITMAP",3:"METAFILEPICT",8:"DIB",14:"ENHMETAFILE"};
	var m/*:number*/ = o.read_shift(4);
	switch(m) {
		case 0x00000000: return "";
		case 0xffffffff: case 0xfffffffe: return ClipFmt[o.read_shift(4)]||"";
	}
	if(m > 0x190) throw new Error("Unsupported Clipboard: " + m.toString(16));
	o.l -= 4;
	return o.read_shift(0, w == 1 ? "lpstr" : "lpwstr");
}
1188361
def copy_file_clipboard(self, fnames=None):
        """"""
        if fnames is None:
            fnames = self.get_selected_filenames()
        if not isinstance(fnames, (tuple, list)):
            fnames = [fnames]
        try:
            file_content = QMimeData()
            file_content.setUrls([QUrl.fromLocalFile(_fn) for _fn in fnames])
            cb = QApplication.clipboard()
            cb.setMimeData(file_content, mode=cb.Clipboard)
        except Exception as e:
            QMessageBox.critical(self,
                                 _('File/Folder copy error'),
                                 _("Cannot copy this type of file(s) or "
                                     "folder(s). The error was:\n\n")
                                 + to_text_string(e))
982180
def copy_selection_to_clipboard(self): # ()
        '''
        if self.enable_win32_clipboard and self.enable_selection and self.selection_mark >= 0:
                selection_mark = min(self.selection_mark,len(self.line_buffer))
                cursor = min(self.point,len(self.line_buffer))
                if self.selection_mark == -1:
                        return
                begin = min(cursor, selection_mark)
                end = max(cursor, selection_mark)
                toclipboard = u"".join(self.line_buffer[begin:end])
                clipboard.SetClipboardText(toclipboard)
557496
def OnPasteAs(self, event):
        """"""

        data = self.main_window.clipboard.get_clipboard()
        key = self.main_window.grid.actions.cursor

        with undo.group(_("Paste As...")):
            self.main_window.actions.paste_as(key, data)

        self.main_window.grid.ForceRefresh()

        event.Skip()
528589
public void onCopyToClipboard(ActionEvent actionEvent) {
        Clipboard systemClipboard = Clipboard.getSystemClipboard();
        ClipboardContent content = new ClipboardContent();
        content.putString(loggingArea.getText());
        systemClipboard.setContent(content);
    }
1301845
function(format) {
    if (typeof format === "undefined") {
      return _deepCopy(_clipData);
    } else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
      return _clipData[format];
    }
  }
722252
def copy(location):
	""""""
	copyData = settings.getDataFile()
	copyFileLocation = os.path.abspath(location)
	copy = {"copyLocation": copyFileLocation}
	dataFile = open(copyData, "wb")
	pickle.dump(copy, dataFile)
	speech.speak(location + " copied successfully!")
	speech.speak("Tip: use 'hallie paste' to paste this file.")
1321971
def paste_buffer(pymux, variables):
    
    pane = pymux.arrangement.get_active_pane()
    pane.process.write_input(get_app().clipboard.get_data().text, paste=True)
331338
def ipython_paste(self,e):
        '''
        if self.enable_win32_clipboard:
                txt=clipboard.get_clipboard_text_and_convert(
                                                self.enable_ipython_paste_list_of_lists)
                if self.enable_ipython_paste_for_paths:
                        if len(txt)<300 and (u"\t" not in txt) and (u"\n" not in txt):
                                txt=txt.replace(u"\\", u"/").replace(u" ", ur"\ ")
                self.insert_text(txt)
1106619
def create_clipboard(self, text, selection=Gdk.SELECTION_CLIPBOARD):
        
        clipboard = Gtk.Clipboard.get(selection)
        clipboard.set_text('\n'.join(text), -1)
        clipboard.store()
        return clipboard