1
0

implement enable lightning button

This commit is contained in:
Sander van Grieken
2022-06-14 16:30:49 +02:00
parent 098b384348
commit 486ef414af
2 changed files with 28 additions and 1 deletions

View File

@@ -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 }

View File

@@ -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):