Permalink
Browse files

Set the download/upload mode in CmdlineManager before starting task (…

…solving a display bug)
  • Loading branch information...
virtualabs committed May 3, 2012
1 parent 0508850 commit 6c52aa56999a1e2ca4f42c955b67f73b2aa7352f
Showing with 7 additions and 2 deletions.
  1. +7 −2 client/downup/manager.py
View
@@ -312,16 +312,16 @@ def upload(self, filename):
"""
Upload a file
"""
- self.task = self.m.upload(filename)
self.kind = 'up'
+ self.task = self.m.upload(filename)
self.m.startTask(self.task)
def download(self, filename,prefix=''):
"""
Download a file
"""
- self.task = self.m.download(filename,prefix)
self.kind = 'down'
+ self.task = self.m.download(filename,prefix)
self.m.startTask(self.task)
def onTaskDone(self, task):
@@ -372,6 +372,11 @@ def onTaskError(self, task):
self.m.shutdown()
def onTaskCreated(self, task):
+ if self.kind == 'up':
+ m = 'Uploading '
+ else:
+ m = 'Downloading '
+ sys.stdout.write('\r%s: ['%m+' '*40 + '] %s ' % formatSpeed(self.m.getTask(task).speed))
return
def onTaskStarted(self, task):

0 comments on commit 6c52aa5

Please sign in to comment.