kivy: show routing options explicitly
This commit is contained in:
@@ -10,12 +10,17 @@ Builder.load_string('''
|
|||||||
<ChoiceDialog@Popup>
|
<ChoiceDialog@Popup>
|
||||||
id: popup
|
id: popup
|
||||||
title: ''
|
title: ''
|
||||||
|
description: ''
|
||||||
size_hint: 0.8, 0.8
|
size_hint: 0.8, 0.8
|
||||||
pos_hint: {'top':0.9}
|
pos_hint: {'top':0.9}
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
Widget:
|
Label:
|
||||||
size_hint: 1, 0.1
|
size_hint: 1, None
|
||||||
|
text: root.description
|
||||||
|
halign: 'left'
|
||||||
|
text_size: self.width, None
|
||||||
|
size: self.texture_size
|
||||||
ScrollView:
|
ScrollView:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
size_hint: 1, 0.8
|
size_hint: 1, 0.8
|
||||||
@@ -44,8 +49,9 @@ Builder.load_string('''
|
|||||||
|
|
||||||
class ChoiceDialog(Factory.Popup):
|
class ChoiceDialog(Factory.Popup):
|
||||||
|
|
||||||
def __init__(self, title, choices, key, callback, keep_choice_order=False):
|
def __init__(self, title, choices, key, callback, *, description='', keep_choice_order=False):
|
||||||
Factory.Popup.__init__(self)
|
Factory.Popup.__init__(self)
|
||||||
|
self.description = description
|
||||||
if keep_choice_order:
|
if keep_choice_order:
|
||||||
orig_index = {choice: i for (i, choice) in enumerate(choices)}
|
orig_index = {choice: i for (i, choice) in enumerate(choices)}
|
||||||
sort_key = lambda x: orig_index[x[0]]
|
sort_key = lambda x: orig_index[x[0]]
|
||||||
|
|||||||
@@ -99,12 +99,7 @@ Builder.load_string('''
|
|||||||
status: _('Trampoline') if not app.use_gossip else _('Gossip')
|
status: _('Trampoline') if not app.use_gossip else _('Gossip')
|
||||||
title: _('Lightning Routing') + ': ' + self.status
|
title: _('Lightning Routing') + ': ' + self.status
|
||||||
description: _("Use trampoline routing or gossip.")
|
description: _("Use trampoline routing or gossip.")
|
||||||
message:
|
action: partial(root.routing_dialog, self)
|
||||||
_('Lightning payments require finding a path through the Lightning Network.')\
|
|
||||||
+ ' ' + ('You may use trampoline routing, or local routing (gossip).')\
|
|
||||||
+ ' ' + ('Downloading the network gossip uses quite some bandwidth and storage, and is not recommended on mobile devices.')\
|
|
||||||
+ ' ' + ('If you use trampoline, you can only open channels with trampoline nodes.')
|
|
||||||
action: partial(root.boolean_dialog, 'use_gossip', _('Download Gossip'), self.message)
|
|
||||||
CardSeparator
|
CardSeparator
|
||||||
SettingsItem:
|
SettingsItem:
|
||||||
status: _('Yes') if app.android_backups else _('No')
|
status: _('Yes') if app.android_backups else _('No')
|
||||||
@@ -173,6 +168,22 @@ class SettingsDialog(Factory.Popup):
|
|||||||
self.app.base_unit, cb, keep_choice_order=True)
|
self.app.base_unit, cb, keep_choice_order=True)
|
||||||
self._unit_dialog.open()
|
self._unit_dialog.open()
|
||||||
|
|
||||||
|
def routing_dialog(self, item, dt):
|
||||||
|
description = \
|
||||||
|
_('Lightning payments require finding a path through the Lightning Network.')\
|
||||||
|
+ ' ' + ('You may use trampoline routing, or local routing (gossip).')\
|
||||||
|
+ ' ' + ('Downloading the network gossip uses quite some bandwidth and storage, and is not recommended on mobile devices.')\
|
||||||
|
+ ' ' + ('If you use trampoline, you can only open channels with trampoline nodes.')
|
||||||
|
def cb(text):
|
||||||
|
self.app.use_gossip = (text == 'Gossip')
|
||||||
|
dialog = ChoiceDialog(
|
||||||
|
_('Lightning Routing'),
|
||||||
|
['Trampoline', 'Gossip'],
|
||||||
|
'Gossip' if self.app.use_gossip else 'Trampoline',
|
||||||
|
cb, description=description,
|
||||||
|
keep_choice_order=True)
|
||||||
|
dialog.open()
|
||||||
|
|
||||||
def coinselect_status(self):
|
def coinselect_status(self):
|
||||||
return coinchooser.get_name(self.app.electrum_config)
|
return coinchooser.get_name(self.app.electrum_config)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user