Browse Source

qt channels list: fields should not be editable

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
SomberNight 5 years ago
parent
commit
2ee881f40a
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/gui/qt/address_list.py
  2. 4
      electrum/gui/qt/channels_list.py
  3. 9
      electrum/gui/qt/util.py

2
electrum/gui/qt/address_list.py

@ -146,7 +146,7 @@ class AddressList(MyTreeView):
item.setTextAlignment(Qt.AlignVCenter) item.setTextAlignment(Qt.AlignVCenter)
if i not in (self.Columns.TYPE, self.Columns.LABEL): if i not in (self.Columns.TYPE, self.Columns.LABEL):
item.setFont(QFont(MONOSPACE_FONT)) 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) address_item[self.Columns.FIAT_BALANCE].setTextAlignment(Qt.AlignRight | Qt.AlignVCenter)
# setup column 0 # setup column 0
if self.wallet.is_change(address): if self.wallet.is_change(address):

4
electrum/gui/qt/channels_list.py

@ -40,7 +40,8 @@ class ChannelsList(MyTreeView):
} }
def __init__(self, parent): 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.setModel(QtGui.QStandardItemModel(self))
self.main_window = parent self.main_window = parent
self.update_rows.connect(self.do_update_rows) self.update_rows.connect(self.do_update_rows)
@ -126,6 +127,7 @@ class ChannelsList(MyTreeView):
self.update_headers(self.headers) self.update_headers(self.headers)
for chan in self.parent.wallet.lnworker.channels.values(): for chan in self.parent.wallet.lnworker.channels.values():
items = [QtGui.QStandardItem(x) for x in self.format_fields(chan)] 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) items[self.Columns.NODE_ID].setData(chan.channel_id, ROLE_CHANNEL_ID)
self.model().insertRow(0, items) self.model().insertRow(0, items)

9
electrum/gui/qt/util.py

@ -458,7 +458,8 @@ class ElectrumItemDelegate(QStyledItemDelegate):
class MyTreeView(QTreeView): 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) super().__init__(parent)
self.parent = parent self.parent = parent
self.config = self.parent.config self.config = self.parent.config
@ -468,10 +469,12 @@ class MyTreeView(QTreeView):
self.setUniformRowHeights(True) self.setUniformRowHeights(True)
# Control which columns are editable # 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} editable_columns = {stretch_column}
else: else:
editable_columns = set(editable_columns) editable_columns = {}
self.editable_columns = editable_columns self.editable_columns = editable_columns
self.setItemDelegate(ElectrumItemDelegate(self)) self.setItemDelegate(ElectrumItemDelegate(self))
self.current_filter = "" self.current_filter = ""

Loading…
Cancel
Save