more percentages fixes for peer tab and files tab

This commit is contained in:
Marcos Pinto 2007-06-01 09:19:32 +00:00
parent 4a65431460
commit e09ee8aef7
1 changed files with 16 additions and 6 deletions

View File

@ -431,10 +431,9 @@ class DelugeGTK:
i=0 i=0
for f in all_files: for f in all_files:
if f['progress'] <= 9: if f['progress'] <= 9:
progress = '0''%.2f'%f['progress'] progress = '0''%.2f%%'%f['progress']
else: else:
progress = '%.2f'%f['progress'] progress = '%.2f%%'%f['progress']
print "progress is %s" %progress
self.file_store.append([not file_filter[i], f['path'], common.fsize(f['size']), self.file_store.append([not file_filter[i], f['path'], common.fsize(f['size']),
f['offset'], progress]) f['offset'], progress])
i=i+1 i=i+1
@ -800,16 +799,27 @@ class DelugeGTK:
for peer in new_peer_info: for peer in new_peer_info:
if peer['ip'] in curr_ips.keys(): if peer['ip'] in curr_ips.keys():
if peer["peer_has"] <= 9:
peer_has = '0''%.2f%%'%peer["peer_has"]
else:
peer_has = '%.2f%%'%peer["peer_has"]
self.peer_store.set(self.peer_store.get_iter_from_string(curr_ips[peer['ip']]), self.peer_store.set(self.peer_store.get_iter_from_string(curr_ips[peer['ip']]),
1, unicode(peer['client'], 'Latin-1'), 1, unicode(peer['client'], 'Latin-1'),
2, '%.2f%%'%peer["peer_has"], 2, peer_has,
3, common.frate(peer["download_speed"]), 3, common.frate(peer["download_speed"]),
4, common.frate(peer["upload_speed"])) 4, common.frate(peer["upload_speed"]))
for peer in new_peer_info: for peer in new_peer_info:
if peer['ip'] not in curr_ips.keys() and peer['client'] is not "": if peer['ip'] not in curr_ips.keys() and peer['client'] is not "":
if peer["peer_has"] <= 9:
peer_has = '0''%.2f'%peer["peer_has"]
else:
peer_has = '%.2f'%peer["peer_has"]
self.peer_store.append([peer["ip"], self.peer_store.append([peer["ip"],
unicode(peer["client"], 'Latin-1'), unicode(peer["client"], 'Latin-1'),
'%.2f%%'%peer["peer_has"], peer_has,
common.frate(peer["download_speed"]), common.frate(peer["download_speed"]),
common.frate(peer["upload_speed"])]) common.frate(peer["upload_speed"])])
#print new_ips #print new_ips