Browse Source

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

regtest_lnd
Abdussamad Abdurrazzaq 6 years ago
committed by ghost43
parent
commit
ffe676bc28
  1. 2
      electrum/gui/qt/address_list.py
  2. 5
      electrum/gui/qt/history_list.py
  3. 2
      electrum/gui/qt/invoice_list.py
  4. 9
      electrum/gui/qt/request_list.py
  5. 2
      electrum/gui/qt/utxo_list.py

2
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)

5
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)

2
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:

9
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))

2
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):

Loading…
Cancel
Save