Beispiel #1
0
 def start(self):
     if self.source is None or self.destination is None:
         raise RuntimeError("You have to set both the source and the destination.")
     
     if self.size:
         size = text.format_size(self.size)
     else:
         size = "unknown size"
     
     self.task._statustext = self.title.format(path=self.name, size=size)
     fd = putFile(self.destination, self)
     fd.addCallback(self.transfer_completed)
Beispiel #2
0
 def transfer_completed(self, _):
     self.task._statustext = "Upload of {path} completed ({size})".format(path=self.name, size=text.format_size(self.sent))
     self.task.callback(self.destination)
Beispiel #3
0
 def set_size(self, size):
     self.size = size
     self.task.statustext = self.title.format(path=self.name, size=text.format_size(self.size))
     return size