URI: 
       tkivy: add 'delete channel' button - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit cd86bec894c138dfb74e9c35a072ac02f97c6306
   DIR parent 576fbbd0746bddd6fd185b9e9187d74393d62f9e
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Tue, 22 Oct 2019 12:27:55 +0200
       
       kivy: add 'delete channel' button
       
       Diffstat:
         M electrum/gui/kivy/uix/dialogs/ligh… |      23 ++++++++++++++++++++++-
       
       1 file changed, 22 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/electrum/gui/kivy/uix/dialogs/lightning_channels.py b/electrum/gui/kivy/uix/dialogs/lightning_channels.py
       t@@ -87,6 +87,7 @@ Builder.load_string(r'''
        <ChannelDetailsPopup@Popup>:
            id: popuproot
            data: []
       +    is_closed: False
            BoxLayout:
                orientation: 'vertical'
                ScrollView:
       t@@ -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'
       t@@ -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')
       t@@ -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()