From e17d33cd75f3c5110f4e66aa9352533ab2eadc37 Mon Sep 17 00:00:00 2001
From: Dmitri Bogomolov <4glitch@gmail.com>
Date: Tue, 24 Oct 2017 14:02:15 +0300
Subject: [PATCH] Respect user selected sort order on "Network Status" tab
---
src/bitmessageqt/networkstatus.py | 9 +++++++--
src/bitmessageqt/networkstatus.ui | 3 +++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/bitmessageqt/networkstatus.py b/src/bitmessageqt/networkstatus.py
index e9073cb8..67284495 100644
--- a/src/bitmessageqt/networkstatus.py
+++ b/src/bitmessageqt/networkstatus.py
@@ -13,12 +13,18 @@ import widgets
from network.connectionpool import BMConnectionPool
+
class NetworkStatus(QtGui.QWidget, RetranslateMixin):
def __init__(self, parent=None):
super(NetworkStatus, self).__init__(parent)
widgets.load('networkstatus.ui', self)
- self.tableWidgetConnectionCount.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
+ header = self.tableWidgetConnectionCount.horizontalHeader()
+ header.setResizeMode(QtGui.QHeaderView.ResizeToContents)
+
+ # Somehow this value was 5 when I tested
+ if header.sortIndicatorSection() > 4:
+ header.setSortIndicator(0, QtCore.Qt.AscendingOrder)
self.startup = time.localtime()
self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg(
@@ -135,7 +141,6 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
break
self.tableWidgetConnectionCount.setUpdatesEnabled(True)
self.tableWidgetConnectionCount.setSortingEnabled(True)
- self.tableWidgetConnectionCount.horizontalHeader().setSortIndicator(0, QtCore.Qt.AscendingOrder)
self.labelTotalConnections.setText(_translate(
"networkstatus", "Total Connections: %1").arg(str(self.tableWidgetConnectionCount.rowCount())))
# FYI: The 'singlelistener' thread sets the icon color to green when it receives an incoming connection, meaning that the user's firewall is configured correctly.
diff --git a/src/bitmessageqt/networkstatus.ui b/src/bitmessageqt/networkstatus.ui
index f05e5f62..e0c01b57 100644
--- a/src/bitmessageqt/networkstatus.ui
+++ b/src/bitmessageqt/networkstatus.ui
@@ -97,6 +97,9 @@
QAbstractItemView::NoSelection
+
+ true
+
true