Browse Source

improve network status display and states of items when no wallet loaded

patch-4
Sander van Grieken 3 years ago
parent
commit
5889c92e81
  1. 10
      electrum/gui/qml/components/NetworkStats.qml
  2. 3
      electrum/gui/qml/components/Preferences.qml
  3. 2
      electrum/gui/qml/components/WalletMainView.qml
  4. 18
      electrum/gui/qml/components/main.qml
  5. 8
      electrum/gui/qml/qenetwork.py

10
electrum/gui/qml/components/NetworkStats.qml

@ -49,10 +49,12 @@ Pane {
Layout.preferredWidth: constants.iconSizeSmall
Layout.preferredHeight: constants.iconSizeSmall
source: Network.status == 'connecting' || Network.status == 'disconnected'
? '../../icons/status_disconnected.png' :
Daemon.currentWallet.isUptodate
? '../../icons/status_connected.png'
: '../../icons/status_lagging.png'
? '../../icons/status_disconnected.png'
: Network.status == 'connected'
? Daemon.currentWallet && !Daemon.currentWallet.isUptodate
? '../../icons/status_lagging.png'
: '../../icons/status_connected.png'
: '../../icons/status_connected.png'
}
Label {
text: Network.status

3
electrum/gui/qml/components/Preferences.qml

@ -108,14 +108,13 @@ Pane {
Label {
text: qsTr('Lightning Routing')
enabled: Daemon.currentWallet.isLightning
}
ComboBox {
id: lnRoutingType
valueRole: 'key'
textRole: 'label'
enabled: Daemon.currentWallet.isLightning && false
enabled: Daemon.currentWallet != null && Daemon.currentWallet.isLightning && false
model: ListModel {
ListElement { key: 'gossip'; label: qsTr('Gossip') }
ListElement { key: 'trampoline'; label: qsTr('Trampoline') }

2
electrum/gui/qml/components/WalletMainView.qml

@ -39,7 +39,7 @@ Item {
icon.color: 'transparent'
action: Action {
text: qsTr('Channels');
enabled: Daemon.currentWallet.isLightning
enabled: Daemon.currentWallet != null && Daemon.currentWallet.isLightning
onTriggered: menu.openPage(Qt.resolvedUrl('Channels.qml'))
icon.source: '../../icons/lightning.png'
}

18
electrum/gui/qml/components/main.qml

@ -53,16 +53,6 @@ ApplicationWindow
visible: Network.isTestNet
width: column.width
height: column.height
MouseArea {
anchors.fill: parent
onClicked: {
var dialog = app.messageDialog.createObject(app, {'text':
'Electrum is currently on ' + Network.networkName + ''
})
dialog.open()
}
}
ColumnLayout {
id: column
@ -96,9 +86,11 @@ ApplicationWindow
Layout.preferredHeight: constants.iconSizeSmall
source: Network.status == 'connecting' || Network.status == 'disconnected'
? '../../icons/status_disconnected.png'
: Daemon.currentWallet.isUptodate
? '../../icons/status_connected.png'
: '../../icons/status_lagging.png'
: Network.status == 'connected'
? Daemon.currentWallet && !Daemon.currentWallet.isUptodate
? '../../icons/status_lagging.png'
: '../../icons/status_connected.png'
: '../../icons/status_connected.png'
}
Rectangle {

8
electrum/gui/qml/qenetwork.py

@ -60,11 +60,11 @@ class QENetwork(QObject):
self._logger.debug('fee histogram updated')
self.feeHistogramUpdated.emit()
@pyqtProperty(int,notify=heightChanged)
@pyqtProperty(int, notify=heightChanged)
def height(self):
return self._height
@pyqtProperty('QString',notify=defaultServerChanged)
@pyqtProperty('QString', notify=defaultServerChanged)
def server(self):
return str(self.network.get_parameters().server)
@ -79,7 +79,7 @@ class QENetwork(QObject):
net_params = net_params._replace(server=server)
self.network.run_from_another_thread(self.network.set_parameters(net_params))
@pyqtProperty('QString',notify=statusChanged)
@pyqtProperty('QString', notify=statusChanged)
def status(self):
return self._status
@ -105,7 +105,7 @@ class QENetwork(QObject):
self.network.run_from_another_thread(self.network.set_parameters(net_params))
self.proxyChanged.emit()
@pyqtProperty('QVariant',notify=feeHistogramUpdated)
@pyqtProperty('QVariant', notify=feeHistogramUpdated)
def feeHistogram(self):
return self.network.get_status_value('fee_histogram')

Loading…
Cancel
Save