From 38700a172176707530b00b94532e97cada974123 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Mon, 25 Apr 2016 18:17:02 +0200 Subject: [PATCH] Network Status tab translations update - remembers startup time - kB instead of KB - stream table and status texts scale and aren't cut if they translated text doesn't fit --- src/bitmessageqt/networkstatus.py | 13 +- src/bitmessageqt/networkstatus.ui | 446 ++++++++++++++++-------------- 2 files changed, 249 insertions(+), 210 deletions(-) diff --git a/src/bitmessageqt/networkstatus.py b/src/bitmessageqt/networkstatus.py index 574af66b..e778e605 100644 --- a/src/bitmessageqt/networkstatus.py +++ b/src/bitmessageqt/networkstatus.py @@ -1,4 +1,5 @@ from PyQt4 import QtCore, QtGui +import time import shared from tr import _translate import l10n @@ -12,8 +13,9 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin): super(NetworkStatus, self).__init__(parent) widgets.load('networkstatus.ui', self) + self.startup = time.localtime() self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg( - l10n.formatTimestamp())) + l10n.formatTimestamp(self.startup))) self.UISignalThread = UISignaler.get() QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( @@ -33,7 +35,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin): QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds) def formatBytes(self, num): - for x in ['bytes','KB','MB','GB']: + for x in [_translate("networkstatus", "byte(s)"), "kB", "MB", "GB"]: if num < 1000.0: return "%3.0f %s" % (num, x) num /= 1000.0 @@ -41,7 +43,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin): def formatByteRate(self, num): num /= 1000 - return "%4.0f KB" % num + return "%4.0f kB" % num def updateNumberOfMessagesProcessed(self): self.labelSyncStatus.setText(_translate("networkstatus", "Objects to be synced: %1").arg(str(sum(shared.numberOfObjectsThatWeHaveYetToGetPerPeer.itervalues())))) @@ -125,3 +127,8 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin): "networkstatus", "Inventory lookups per second: %1").arg(str(shared.numberOfInventoryLookupsPerformed/2))) shared.numberOfInventoryLookupsPerformed = 0 self.updateNumberOfBytes() + + def retranslateUi(self): + super(QtGui.QWidget, self).retranslateUi() + self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg( + l10n.formatTimestamp(self.startup))) diff --git a/src/bitmessageqt/networkstatus.ui b/src/bitmessageqt/networkstatus.ui index 07b0a36a..6ae988bf 100644 --- a/src/bitmessageqt/networkstatus.ui +++ b/src/bitmessageqt/networkstatus.ui @@ -6,217 +6,249 @@ 0 0 - 731 - 493 + 602 + 252 - - - - 20 - 30 - 401 - 16 - - - - Total connections: - - - - - - 320 - 110 - 331 - 20 - - - - Since startup: - - - - - - 350 - 130 - 361 - 16 - - - - Processed 0 person-to-person messages. - - - - - - 350 - 170 - 331 - 16 - - - - Processed 0 public keys. - - - - - - 350 - 150 - 351 - 16 - - - - Processed 0 broadcasts. - - - - - - 320 - 270 - 291 - 16 - - - - Inventory lookups per second: 0 - - - - - - 350 - 220 - 251 - 16 - - - - Down: 0 KB/s - - - - - - 350 - 240 - 251 - 16 - - - - Up: 0 KB/s - - - - - - 350 - 190 - 331 - 16 - - - - Objects to be synced: - - - - - - 20 - 70 - 241 - 241 - - - - - - - - - - - - 212 - 208 - 200 - - - - - - - - - 212 - 208 - 200 - - - - - - - - - 212 - 208 - 200 - - - - - - - - QFrame::Box - - - QFrame::Plain - - - false - - - true - - - QAbstractItemView::NoSelection - - - true - - - false - - - true - - - false - - - - Stream # + + + 0 + 0 + + + + + + + 20 + + + QLayout::SetDefaultConstraint + + + + + 20 - - - - Connections + + QLayout::SetFixedSize - - - - - + + + + Total connections: + + + + + + + + + + + + 212 + 208 + 200 + + + + + + + + + 212 + 208 + 200 + + + + + + + + + 212 + 208 + 200 + + + + + + + + QFrame::Box + + + QFrame::Plain + + + false + + + true + + + QAbstractItemView::NoSelection + + + false + + + false + + + true + + + false + + + + Stream # + + + + + Connections + + + + + + + + + + 4 + + + + + + 0 + 9 + + + + + 0 + 50 + + + + Since startup: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + Processed 0 person-to-person messages. + + + 0 + + + + + + + + 0 + 0 + + + + Processed 0 broadcasts. + + + + + + + + 0 + 0 + + + + Processed 0 public keys. + + + + + + + + 0 + 0 + + + + Objects to be synced: + + + + + + + + 0 + 0 + + + + Up: 0 kB/s + + + + + + + + 0 + 0 + + + + Down: 0 kB/s + + + + + + + + 0 + 0 + + + + Inventory lookups per second: 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + +