bytes received/sent resolve merge conflict #699

Merged
Atheros1 merged 3 commits from master into master 2014-08-01 23:27:52 +02:00
Showing only changes of commit f05bcdb829 - Show all commits

View File

@ -1471,11 +1471,22 @@ class MyForm(QtGui.QMainWindow):
"MainWindow", "Processed %1 public keys.").arg(str(shared.numberOfPubkeysProcessed))) "MainWindow", "Processed %1 public keys.").arg(str(shared.numberOfPubkeysProcessed)))
self.updateNumberOfBytes() self.updateNumberOfBytes()
def formatNumberAsHumanReadable(self, num):
for x in ['bytes','KB','MB','GB']:
if num < 1024.0:
return "%3.1f %s" % (num, x)
num /= 1024.0
return "%3.1f %s" % (num, 'TB')
def formatNumberOfBytes(self, num):
return "%s (%s bytes)" % (self.formatNumberAsHumanReadable(num), str(locale.format("%d", num, grouping=True)))
def updateNumberOfBytes(self): def updateNumberOfBytes(self):
self.ui.labelBytesRecvCount.setText(_translate( self.ui.labelBytesRecvCount.setText(_translate(
"MainWindow", "Received %1 bytes.").arg(str(locale.format("%d", shared.numberOfBytesReceived, grouping=True)))) "MainWindow", "Received %1.").arg(self.formatNumberOfBytes(shared.numberOfBytesReceived)))
self.ui.labelBytesSentCount.setText(_translate( self.ui.labelBytesSentCount.setText(_translate(
"MainWindow", "Sent %1 bytes.").arg(str(locale.format("%d", shared.numberOfBytesSent, grouping=True)))) "MainWindow", "Sent %1.").arg(self.formatNumberOfBytes(shared.numberOfBytesSent)))
def updateNetworkStatusTab(self): def updateNetworkStatusTab(self):
# print 'updating network status tab' # print 'updating network status tab'