add initial fee histogram
This commit is contained in:
@@ -7,17 +7,80 @@ Pane {
|
||||
property string title: qsTr('Network')
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
columns: 3
|
||||
|
||||
Label { text: qsTr("Network: "); color: Material.primaryHighlightedTextColor; font.bold: true }
|
||||
Label { text: Network.networkName }
|
||||
Label { text: qsTr("Server: "); color: Material.primaryHighlightedTextColor; font.bold: true }
|
||||
Label { text: Network.server }
|
||||
Label { text: qsTr("Local Height: "); color: Material.primaryHighlightedTextColor; font.bold: true }
|
||||
Label { text: Network.height }
|
||||
Label { text: qsTr("Status: "); color: Material.primaryHighlightedTextColor; font.bold: true }
|
||||
Label { text: Network.status }
|
||||
Label { text: qsTr("Wallet: "); color: Material.primaryHighlightedTextColor; font.bold: true }
|
||||
Label { text: Daemon.walletName }
|
||||
Label {
|
||||
text: qsTr("Network: ");
|
||||
color: Material.primaryHighlightedTextColor;
|
||||
font.bold: true
|
||||
}
|
||||
Label {
|
||||
text: Network.networkName
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Server: ");
|
||||
color: Material.primaryHighlightedTextColor;
|
||||
font.bold: true
|
||||
}
|
||||
Label {
|
||||
text: Network.server
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Local Height: ");
|
||||
color: Material.primaryHighlightedTextColor;
|
||||
font.bold: true
|
||||
|
||||
}
|
||||
Label {
|
||||
text: Network.height
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Status: ");
|
||||
color: Material.primaryHighlightedTextColor;
|
||||
font.bold: true
|
||||
}
|
||||
Image {
|
||||
Layout.preferredWidth: 16
|
||||
Layout.preferredHeight: 16
|
||||
source: Daemon.currentWallet.isUptodate
|
||||
? "../../icons/status_connected.png"
|
||||
: "../../icons/status_lagging.png"
|
||||
}
|
||||
Label {
|
||||
text: Network.status
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Network fees: ");
|
||||
color: Material.primaryHighlightedTextColor;
|
||||
font.bold: true
|
||||
}
|
||||
Label {
|
||||
id: feeHistogram
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
}
|
||||
|
||||
function setFeeHistogram() {
|
||||
var txt = ''
|
||||
Network.feeHistogram.forEach(function(item) {
|
||||
txt = txt + item[0] + ': ' + item[1] + '\n';
|
||||
})
|
||||
feeHistogram.text = txt.trim()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Network
|
||||
function onFeeHistogramUpdated() {
|
||||
setFeeHistogram()
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: setFeeHistogram()
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ class QENetwork(QObject):
|
||||
register_callback(self.on_default_server_changed, ['default_server_changed'])
|
||||
register_callback(self.on_proxy_set, ['proxy_set'])
|
||||
register_callback(self.on_status, ['status'])
|
||||
register_callback(self.on_fee_histogram, ['fee_histogram'])
|
||||
|
||||
_logger = get_logger(__name__)
|
||||
|
||||
@@ -23,6 +24,7 @@ class QENetwork(QObject):
|
||||
proxySet = pyqtSignal()
|
||||
proxyChanged = pyqtSignal()
|
||||
statusUpdated = pyqtSignal()
|
||||
feeHistogramUpdated = pyqtSignal()
|
||||
|
||||
dataChanged = pyqtSignal() # dummy to silence warnings
|
||||
|
||||
@@ -54,6 +56,10 @@ class QENetwork(QObject):
|
||||
self._status = self.network.connection_status
|
||||
self.statusUpdated.emit()
|
||||
|
||||
def on_fee_histogram(self, event, *args):
|
||||
self._logger.warning('fee histogram updated')
|
||||
self.feeHistogramUpdated.emit()
|
||||
|
||||
@pyqtProperty(int,notify=networkUpdated)
|
||||
def updates(self):
|
||||
return self._num_updates
|
||||
@@ -102,3 +108,8 @@ class QENetwork(QObject):
|
||||
net_params = net_params._replace(proxy=proxy_settings)
|
||||
self.network.run_from_another_thread(self.network.set_parameters(net_params))
|
||||
self.proxyChanged.emit()
|
||||
|
||||
@pyqtProperty('QVariant',notify=feeHistogramUpdated)
|
||||
def feeHistogram(self):
|
||||
return self.network.get_status_value('fee_histogram')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user