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