Browse Source

kivy:

- simplify menu
 - add lightning network dialog
dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 5 years ago
parent
commit
7b5869c7bc
  1. 33
      electrum/gui/kivy/main.kv
  2. 17
      electrum/gui/kivy/main_window.py
  3. 28
      electrum/gui/kivy/uix/ui_screens/lightning.kv

33
electrum/gui/kivy/main.kv

@ -421,34 +421,40 @@ 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')
@ -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:

17
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:

28
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.")
Loading…
Cancel
Save