electrum

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

commit 7b5869c7bcd058ab8b8b1b2428c288e9f658863d
parent 2dd368e76e2bc22d500fe8d35a9b2b6f91e60708
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 22 Oct 2019 22:56:17 +0200

kivy:
 - simplify menu
 - add lightning network dialog

Diffstat:
Melectrum/gui/kivy/main.kv | 33++++++++++++++++++++-------------
Melectrum/gui/kivy/main_window.py | 17+++++++++++++++++
Aelectrum/gui/kivy/uix/ui_screens/lightning.kv | 28++++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/electrum/gui/kivy/main.kv b/electrum/gui/kivy/main.kv @@ -421,35 +421,41 @@ BoxLayout: ActionView: id: av ActionPrevious: - app_icon: 'atlas://electrum/gui/kivy/theming/light/logo' - app_icon_width: '100dp' with_previous: False - size_hint_x: None - on_release: app.popup_dialog('network') + size_hint: None, None + size: 0, 0 ActionButton: - id: action_status - important: True - size_hint: 1, 1 + size_hint_x: 0.5 + text: app.wallet_name bold: True color: 0.7, 0.7, 0.7, 1 - text: app.wallet_name font_size: '22dp' - #minimum_width: '1dp' - on_release: app.popup_dialog('status') + on_release: + Clock.schedule_once(lambda dt: app.popup_dialog('wallets'), 0.05) + self.state = 'normal' + + ActionButton: + size_hint_x: 0.4 + text: '' + opacity:0 ActionOverflow: id: ao + size_hint_x: 0.15 ActionOvrButton: name: 'about' text: _('About') ActionOvrButton: - name: 'wallets' - text: _('Wallets') - ActionOvrButton: name: 'network' text: _('Network') ActionOvrButton: + name: 'lightning' + text: _('Lightning') + ActionOvrButton: + name: 'status' + text: _('Wallet Info') + ActionOvrButton: name: 'addresses_dialog' text: _('Addresses') ActionOvrButton: @@ -462,6 +468,7 @@ BoxLayout: # when widget overflow drop down is shown, adjust the width parent = args[1] if parent: ao._dropdown.width = sp(200) + ScreenManager: id: manager ScreenTabs: diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py @@ -104,6 +104,11 @@ class ElectrumWindow(App): is_fiat = BooleanProperty(False) blockchain_forkpoint = NumericProperty(0) + lightning_gossip_num_peers = NumericProperty(0) + lightning_gossip_num_nodes = NumericProperty(0) + lightning_gossip_num_channels = NumericProperty(0) + lightning_gossip_num_queries = NumericProperty(0) + auto_connect = BooleanProperty(False) def on_auto_connect(self, instance, x): net_params = self.network.get_parameters() @@ -561,6 +566,9 @@ class ElectrumWindow(App): self.network.register_callback(self.on_channel, ['channel']) self.network.register_callback(self.on_invoice_status, ['invoice_status']) self.network.register_callback(self.on_request_status, ['request_status']) + self.network.register_callback(self.on_channel_db, ['channel_db']) + self.network.register_callback(self.set_num_peers, ['gossip_peers']) + self.network.register_callback(self.set_unknown_channels, ['unknown_channels']) # load wallet self.load_wallet_by_name(self.electrum_config.get_wallet_path(use_gui_last_wallet=True)) # URI passed in config @@ -568,6 +576,15 @@ class ElectrumWindow(App): if uri: self.set_URI(uri) + def on_channel_db(self, event, num_nodes, num_channels, num_policies): + self.lightning_gossip_num_nodes = num_nodes + self.lightning_gossip_num_channels = num_channels + + def set_num_peers(self, event, num_peers): + self.lightning_gossip_num_peers = num_peers + + def set_unknown_channels(self, event, unknown): + self.lightning_gossip_num_queries = unknown def get_wallet_path(self): if self.wallet: diff --git a/electrum/gui/kivy/uix/ui_screens/lightning.kv b/electrum/gui/kivy/uix/ui_screens/lightning.kv @@ -0,0 +1,28 @@ +Popup: + id: ln + title: _('Lightning Network') + BoxLayout: + orientation: 'vertical' + ScrollView: + GridLayout: + id: scrollviewlayout + cols:1 + size_hint: 1, None + height: self.minimum_height + padding: '10dp' + SettingsItem: + value: _("{} connections.").format(app.lightning_gossip_num_peers) if app.lightning_gossip_num_peers else _("Not connected") + title: _("Gossip") + ': ' + self.value + description: _("Connections with lightning nodes") + CardSeparator + SettingsItem: + title: _("Nodes") + ': ' + str(app.lightning_gossip_num_nodes) + description: _("Nodes in database.") + CardSeparator + SettingsItem: + title: _("Channels") + ': ' + str(app.lightning_gossip_num_channels) + description: _("Channels in database.") + CardSeparator + SettingsItem: + title: _("Pending") + ': ' + str(app.lightning_gossip_num_queries) + description: _("Channel updates to query.")