comparison gcp @ 16:b03bd83c1661

Fixed yet another utf-8 encoding issue + added a space on progress bar before percentage
author Goffi <goffi@goffi.org>
date Tue, 28 Sep 2010 15:45:28 +0800
parents 8253a5ccbe9a
children 132042c7abb2
comparison
equal deleted inserted replaced
15:8253a5ccbe9a 16:b03bd83c1661
265 source_fd = open(source_file, 'rb') 265 source_fd = open(source_file, 'rb')
266 filename = os.path.basename(source_file) 266 filename = os.path.basename(source_file)
267 assert(filename) 267 assert(filename)
268 dest_file = self.__filename_fix(os.path.join(dest_path,filename),options) 268 dest_file = self.__filename_fix(os.path.join(dest_path,filename),options)
269 if os.path.exists(dest_file) and not options.force: 269 if os.path.exists(dest_file) and not options.force:
270 warning (_("File [%s] already exists, skipping it !") % dest_file) 270 warning (_("File [%s] already exists, skipping it !") % dest_file.decode('utf-8','replace'))
271 return True 271 return True
272 try: 272 try:
273 dest_fd = open(dest_file, 'wb') 273 dest_fd = open(dest_file, 'wb')
274 except: 274 except:
275 self.journal.copyFailed() 275 self.journal.copyFailed()
402 self.pbar.widgets[0] = _("Copying %s") % self.__get_string_size(self.bytes_total) 402 self.pbar.widgets[0] = _("Copying %s") % self.__get_string_size(self.bytes_total)
403 except AttributeError: 403 except AttributeError:
404 if not self.bytes_total: 404 if not self.bytes_total:
405 #No progress bar if the files have a null size 405 #No progress bar if the files have a null size
406 return 406 return
407 self.pbar = ProgressBar(self.bytes_total,[_("Copying %s") % self.__get_string_size(self.bytes_total),Percentage()," ",Bar()," ",FileTransferSpeed()," ",ETA()]) 407 self.pbar = ProgressBar(self.bytes_total,[_("Copying %s") % self.__get_string_size(self.bytes_total)," ",Percentage()," ",Bar()," ",FileTransferSpeed()," ",ETA()])
408 self.pbar.start() 408 self.pbar.start()
409 self.pbar.update(self.bytes_copied) 409 self.pbar.update(self.bytes_copied)
410 410
411 def __pbar_finish(self): 411 def __pbar_finish(self):
412 """Mark the progression as finished""" 412 """Mark the progression as finished"""