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>:
|
<ChannelDetailsPopup@Popup>:
|
||||||
id: popuproot
|
id: popuproot
|
||||||
data: []
|
data: []
|
||||||
|
is_closed: False
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
ScrollView:
|
ScrollView:
|
||||||
|
@ -100,13 +101,21 @@ Builder.load_string(r'''
|
||||||
Button:
|
Button:
|
||||||
size_hint: 0.5, None
|
size_hint: 0.5, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
text: _('Close channel')
|
text: _('Close')
|
||||||
on_release: root.close()
|
on_release: root.close()
|
||||||
|
disabled: root.is_closed
|
||||||
Button:
|
Button:
|
||||||
size_hint: 0.5, None
|
size_hint: 0.5, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
text: _('Force-close')
|
text: _('Force-close')
|
||||||
on_release: root.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:
|
Button:
|
||||||
size_hint: 0.5, None
|
size_hint: 0.5, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
|
@ -119,6 +128,7 @@ class ChannelDetailsPopup(Popup):
|
||||||
|
|
||||||
def __init__(self, chan, app, **kwargs):
|
def __init__(self, chan, app, **kwargs):
|
||||||
super(ChannelDetailsPopup,self).__init__(**kwargs)
|
super(ChannelDetailsPopup,self).__init__(**kwargs)
|
||||||
|
self.is_closed = chan.is_closed()
|
||||||
self.app = app
|
self.app = app
|
||||||
self.chan = chan
|
self.chan = chan
|
||||||
self.title = _('Channel details')
|
self.title = _('Channel details')
|
||||||
|
@ -154,6 +164,17 @@ class ChannelDetailsPopup(Popup):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.app.show_info(_('Could not close channel: ') + repr(e)) # repr because str(Exception()) == ''
|
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):
|
def force_close(self):
|
||||||
Question(_('Force-close channel?'), self._force_close).open()
|
Question(_('Force-close channel?'), self._force_close).open()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue