electrum

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

commit ffe676bc28213f530aec2394d3995c4569492e4a
parent 441da52b513cb3f2470ac35978b16eefdf1d07de
Author: Abdussamad Abdurrazzaq <AbdussamadA@users.noreply.github.com>
Date:   Fri,  5 Apr 2019 18:59:14 +0500

Strip whitespace from amounts when copying. Fix bug in request list where address was copied instead of column specific data (#5228)


Diffstat:
Melectrum/gui/qt/address_list.py | 2++
Melectrum/gui/qt/history_list.py | 5+++++
Melectrum/gui/qt/invoice_list.py | 2++
Melectrum/gui/qt/request_list.py | 9++++++---
Melectrum/gui/qt/utxo_list.py | 2++
5 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/electrum/gui/qt/address_list.py b/electrum/gui/qt/address_list.py @@ -197,6 +197,8 @@ class AddressList(MyTreeView): column_title = self.model().horizontalHeaderItem(col).text() copy_text = self.model().itemFromIndex(idx).text() + if col == self.Columns.COIN_BALANCE or col == self.Columns.FIAT_BALANCE: + copy_text = copy_text.strip() menu.addAction(_("Copy {}").format(column_title), lambda: self.place_text_on_clipboard(copy_text)) menu.addAction(_('Details'), lambda: self.parent.show_address(addr)) persistent = QPersistentModelIndex(addr_idx) diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py @@ -579,7 +579,12 @@ class HistoryList(MyTreeView, AcceptFileDragDrop): menu = QMenu() if height == TX_HEIGHT_LOCAL: menu.addAction(_("Remove"), lambda: self.remove_local_tx(tx_hash)) + + amount_columns = [HistoryColumns.COIN_VALUE, HistoryColumns.RUNNING_COIN_BALANCE, HistoryColumns.FIAT_VALUE, HistoryColumns.FIAT_ACQ_PRICE, HistoryColumns.FIAT_CAP_GAINS] + if column in amount_columns: + column_data = column_data.strip() menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(column_data)) + for c in self.editable_columns: if self.isColumnHidden(c): continue label = self.hm.headerData(c, Qt.Horizontal, Qt.DisplayRole) diff --git a/electrum/gui/qt/invoice_list.py b/electrum/gui/qt/invoice_list.py @@ -109,6 +109,8 @@ class InvoiceList(MyTreeView): status = self.parent.invoices.get_status(key) menu = QMenu(self) if column_data: + if column == self.Columns.AMOUNT: + column_data = column_data.strip() menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(column_data)) menu.addAction(_("Details"), lambda: self.parent.show_invoice(key)) if status == PR_UNPAID: diff --git a/electrum/gui/qt/request_list.py b/electrum/gui/qt/request_list.py @@ -138,11 +138,12 @@ class RequestList(MyTreeView): def create_menu(self, position): idx = self.indexAt(position) + item = self.model().itemFromIndex(idx) # TODO use siblingAtColumn when min Qt version is >=5.11 - item = self.model().itemFromIndex(idx.sibling(idx.row(), self.Columns.ADDRESS)) - if not item: + item_addr = self.model().itemFromIndex(idx.sibling(idx.row(), self.Columns.ADDRESS)) + if not item_addr: return - addr = item.text() + addr = item_addr.text() req = self.wallet.receive_requests.get(addr) if req is None: self.update() @@ -152,6 +153,8 @@ class RequestList(MyTreeView): column_data = item.text() menu = QMenu(self) if column != self.Columns.SIGNATURE: + if column == self.Columns.AMOUNT: + column_data = column_data.strip() menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(column_data)) menu.addAction(_("Copy URI"), lambda: self.parent.view_and_paste('URI', '', self.parent.get_request_URI(addr))) menu.addAction(_("Save as BIP70 file"), lambda: self.parent.export_payment_request(addr)) diff --git a/electrum/gui/qt/utxo_list.py b/electrum/gui/qt/utxo_list.py @@ -126,6 +126,8 @@ class UTXOList(MyTreeView): col = idx.column() column_title = self.model().horizontalHeaderItem(col).text() copy_text = self.model().itemFromIndex(idx).text() if col != self.Columns.OUTPOINT else selected[0] + if col == self.Columns.AMOUNT: + copy_text = copy_text.strip() menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(copy_text)) # "Freeze coin" if not self.wallet.is_frozen_coin(utxo_dict):