def copy_file(self, fsrc, fdst, progress_callback=None, complete_callback = None, length=16*1024, **kwargs):
self.copied = 0
self.file_size = 0
self.length = length
self.p_callback = progress_callback
self.c_callback = complete_callback
if not os.path.isfile(fsrc):
Logger.info("Will not copy")
return False
else:
self.file_size = float(os.path.getsize(fsrc))
#make the new file
self.src_obj = open(fsrc, 'rb')
self.dst_obj = open(fdst, 'wb')
#Do the copy as fast as possible without blocking the UI thread
Clock.schedule_interval(self.copy_object, 0)
return True
#doing it this way with a clock object does not block the UI
评论列表
文章目录