mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
kivy: add 'delete channel' button
This commit is contained in:
parent
576fbbd074
commit
cd86bec894
1 changed files with 22 additions and 1 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue