Browse Source

implement enable lightning button

patch-4
Sander van Grieken 3 years ago
parent
commit
486ef414af
  1. 21
      electrum/gui/qml/components/Wallets.qml
  2. 8
      electrum/gui/qml/qewallet.py

21
electrum/gui/qml/components/Wallets.qml

@ -48,7 +48,26 @@ Pane {
Label { text: Daemon.currentWallet.isLightning }
Label { text: 'has Seed'; color: Material.accentColor }
Label { text: Daemon.currentWallet.hasSeed; Layout.columnSpan: 3 }
Label { text: Daemon.currentWallet.hasSeed }
RowLayout {
visible: !Daemon.currentWallet.isLightning && Daemon.currentWallet.canHaveLightning
Layout.columnSpan: 2
Layout.alignment: Qt.AlignHCenter
Button {
enabled: Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning
text: qsTr('Enable Lightning')
onClicked: Daemon.currentWallet.enableLightning()
}
}
Item {
visible: Daemon.currentWallet.isLightning || !Daemon.currentWallet.canHaveLightning
Layout.columnSpan: 2
Layout.preferredHeight: 1
Layout.preferredWidth: 1
}
Label { Layout.columnSpan:4; text: qsTr('Master Public Key'); color: Material.accentColor }

8
electrum/gui/qml/qewallet.py

@ -243,6 +243,10 @@ class QEWallet(QObject):
def isLightning(self):
return bool(self.wallet.lnworker)
@pyqtProperty(bool, notify=dataChanged)
def canHaveLightning(self):
return self.wallet.can_have_lightning()
@pyqtProperty(bool, notify=dataChanged)
def hasSeed(self):
return self.wallet.has_seed()
@ -318,6 +322,10 @@ class QEWallet(QObject):
self._lightningcanreceive = QEAmount(amount_sat=self.wallet.lnworker.num_sats_can_receive())
return self._lightningcanreceive
@pyqtSlot()
def enableLightning(self):
self.wallet.init_lightning(password=None) # TODO pass password if needed
self.isLightningChanged.emit()
@pyqtSlot('QString', int, int, bool)
def send_onchain(self, address, amount, fee=None, rbf=False):

Loading…
Cancel
Save