qml: display network status and history server status separately. Also, show network fees on full screen width
This commit is contained in:
@@ -32,12 +32,10 @@ Pane {
|
||||
id: contentLayout
|
||||
width: parent.width
|
||||
columns: 2
|
||||
|
||||
Heading {
|
||||
Layout.columnSpan: 2
|
||||
text: qsTr('On-chain')
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr('Network:');
|
||||
color: Material.accentColor
|
||||
@@ -45,15 +43,23 @@ Pane {
|
||||
Label {
|
||||
text: Network.networkName
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr('Status:');
|
||||
color: Material.accentColor
|
||||
}
|
||||
Label {
|
||||
text: Network.status
|
||||
}
|
||||
Label {
|
||||
text: qsTr('Server:');
|
||||
color: Material.accentColor
|
||||
}
|
||||
Label {
|
||||
text: Network.server
|
||||
RowLayout {
|
||||
Label {
|
||||
text: Network.server
|
||||
}
|
||||
OnchainNetworkStatusIndicator {}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr('Local Height:');
|
||||
color: Material.accentColor
|
||||
@@ -61,26 +67,13 @@ Pane {
|
||||
Label {
|
||||
text: Network.height
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr('Status:');
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
OnchainNetworkStatusIndicator {}
|
||||
|
||||
Label {
|
||||
text: Network.status
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr('Network fees:');
|
||||
color: Material.accentColor
|
||||
Heading {
|
||||
Layout.columnSpan: 2
|
||||
text: qsTr('Mempool fees')
|
||||
}
|
||||
Item {
|
||||
id: histogramRoot
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: histogramLayout.height
|
||||
|
||||
@@ -189,7 +182,7 @@ Pane {
|
||||
|
||||
Heading {
|
||||
Layout.columnSpan: 2
|
||||
text: qsTr('Network')
|
||||
text: qsTr('Proxy')
|
||||
}
|
||||
|
||||
Label {
|
||||
|
||||
@@ -6,7 +6,7 @@ Image {
|
||||
sourceSize.width: constants.iconSizeMedium
|
||||
sourceSize.height: constants.iconSizeMedium
|
||||
|
||||
property bool connected: Network.status == 'connected'
|
||||
property bool connected: Network.server_status == 'connected'
|
||||
property bool lagging: connected && Network.isLagging
|
||||
property bool fork: connected && Network.chaintips > 1
|
||||
property bool syncing: connected && Daemon.currentWallet && Daemon.currentWallet.synchronizing
|
||||
|
||||
@@ -27,7 +27,8 @@ class QENetwork(QObject, QtEventListener):
|
||||
dataChanged = pyqtSignal()
|
||||
|
||||
_height = 0
|
||||
_status = ""
|
||||
_server_status = ""
|
||||
_network_status = ""
|
||||
_chaintips = 1
|
||||
_islagging = False
|
||||
_fee_histogram = []
|
||||
@@ -71,9 +72,14 @@ class QENetwork(QObject, QtEventListener):
|
||||
|
||||
@event_listener
|
||||
def on_event_status(self, *args):
|
||||
self._logger.debug('status updated: %s' % self.network.connection_status)
|
||||
if self._status != self.network.connection_status:
|
||||
self._status = self.network.connection_status
|
||||
network_status = self.network.get_status()
|
||||
if self._network_status != network_status:
|
||||
self._network_status = network_status
|
||||
self.statusChanged.emit()
|
||||
server_status = self.network.connection_status
|
||||
self._logger.debug('server_status updated: %s' % server_status)
|
||||
if self._server_status != server_status:
|
||||
self._server_status = server_status
|
||||
self.statusChanged.emit()
|
||||
chains = len(self.network.get_blockchains())
|
||||
if chains != self._chaintips:
|
||||
@@ -166,7 +172,11 @@ class QENetwork(QObject, QtEventListener):
|
||||
|
||||
@pyqtProperty(str, notify=statusChanged)
|
||||
def status(self):
|
||||
return self._status
|
||||
return self._network_status
|
||||
|
||||
@pyqtProperty(str, notify=statusChanged)
|
||||
def server_status(self):
|
||||
return self._server_status
|
||||
|
||||
@pyqtProperty(int, notify=chaintipsChanged)
|
||||
def chaintips(self):
|
||||
|
||||
@@ -349,9 +349,7 @@ class NetworkChoiceLayout(object):
|
||||
|
||||
height_str = "%d "%(self.network.get_local_height()) + _('blocks')
|
||||
self.height_label.setText(height_str)
|
||||
n = len(self.network.get_interfaces())
|
||||
status = _("Connected to {0} nodes.").format(n) if n > 1 else _("Connected to {0} node.").format(n) if n == 1 else _("Not connected")
|
||||
self.status_label.setText(status)
|
||||
self.status_label.setText(self.network.get_status())
|
||||
chains = self.network.get_blockchains()
|
||||
if len(chains) > 1:
|
||||
chain = self.network.blockchain()
|
||||
|
||||
@@ -518,6 +518,10 @@ class Network(Logger, NetworkRetryManager[ServerAddr]):
|
||||
with self.interfaces_lock:
|
||||
return list(self.interfaces)
|
||||
|
||||
def get_status(self):
|
||||
n = len(self.get_interfaces())
|
||||
return _("Connected to {0} nodes.").format(n) if n > 1 else _("Connected to {0} node.").format(n) if n == 1 else _("Not connected")
|
||||
|
||||
def get_fee_estimates(self):
|
||||
from statistics import median
|
||||
from .simple_config import FEE_ETA_TARGETS
|
||||
|
||||
Reference in New Issue
Block a user