Fix byte formatting

This commit is contained in:
mirrorwish 2016-03-17 19:03:17 +01:00 committed by Peter Surda
parent 93700ff639
commit 3f64601c47
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
2 changed files with 11 additions and 11 deletions

View File

@ -1702,17 +1702,6 @@ class MyForm(settingsmixin.SMainWindow):
self.actionShow.setChecked(not self.actionShow.isChecked())
self.appIndicatorShowOrHideWindow()
def formatBytes(self, num):
for x in ['bytes','KB','MB','GB']:
if num < 1000.0:
return "%3.0f %s" % (num, x)
num /= 1000.0
return "%3.0f %s" % (num, 'TB')
def formatByteRate(self, num):
num /= 1000
return "%4.0f KB" % num
# Indicates whether or not there is a connection to the Bitmessage network
connected = False

View File

@ -31,6 +31,17 @@ class NetworkStatus(QtGui.QWidget):
self.timer.start(2000) # milliseconds
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
def formatBytes(self, num):
for x in ['bytes','KB','MB','GB']:
if num < 1000.0:
return "%3.0f %s" % (num, x)
num /= 1000.0
return "%3.0f %s" % (num, 'TB')
def formatByteRate(self, num):
num /= 1000
return "%4.0f KB" % num
def updateNumberOfMessagesProcessed(self):
self.labelSyncStatus.setText(_translate("MainWindow", "Objects to be synced: %1").arg(str(sum(shared.numberOfObjectsThatWeHaveYetToGetPerPeer.itervalues()))))
self.labelMessageCount.setText(_translate(