From a1314f5992444ad45246950b6d254b48bd981c06 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Mon, 17 Apr 2023 12:48:51 +0200 Subject: [PATCH] qml: only show channel ratio bar when appropriate --- electrum/gui/qml/components/ChannelDetails.qml | 6 ++++++ electrum/gui/qml/components/controls/ChannelDelegate.qml | 2 +- electrum/gui/qml/qechanneldetails.py | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/electrum/gui/qml/components/ChannelDetails.qml b/electrum/gui/qml/components/ChannelDetails.qml index 1cef67ffe..3043cea1e 100644 --- a/electrum/gui/qml/components/ChannelDetails.qml +++ b/electrum/gui/qml/components/ChannelDetails.qml @@ -61,6 +61,7 @@ Pane { } Label { + Layout.fillWidth: true text: channeldetails.short_cid } @@ -77,11 +78,13 @@ Pane { } Label { + visible: !channeldetails.isBackup text: qsTr('Initiator') color: Material.accentColor } Label { + visible: !channeldetails.isBackup text: channeldetails.initiator } @@ -146,6 +149,9 @@ Pane { Layout.fillWidth: true Layout.topMargin: constants.paddingLarge Layout.bottomMargin: constants.paddingXLarge + visible: channeldetails.stateCode != ChannelDetails.Redeemed + && channeldetails.stateCode != ChannelDetails.Closed + && !channeldetails.isBackup capacity: channeldetails.capacity localCapacity: channeldetails.localCapacity remoteCapacity: channeldetails.remoteCapacity diff --git a/electrum/gui/qml/components/controls/ChannelDelegate.qml b/electrum/gui/qml/components/controls/ChannelDelegate.qml index d02e08b3c..bf54d0a76 100644 --- a/electrum/gui/qml/components/controls/ChannelDelegate.qml +++ b/electrum/gui/qml/components/controls/ChannelDelegate.qml @@ -107,7 +107,7 @@ ItemDelegate { ChannelBar { Layout.fillWidth: true - visible: !_closed + visible: !_closed && !model.is_backup capacity: model.capacity localCapacity: model.local_capacity remoteCapacity: model.remote_capacity diff --git a/electrum/gui/qml/qechanneldetails.py b/electrum/gui/qml/qechanneldetails.py index 3c7fa0c87..572f076c8 100644 --- a/electrum/gui/qml/qechanneldetails.py +++ b/electrum/gui/qml/qechanneldetails.py @@ -99,6 +99,10 @@ class QEChannelDetails(QObject, QtEventListener): def state(self): return self._channel.get_state_for_GUI() + @pyqtProperty(int, notify=channelChanged) + def stateCode(self): + return self._channel.get_state() + @pyqtProperty(str, notify=channelChanged) def initiator(self): if self._channel.is_backup():