lightning: complete moving of lightning objects, acquire net/wallet lock while answering lightning requests
This commit is contained in:
@@ -52,6 +52,7 @@ from electrum.logging import Logger
|
||||
|
||||
from .installwizard import InstallWizard, WalletAlreadyOpenInMemory
|
||||
|
||||
from electrum.lightning import LightningUI
|
||||
|
||||
from .util import get_default_language, read_QIcon, ColorScheme, custom_message_box
|
||||
from .main_window import ElectrumWindow
|
||||
@@ -139,6 +140,11 @@ class ElectrumGui(Logger):
|
||||
# the OS/window manager/etc might set *a dark theme*.
|
||||
# Hence, try to choose colors accordingly:
|
||||
ColorScheme.update_from_widget(QWidget(), force_dark=use_dark_theme)
|
||||
self.lightning = LightningUI(self.set_console_and_return_lightning)
|
||||
|
||||
def set_console_and_return_lightning(self):
|
||||
self.windows[0].wallet.network.lightningrpc.setConsole(self.windows[0].console)
|
||||
return self.windows[0].wallet.network.lightningrpc
|
||||
|
||||
def build_tray_menu(self):
|
||||
# Avoid immediate GC of old menu when window closed via its action
|
||||
|
||||
@@ -88,6 +88,7 @@ from .util import (read_QIcon, ColorScheme, text_dialog, icon_path, WaitingDialo
|
||||
from .installwizard import WIF_HELP_TEXT
|
||||
from .history_list import HistoryList, HistoryModel
|
||||
from .update_checker import UpdateCheck, UpdateCheckThread
|
||||
from .lightning_invoice_list import LightningInvoiceList
|
||||
|
||||
|
||||
class StatusBarButton(QPushButton):
|
||||
@@ -174,6 +175,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
||||
tabs.addTab(self.create_history_tab(), read_QIcon("tab_history.png"), _('History'))
|
||||
tabs.addTab(self.send_tab, read_QIcon("tab_send.png"), _('Send'))
|
||||
tabs.addTab(self.receive_tab, read_QIcon("tab_receive.png"), _('Receive'))
|
||||
self.lightning_invoices_tab = self.create_lightning_invoices_tab(wallet)
|
||||
tabs.addTab(self.lightning_invoices_tab, _("Lightning Invoices"))
|
||||
|
||||
def add_optional_tab(tabs, tab, icon, description, name):
|
||||
tab.tab_icon = icon
|
||||
@@ -873,6 +876,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
||||
self.invoice_list.update()
|
||||
self.update_completions()
|
||||
|
||||
def create_lightning_invoices_tab(self, wallet):
|
||||
self.lightning_invoice_list = LightningInvoiceList(self, wallet.network.lightningworker, wallet.network.lightningrpc)
|
||||
return self.lightning_invoice_list
|
||||
|
||||
def create_history_tab(self):
|
||||
self.history_model = HistoryModel(self)
|
||||
self.history_list = l = HistoryList(self, self.history_model)
|
||||
@@ -2076,6 +2083,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
||||
'wallet': self.wallet,
|
||||
'network': self.network,
|
||||
'plugins': self.gui_object.plugins,
|
||||
'lightning': self.gui_object.lightning,
|
||||
'window': self,
|
||||
'config': self.config,
|
||||
'electrum': electrum,
|
||||
|
||||
Reference in New Issue
Block a user