electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit cd86bec894c138dfb74e9c35a072ac02f97c6306
parent 576fbbd0746bddd6fd185b9e9187d74393d62f9e
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 22 Oct 2019 12:27:55 +0200

kivy: add 'delete channel' button

Diffstat:
Melectrum/gui/kivy/uix/dialogs/lightning_channels.py | 23++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/electrum/gui/kivy/uix/dialogs/lightning_channels.py b/electrum/gui/kivy/uix/dialogs/lightning_channels.py @@ -87,6 +87,7 @@ Builder.load_string(r''' <ChannelDetailsPopup@Popup>: id: popuproot data: [] + is_closed: False BoxLayout: orientation: 'vertical' ScrollView: @@ -100,13 +101,21 @@ Builder.load_string(r''' Button: size_hint: 0.5, None height: '48dp' - text: _('Close channel') + text: _('Close') on_release: root.close() + disabled: root.is_closed Button: size_hint: 0.5, None height: '48dp' text: _('Force-close') on_release: root.force_close() + disabled: root.is_closed + Button: + size_hint: 0.5, None + height: '48dp' + text: _('Delete') + on_release: root.remove_channel() + disabled: not root.is_closed Button: size_hint: 0.5, None height: '48dp' @@ -119,6 +128,7 @@ class ChannelDetailsPopup(Popup): def __init__(self, chan, app, **kwargs): super(ChannelDetailsPopup,self).__init__(**kwargs) + self.is_closed = chan.is_closed() self.app = app self.chan = chan self.title = _('Channel details') @@ -154,6 +164,17 @@ class ChannelDetailsPopup(Popup): except Exception as e: self.app.show_info(_('Could not close channel: ') + repr(e)) # repr because str(Exception()) == '' + def remove_channel(self): + msg = _('Are you sure you want to delete this channel? This will purge associated transactions from your wallet history.') + Question(msg, self._remove_channel).open() + + def _remove_channel(self, b): + if not b: + return + self.app.wallet.lnworker.remove_channel(self.chan.channel_id) + self.app._trigger_update_history() + self.dismiss() + def force_close(self): Question(_('Force-close channel?'), self._force_close).open()