electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit ba5e73d978a6a79432e1cca6cec431d0c2ca65c8
parent 880353287d26914b2c2b7c3c6f38c597d7054eec
Author: ThomasV <thomasv@electrum.org>
Date:   Thu, 18 Feb 2021 11:39:52 +0100

kivy: show routing options explicitly

Diffstat:
Melectrum/gui/kivy/uix/dialogs/choice_dialog.py | 12+++++++++---
Melectrum/gui/kivy/uix/dialogs/settings.py | 23+++++++++++++++++------
2 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/electrum/gui/kivy/uix/dialogs/choice_dialog.py b/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]] diff --git a/electrum/gui/kivy/uix/dialogs/settings.py b/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)