Browse Source

kivy: show routing options explicitly

patch-4
ThomasV 4 years ago
parent
commit
ba5e73d978
  1. 12
      electrum/gui/kivy/uix/dialogs/choice_dialog.py
  2. 23
      electrum/gui/kivy/uix/dialogs/settings.py

12
electrum/gui/kivy/uix/dialogs/choice_dialog.py

@ -10,12 +10,17 @@ Builder.load_string('''
<ChoiceDialog@Popup>
id: popup
title: ''
description: ''
size_hint: 0.8, 0.8
pos_hint: {'top':0.9}
BoxLayout:
orientation: 'vertical'
Widget:
size_hint: 1, 0.1
Label:
size_hint: 1, None
text: root.description
halign: 'left'
text_size: self.width, None
size: self.texture_size
ScrollView:
orientation: 'vertical'
size_hint: 1, 0.8
@ -44,8 +49,9 @@ Builder.load_string('''
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)
self.description = description
if keep_choice_order:
orig_index = {choice: i for (i, choice) in enumerate(choices)}
sort_key = lambda x: orig_index[x[0]]

23
electrum/gui/kivy/uix/dialogs/settings.py

@ -99,12 +99,7 @@ Builder.load_string('''
status: _('Trampoline') if not app.use_gossip else _('Gossip')
title: _('Lightning Routing') + ': ' + self.status
description: _("Use trampoline routing or gossip.")
message:
_('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)
action: partial(root.routing_dialog, self)
CardSeparator
SettingsItem:
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._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):
return coinchooser.get_name(self.app.electrum_config)

Loading…
Cancel
Save