electrum

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

commit 796853106537e7909729172a1315935028e6765c
parent b14747ecfe9d6df695ff30021a2cf997307b3961
Author: Nelson Perez <bilthon@gmail.com>
Date:   Wed,  8 Jan 2020 20:14:18 -0500

Restoring old behavior of the outpoint copy to clipboard feature (#5879)

* Restoring old behavior of the outpoint copy to clipboard feature

* Small code style adjustments

Diffstat:
Melectrum/gui/qt/util.py | 7+++++--
Melectrum/gui/qt/utxo_list.py | 1+
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py @@ -480,6 +480,7 @@ class ElectrumItemDelegate(QStyledItemDelegate): return super().createEditor(parent, option, idx) class MyTreeView(QTreeView): + ROLE_CLIPBOARD_DATA = Qt.UserRole + 100 def __init__(self, parent: 'ElectrumWindow', create_menu, *, stretch_column=None, editable_columns=None): @@ -653,9 +654,11 @@ class MyTreeView(QTreeView): for column in self.Columns: column_title = self.model().horizontalHeaderItem(column).text() item_col = self.model().itemFromIndex(idx.sibling(idx.row(), column)) - column_data = item_col.text().strip() + clipboard_data = item_col.data(self.ROLE_CLIPBOARD_DATA) + if clipboard_data is None: + clipboard_data = item_col.text().strip() cc.addAction(column_title, - lambda text=column_data, title=column_title: + lambda text=clipboard_data, title=column_title: self.place_text_on_clipboard(text, title=title)) def place_text_on_clipboard(self, text: str, *, title: str = None) -> None: diff --git a/electrum/gui/qt/utxo_list.py b/electrum/gui/qt/utxo_list.py @@ -97,6 +97,7 @@ class UTXOList(MyTreeView): labels = [name_short, address, label, amount, '%d'%height] utxo_item = [QStandardItem(x) for x in labels] self.set_editability(utxo_item) + utxo_item[self.Columns.OUTPOINT].setData(name, self.ROLE_CLIPBOARD_DATA) utxo_item[self.Columns.ADDRESS].setFont(QFont(MONOSPACE_FONT)) utxo_item[self.Columns.AMOUNT].setFont(QFont(MONOSPACE_FONT)) utxo_item[self.Columns.OUTPOINT].setFont(QFont(MONOSPACE_FONT))