Browse Source
qt channels list: fields should not be editable
dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
SomberNight
5 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
3 changed files with
10 additions and
5 deletions
-
electrum/gui/qt/address_list.py
-
electrum/gui/qt/channels_list.py
-
electrum/gui/qt/util.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): |
|
|
|
|
|
@ -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) |
|
|
|
|
|
|
|
|
|
@ -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 = "" |
|
|
|