MCPcopy Create free account
hub / github.com/RainingComputers/whipFTP / clipboard_paste

Method clipboard_paste

whipFTP.py:1043–1070  ·  view source on GitHub ↗
(self, ftpController, clipboard_path_list, clipboard_file_list, detailed_clipboard_file_list, cut, copy)

Source from the content-addressed store, hash-verified

1041 self.process_thread_requests()
1042
1043 def clipboard_paste(self, ftpController, clipboard_path_list, clipboard_file_list, detailed_clipboard_file_list, cut, copy):
1044 #Set current status
1045 thread_request_queue.put(lambda:self.update_status('Moving file(s)...'))
1046 if(cut is True):
1047 #Loop through all selected files and folders
1048 for clipboard_path, file_name in zip(clipboard_path_list, clipboard_file_list):
1049 ftpController.move_dir(clipboard_path +'/'+file_name, ftpController.pwd()+'/'+file_name, self.progress, self.ask_replace)
1050 thread_request_queue.put(lambda:self.clear_clipboard())
1051 thread_request_queue.put(lambda:self.progress('You can now close the window', 'Done'))
1052 elif (copy is True):
1053 #Set current status
1054 thread_request_queue.put(lambda:self.update_status('Copying file(s)...'))
1055 #Loop through all selected files and folders
1056 for clipboard_path, file_name, file_details in zip(clipboard_path_list, clipboard_file_list, detailed_clipboard_file_list):
1057 #Check for file or directory, use appropriate function
1058 try:
1059 if(self.ftpController.is_dir(file_details)):
1060 ftpController.copy_dir(clipboard_path, file_name, self.progress, self.ask_replace)
1061 else:
1062 ftpController.copy_file(clipboard_path, file_name, int(self.ftpController.get_properties(file_details)[3]), self.progress, self.ask_replace)
1063 except:
1064 thread_request_queue.put(lambda:self.progress('Failed to copy file/folder', file_name))
1065 thread_request_queue.put(lambda:self.clear_clipboard())
1066 thread_request_queue.put(lambda:self.progress('You can now close the window', 'Done'))
1067 #update file list and redraw icons
1068 thread_request_queue.put(lambda:self.update_file_list())
1069 thread_request_queue.put(lambda:self.update_status(' '))
1070 thread_request_queue.put(lambda:self.console_window.enable_close_button())
1071
1072 def clear_clipboard(self):
1073 del self.clipboard_file_list[:]

Callers

nothing calls this directly

Calls 11

update_statusMethod · 0.95
clear_clipboardMethod · 0.95
progressMethod · 0.95
update_file_listMethod · 0.95
enable_close_buttonMethod · 0.80
move_dirMethod · 0.45
pwdMethod · 0.45
is_dirMethod · 0.45
copy_dirMethod · 0.45
copy_fileMethod · 0.45
get_propertiesMethod · 0.45

Tested by

no test coverage detected