Browse Source

Allow to remove local transactions from the GUI

3.1
Johann Bauer 7 years ago
parent
commit
5e9d901794
  1. 21
      gui/qt/history_list.py

21
gui/qt/history_list.py

@ -159,11 +159,15 @@ class HistoryList(MyTreeWidget):
menu = QMenu() menu = QMenu()
if height == -2:
menu.addAction(_("Remove"), lambda: self.remove_local_tx(tx_hash))
menu.addAction(_("Copy %s")%column_title, lambda: self.parent.app.clipboard().setText(column_data)) menu.addAction(_("Copy %s")%column_title, lambda: self.parent.app.clipboard().setText(column_data))
if column in self.editable_columns: if column in self.editable_columns:
menu.addAction(_("Edit %s")%column_title, lambda: self.editItem(item, column)) menu.addAction(_("Edit %s")%column_title, lambda: self.editItem(item, column))
menu.addAction(_("Details"), lambda: self.parent.show_transaction(tx)) menu.addAction(_("Details"), lambda: self.parent.show_transaction(tx))
if is_unconfirmed and tx: if is_unconfirmed and tx:
rbf = is_mine and not tx.is_final() rbf = is_mine and not tx.is_final()
if rbf: if rbf:
@ -177,3 +181,20 @@ class HistoryList(MyTreeWidget):
if tx_URL: if tx_URL:
menu.addAction(_("View on block explorer"), lambda: webbrowser.open(tx_URL)) menu.addAction(_("View on block explorer"), lambda: webbrowser.open(tx_URL))
menu.exec_(self.viewport().mapToGlobal(position)) menu.exec_(self.viewport().mapToGlobal(position))
def remove_local_tx(self, tx_hash):
answer = QMessageBox.question(self.parent,
_("Please confirm"),
_("Are you sure you want to remove this transaction?"),
QMessageBox.Yes,
QMessageBox.No)
if answer == QMessageBox.No:
return
self.wallet.remove_transaction(tx_hash)
root = self.invisibleRootItem()
child_count = root.childCount()
for i in range(child_count):
item = root.child(i)
if item.data(0, Qt.UserRole) == tx_hash:
root.removeChild(item)
return

Loading…
Cancel
Save