electrum

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

commit 2ee881f40a8e4b86253cd1cd5ba62d54b344a835
parent db8e6cabb451617081261ee1aefe06ab9a3f1fad
Author: SomberNight <somber.night@protonmail.com>
Date:   Wed, 28 Aug 2019 16:54:51 +0200

qt channels list: fields should not be editable

Diffstat:
Melectrum/gui/qt/address_list.py | 2+-
Melectrum/gui/qt/channels_list.py | 4+++-
Melectrum/gui/qt/util.py | 9++++++---
3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/electrum/gui/qt/address_list.py b/electrum/gui/qt/address_list.py @@ -146,7 +146,7 @@ class AddressList(MyTreeView): item.setTextAlignment(Qt.AlignVCenter) if i not in (self.Columns.TYPE, self.Columns.LABEL): item.setFont(QFont(MONOSPACE_FONT)) - item.setEditable(i in self.editable_columns) + self.set_editability(address_item) address_item[self.Columns.FIAT_BALANCE].setTextAlignment(Qt.AlignRight | Qt.AlignVCenter) # setup column 0 if self.wallet.is_change(address): diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py @@ -40,7 +40,8 @@ class ChannelsList(MyTreeView): } def __init__(self, parent): - super().__init__(parent, self.create_menu, stretch_column=self.Columns.NODE_ID) + super().__init__(parent, self.create_menu, stretch_column=self.Columns.NODE_ID, + editable_columns=[]) self.setModel(QtGui.QStandardItemModel(self)) self.main_window = parent self.update_rows.connect(self.do_update_rows) @@ -126,6 +127,7 @@ class ChannelsList(MyTreeView): self.update_headers(self.headers) for chan in self.parent.wallet.lnworker.channels.values(): items = [QtGui.QStandardItem(x) for x in self.format_fields(chan)] + self.set_editability(items) items[self.Columns.NODE_ID].setData(chan.channel_id, ROLE_CHANNEL_ID) self.model().insertRow(0, items) diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py @@ -458,7 +458,8 @@ class ElectrumItemDelegate(QStyledItemDelegate): class MyTreeView(QTreeView): - def __init__(self, parent: 'ElectrumWindow', create_menu, stretch_column=None, editable_columns=None): + def __init__(self, parent: 'ElectrumWindow', create_menu, *, + stretch_column=None, editable_columns=None): super().__init__(parent) self.parent = parent self.config = self.parent.config @@ -468,10 +469,12 @@ class MyTreeView(QTreeView): self.setUniformRowHeights(True) # Control which columns are editable - if editable_columns is None: + if editable_columns is not None: + editable_columns = set(editable_columns) + elif stretch_column is not None: editable_columns = {stretch_column} else: - editable_columns = set(editable_columns) + editable_columns = {} self.editable_columns = editable_columns self.setItemDelegate(ElectrumItemDelegate(self)) self.current_filter = ""