electrum

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

commit ab5338b46b78152eb0f430837133ffd1ed855783
parent 527e0b9b897e07ae671ca180ab8e5f89423b8aec
Author: ThomasV <thomasv@electrum.org>
Date:   Wed, 29 Apr 2020 11:41:57 +0200

fix #6111, and show channels tab even if lightning is disabled (follow-up 527e0b9b897e07ae671ca180ab8e5f89423b8aec)

Diffstat:
Melectrum/gui/qt/channels_list.py | 15++++++++-------
Melectrum/gui/qt/main_window.py | 6++----
2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py @@ -11,7 +11,7 @@ from PyQt5.QtGui import QFont, QStandardItem, QBrush from electrum.util import bh2u, NotEnoughFunds, NoDynamicFeeEstimates from electrum.i18n import _ -from electrum.lnchannel import Channel, PeerState +from electrum.lnchannel import AbstractChannel, PeerState from electrum.wallet import Abstract_Wallet from electrum.lnutil import LOCAL, REMOTE, format_short_channel_id, LN_MAX_FUNDING_SAT from electrum.lnworker import LNWallet @@ -26,7 +26,7 @@ ROLE_CHANNEL_ID = Qt.UserRole class ChannelsList(MyTreeView): update_rows = QtCore.pyqtSignal(Abstract_Wallet) - update_single_row = QtCore.pyqtSignal(Channel) + update_single_row = QtCore.pyqtSignal(AbstractChannel) class Columns(IntEnum): SHORT_CHANID = 0 @@ -196,8 +196,8 @@ class ChannelsList(MyTreeView): menu.addAction(_("Delete"), lambda: self.remove_channel(channel_id)) menu.exec_(self.viewport().mapToGlobal(position)) - @QtCore.pyqtSlot(Channel) - def do_update_single_row(self, chan: Channel): + @QtCore.pyqtSlot(AbstractChannel) + def do_update_single_row(self, chan: AbstractChannel): lnworker = self.parent.wallet.lnworker if not lnworker: return @@ -235,7 +235,7 @@ class ChannelsList(MyTreeView): self.sortByColumn(self.Columns.SHORT_CHANID, Qt.DescendingOrder) - def _update_chan_frozen_bg(self, *, chan: Channel, items: Sequence[QStandardItem]): + def _update_chan_frozen_bg(self, *, chan: AbstractChannel, items: Sequence[QStandardItem]): assert self._default_item_bg_brush is not None # frozen for sending item = items[self.Columns.LOCAL_BALANCE] @@ -266,10 +266,11 @@ class ChannelsList(MyTreeView): self.can_send_label = QLabel('') h.addWidget(self.can_send_label) h.addStretch() - h.addWidget(EnterButton(_('Open Channel'), self.new_channel_dialog)) + self.new_channel_button = EnterButton(_('Open Channel'), self.new_channel_dialog) + self.new_channel_button.setEnabled(self.parent.wallet.has_lightning()) + h.addWidget(self.new_channel_button) return h - def statistics_dialog(self): channel_db = self.parent.network.channel_db capacity = self.parent.format_amount(channel_db.capacity()) + ' '+ self.parent.base_unit() diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py @@ -224,8 +224,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): tabs.addTab(tab, icon, description.replace("&", "")) add_optional_tab(tabs, self.addresses_tab, read_QIcon("tab_addresses.png"), _("&Addresses"), "addresses") - if self.wallet.has_lightning(): - add_optional_tab(tabs, self.channels_tab, read_QIcon("lightning.png"), _("Channels"), "channels") + add_optional_tab(tabs, self.channels_tab, read_QIcon("lightning.png"), _("Channels"), "channels") add_optional_tab(tabs, self.utxo_tab, read_QIcon("tab_coins.png"), _("Co&ins"), "utxo") add_optional_tab(tabs, self.contacts_tab, read_QIcon("tab_contacts.png"), _("Con&tacts"), "contacts") add_optional_tab(tabs, self.console_tab, read_QIcon("tab_console.png"), _("Con&sole"), "console") @@ -693,8 +692,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): view_menu = menubar.addMenu(_("&View")) add_toggle_action(view_menu, self.addresses_tab) add_toggle_action(view_menu, self.utxo_tab) - if self.wallet.has_lightning(): - add_toggle_action(view_menu, self.channels_tab) + add_toggle_action(view_menu, self.channels_tab) add_toggle_action(view_menu, self.contacts_tab) add_toggle_action(view_menu, self.console_tab)