Browse Source

qml: only show channel peer node name if known, add node pubkey to ChannelCloseDialog

patch-4
Sander van Grieken 2 years ago
parent
commit
0687785994
  1. 2
      electrum/gui/qml/components/ChannelDetails.qml
  2. 40
      electrum/gui/qml/components/CloseChannelDialog.qml
  3. 2
      electrum/gui/qml/components/controls/ChannelDelegate.qml
  4. 4
      electrum/gui/qml/qechanneldetails.py
  5. 3
      electrum/gui/qml/qechannellistmodel.py
  6. 2
      electrum/gui/qml/qetxdetails.py

2
electrum/gui/qml/components/ChannelDetails.qml

@ -51,11 +51,13 @@ Pane {
}
Label {
visible: channeldetails.name
text: qsTr('Node name')
color: Material.accentColor
}
Label {
visible: channeldetails.name
text: channeldetails.name
}

40
electrum/gui/qml/components/CloseChannelDialog.qml

@ -29,28 +29,51 @@ ElDialog {
padding: 0
ColumnLayout {
width: parent.width
height: parent.height
anchors.fill: parent
spacing: 0
GridLayout {
id: layout
Layout.preferredWidth: parent.width
Layout.preferredWidth: parent.width - 2*constants.paddingLarge
Layout.leftMargin: constants.paddingLarge
Layout.rightMargin: constants.paddingLarge
columns: 2
Label {
Layout.fillWidth: true
visible: channeldetails.name
text: qsTr('Channel name')
color: Material.accentColor
}
Label {
Layout.fillWidth: true
visible: channeldetails.name
text: channeldetails.name
}
Label {
text: qsTr('Remote node ID')
Layout.columnSpan: 2
color: Material.accentColor
}
TextHighlightPane {
Layout.columnSpan: 2
Layout.fillWidth: true
padding: 0
leftPadding: constants.paddingSmall
Label {
width: parent.width
text: channeldetails.pubkey
font.pixelSize: constants.fontSizeLarge
font.family: FixedFont
Layout.fillWidth: true
wrapMode: Text.Wrap
}
}
Label {
text: qsTr('Short channel ID')
color: Material.accentColor
@ -64,11 +87,16 @@ ElDialog {
InfoTextArea {
Layout.columnSpan: 2
Layout.preferredWidth: parent.width * 3/4
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
text: qsTr(channeldetails.message_force_close)
}
Label {
text: qsTr('Choose closing method')
Layout.columnSpan: 2
color: Material.accentColor
}
ColumnLayout {
Layout.columnSpan: 2
Layout.alignment: Qt.AlignHCenter
@ -122,7 +150,7 @@ ElDialog {
FlatButton {
Layout.columnSpan: 2
Layout.fillWidth: true
text: qsTr('Close')
text: qsTr('Close channel')
icon.source: '../../icons/closebutton.png'
enabled: !closing
onClicked: {

2
electrum/gui/qml/components/controls/ChannelDelegate.qml

@ -59,7 +59,7 @@ ItemDelegate {
Layout.fillWidth: true
Label {
Layout.fillWidth: true
text: model.node_alias
text: model.node_alias ? model.node_alias : model.node_id
elide: Text.ElideRight
wrapMode: Text.Wrap
maximumLineCount: 2

4
electrum/gui/qml/qechanneldetails.py

@ -78,11 +78,11 @@ class QEChannelDetails(QObject, QtEventListener):
def name(self):
if not self._channel:
return
return self._wallet.wallet.lnworker.get_node_alias(self._channel.node_id) or self._channel.node_id.hex()
return self._wallet.wallet.lnworker.get_node_alias(self._channel.node_id) or ''
@pyqtProperty(str, notify=channelChanged)
def pubkey(self):
return self._channel.node_id.hex() #if self._channel else ''
return self._channel.node_id.hex()
@pyqtProperty(str, notify=channelChanged)
def short_cid(self):

3
electrum/gui/qml/qechannellistmodel.py

@ -67,7 +67,8 @@ class QEChannelListModel(QAbstractListModel, QtEventListener):
lnworker = self.wallet.lnworker
item = {}
item['cid'] = lnc.channel_id.hex()
item['node_alias'] = lnworker.get_node_alias(lnc.node_id) or lnc.node_id.hex()
item['node_id'] = lnc.node_id.hex()
item['node_alias'] = lnworker.get_node_alias(lnc.node_id) or ''
item['short_cid'] = lnc.short_id_for_GUI()
item['state'] = lnc.get_state_for_GUI()
item['state_code'] = int(lnc.get_state())

2
electrum/gui/qml/qetxdetails.py

@ -2,7 +2,7 @@ from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from electrum.i18n import _
from electrum.logging import get_logger
from electrum.util import format_time
from electrum.util import format_time, AddTransactionException
from electrum.transaction import tx_from_any
from .qewallet import QEWallet

Loading…
Cancel
Save