mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
kivy:
- simplify menu - add lightning network dialog
This commit is contained in:
parent
2dd368e76e
commit
7b5869c7bc
3 changed files with 65 additions and 13 deletions
|
@ -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:
|
||||
|
|
|
@ -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
Normal file
28
electrum/gui/kivy/uix/ui_screens/lightning.kv
Normal file
|
@ -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…
Add table
Reference in a new issue