commit 45a309ff25af2b1c437b3dcf2b3c6a18b66b6aee
parent 614a38ae5ca02ccb01dfe6232fe1f00cacf4941f
Author: SomberNight <somber.night@protonmail.com>
Date: Sun, 23 Feb 2020 20:30:14 +0100
qt channels_list: early exit if lightning is disabled
(note: signal is coming from a different wallet/window)
Traceback (most recent call last):
File "...\electrum\electrum\gui\qt\channels_list.py", line 142, in do_update_single_row
self.update_can_send(self.parent.wallet.lnworker)
File "...\electrum\electrum\gui\qt\channels_list.py", line 164, in update_can_send
msg = _('Can send') + ' ' + self.parent.format_amount(lnworker.can_send())\
AttributeError: 'NoneType' object has no attribute 'can_send'
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py
@@ -134,12 +134,15 @@ class ChannelsList(MyTreeView):
@QtCore.pyqtSlot(Channel)
def do_update_single_row(self, chan):
+ lnworker = self.parent.wallet.lnworker
+ if not lnworker:
+ return
for row in range(self.model().rowCount()):
item = self.model().item(row, self.Columns.NODE_ID)
if item.data(ROLE_CHANNEL_ID) == chan.channel_id:
for column, v in enumerate(self.format_fields(chan)):
self.model().item(row, column).setData(v, QtCore.Qt.DisplayRole)
- self.update_can_send(self.parent.wallet.lnworker)
+ self.update_can_send(lnworker)
@QtCore.pyqtSlot(Abstract_Wallet)
def do_update_rows(self, wallet):
diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
@@ -207,7 +207,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
self.utxo_tab = self.create_utxo_tab()
self.console_tab = self.create_console_tab()
self.contacts_tab = self.create_contacts_tab()
- self.channels_tab = self.create_channels_tab(wallet)
+ self.channels_tab = self.create_channels_tab()
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'))
@@ -932,7 +932,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
self.channels_list.update_rows.emit(wallet)
self.update_completions()
- def create_channels_tab(self, wallet):
+ def create_channels_tab(self):
self.channels_list = ChannelsList(self)
t = self.channels_list.get_toolbar()
return self.create_list_tab(self.channels_list, t)