kivy: improve open_channel dialog

This commit is contained in:
ThomasV 2020-03-05 11:54:33 +01:00
parent cb14bde422
commit eadd5d58e8

View file

@ -42,19 +42,6 @@ Builder.load_string('''
BlueButton: BlueButton:
text: s.pubkey if s.pubkey else _('Node ID') text: s.pubkey if s.pubkey else _('Node ID')
shorten: True 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: CardSeparator:
color: blue_bottom.foreground_color color: blue_bottom.foreground_color
BoxLayout: BoxLayout:
@ -68,8 +55,11 @@ Builder.load_string('''
BlueButton: BlueButton:
text: s.amount if s.amount else _('Amount') text: s.amount if s.amount else _('Amount')
on_release: app.amount_dialog(s, True) on_release: app.amount_dialog(s, True)
TopLabel:
text: _('Paste or scan a node ID, a connection string or a lightning invoice.')
BoxLayout: BoxLayout:
size_hint: 1, None size_hint: 1, None
height: '48dp'
IconButton: IconButton:
icon: 'atlas://electrum/gui/kivy/theming/light/copy' icon: 'atlas://electrum/gui/kivy/theming/light/copy'
size_hint: 0.5, None size_hint: 0.5, None
@ -85,13 +75,23 @@ Builder.load_string('''
size_hint: 1, None size_hint: 1, None
height: '48dp' height: '48dp'
on_release: s.choose_node() 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: Button:
text: _('Open') text: _('Open')
size_hint: 1, None size_hint: 1, None
height: '48dp' height: '48dp'
on_release: s.open_channel() on_release: s.open_channel()
Widget: disabled: not root.pubkey or not root.amount
size_hint: 1, 1
''') ''')
class LightningOpenChannelDialog(Factory.Popup): class LightningOpenChannelDialog(Factory.Popup):
@ -123,6 +123,10 @@ class LightningOpenChannelDialog(Factory.Popup):
if self.msg: if self.msg:
self.app.show_info(self.msg) self.app.show_info(self.msg)
def do_clear(self):
self.pubkey = ''
self.amount = ''
def do_paste(self): def do_paste(self):
contents = self.app._clipboard.paste() contents = self.app._clipboard.paste()
if not contents: if not contents: