From eadd5d58e83a9e40e042fbfb4267e9fb603b55ac Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 5 Mar 2020 11:54:33 +0100 Subject: [PATCH] kivy: improve open_channel dialog --- .../uix/dialogs/lightning_open_channel.py | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/electrum/gui/kivy/uix/dialogs/lightning_open_channel.py b/electrum/gui/kivy/uix/dialogs/lightning_open_channel.py index 169c2faf0..ac22c96e4 100644 --- a/electrum/gui/kivy/uix/dialogs/lightning_open_channel.py +++ b/electrum/gui/kivy/uix/dialogs/lightning_open_channel.py @@ -42,19 +42,6 @@ Builder.load_string(''' BlueButton: text: s.pubkey if s.pubkey else _('Node ID') shorten: True - #CardSeparator: - # color: blue_bottom.foreground_color - #BoxLayout: - # size_hint: 1, None - # height: blue_bottom.item_height - # Image: - # source: 'atlas://electrum/gui/kivy/theming/light/network' - # size_hint: None, None - # size: '22dp', '22dp' - # pos_hint: {'center_y': .5} - # BlueButton: - # text: s.ipport if s.ipport else _('host:port') - # on_release: s.ipport_dialog() CardSeparator: color: blue_bottom.foreground_color BoxLayout: @@ -68,8 +55,11 @@ Builder.load_string(''' BlueButton: text: s.amount if s.amount else _('Amount') on_release: app.amount_dialog(s, True) + TopLabel: + text: _('Paste or scan a node ID, a connection string or a lightning invoice.') BoxLayout: size_hint: 1, None + height: '48dp' IconButton: icon: 'atlas://electrum/gui/kivy/theming/light/copy' size_hint: 0.5, None @@ -85,13 +75,23 @@ Builder.load_string(''' size_hint: 1, None height: '48dp' on_release: s.choose_node() + Button: + text: _('Clear') + size_hint: 1, None + height: '48dp' + on_release: s.do_clear() + Widget: + size_hint: 1, 1 + BoxLayout: + size_hint: 1, None + Widget: + size_hint: 2, None Button: text: _('Open') size_hint: 1, None height: '48dp' on_release: s.open_channel() - Widget: - size_hint: 1, 1 + disabled: not root.pubkey or not root.amount ''') class LightningOpenChannelDialog(Factory.Popup): @@ -123,6 +123,10 @@ class LightningOpenChannelDialog(Factory.Popup): if self.msg: self.app.show_info(self.msg) + def do_clear(self): + self.pubkey = '' + self.amount = '' + def do_paste(self): contents = self.app._clipboard.paste() if not contents: