archive paid invoices in the history tab
This commit is contained in:
@@ -79,6 +79,7 @@ class HistoryList(MyTreeWidget):
|
||||
for h_item in h:
|
||||
tx_hash, height, conf, timestamp, value, balance = h_item
|
||||
status, status_str = self.wallet.get_tx_status(tx_hash, height, conf, timestamp)
|
||||
has_invoice = self.wallet.invoices.paid.get(tx_hash)
|
||||
icon = QIcon(":icons/" + TX_ICONS[status])
|
||||
v_str = self.parent.format_amount(value, True, whitespaces=True)
|
||||
balance_str = self.parent.format_amount(balance, whitespaces=True)
|
||||
@@ -91,6 +92,8 @@ class HistoryList(MyTreeWidget):
|
||||
entry.append(text)
|
||||
item = QTreeWidgetItem(entry)
|
||||
item.setIcon(0, icon)
|
||||
if has_invoice:
|
||||
item.setIcon(3, QIcon(":icons/seal"))
|
||||
for i in range(len(entry)):
|
||||
if i>3:
|
||||
item.setTextAlignment(i, Qt.AlignRight)
|
||||
@@ -144,6 +147,8 @@ class HistoryList(MyTreeWidget):
|
||||
tx = self.wallet.transactions.get(tx_hash)
|
||||
is_relevant, is_mine, v, fee = self.wallet.get_wallet_delta(tx)
|
||||
is_unconfirmed = height <= 0
|
||||
pr_key = self.wallet.invoices.paid.get(tx_hash)
|
||||
|
||||
menu = QMenu()
|
||||
|
||||
menu.addAction(_("Copy %s")%column_title, lambda: self.parent.app.clipboard().setText(column_data))
|
||||
@@ -159,6 +164,8 @@ class HistoryList(MyTreeWidget):
|
||||
child_tx = self.wallet.cpfp(tx, 0)
|
||||
if child_tx:
|
||||
menu.addAction(_("Child pays for parent"), lambda: self.parent.cpfp(tx, child_tx))
|
||||
if pr_key:
|
||||
menu.addAction(QIcon(":icons/seal"), _("View invoice"), lambda: self.parent.show_invoice(pr_key))
|
||||
if tx_URL:
|
||||
menu.addAction(_("View on block explorer"), lambda: webbrowser.open(tx_URL))
|
||||
menu.exec_(self.viewport().mapToGlobal(position))
|
||||
|
||||
@@ -29,7 +29,6 @@ from electrum.i18n import _
|
||||
from electrum.util import block_explorer_URL, format_satoshis, format_time
|
||||
from electrum.plugins import run_hook
|
||||
|
||||
|
||||
class InvoiceList(MyTreeWidget):
|
||||
filter_columns = [0, 1, 2, 3] # Date, Requestor, Description, Amount
|
||||
|
||||
@@ -40,7 +39,7 @@ class InvoiceList(MyTreeWidget):
|
||||
self.setColumnWidth(1, 200)
|
||||
|
||||
def on_update(self):
|
||||
inv_list = self.parent.invoices.sorted_list()
|
||||
inv_list = self.parent.invoices.unpaid_invoices()
|
||||
self.clear()
|
||||
for pr in inv_list:
|
||||
key = pr.get_id()
|
||||
|
||||
@@ -1383,7 +1383,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
return False, _("Payment request has expired")
|
||||
status, msg = self.network.broadcast(tx)
|
||||
if pr and status is True:
|
||||
pr.set_paid(tx.txid())
|
||||
self.invoices.set_paid(pr, tx.txid())
|
||||
self.invoices.save()
|
||||
self.payment_request = None
|
||||
refund_address = self.wallet.get_receiving_addresses()[0]
|
||||
@@ -1621,27 +1621,18 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
grid = QGridLayout()
|
||||
grid.addWidget(QLabel(_("Requestor") + ':'), 0, 0)
|
||||
grid.addWidget(QLabel(pr.get_requestor()), 0, 1)
|
||||
grid.addWidget(QLabel(_("Expires") + ':'), 1, 0)
|
||||
grid.addWidget(QLabel(format_time(pr.get_expiration_date())), 1, 1)
|
||||
grid.addWidget(QLabel(_("Memo") + ':'), 2, 0)
|
||||
grid.addWidget(QLabel(pr.get_memo()), 2, 1)
|
||||
grid.addWidget(QLabel(_("Signature") + ':'), 3, 0)
|
||||
grid.addWidget(QLabel(pr.get_verify_status()), 3, 1)
|
||||
grid.addWidget(QLabel(_("Payment URL") + ':'), 4, 0)
|
||||
grid.addWidget(QLabel(pr.payment_url), 4, 1)
|
||||
grid.addWidget(QLabel(_("Outputs") + ':'), 5, 0)
|
||||
outputs_str = '\n'.join(map(lambda x: x[1] + ' ' + self.format_amount(x[2])+ self.base_unit(), pr.get_outputs()))
|
||||
grid.addWidget(QLabel(outputs_str), 5, 1)
|
||||
if pr.tx:
|
||||
grid.addWidget(QLabel(_("Transaction ID") + ':'), 6, 0)
|
||||
l = QLineEdit(pr.tx)
|
||||
l.setReadOnly(True)
|
||||
grid.addWidget(l, 6, 1)
|
||||
grid.addWidget(QLabel(_("Amount") + ':'), 1, 0)
|
||||
outputs_str = '\n'.join(map(lambda x: self.format_amount(x[2])+ self.base_unit() + ' @ ' + x[1], pr.get_outputs()))
|
||||
grid.addWidget(QLabel(outputs_str), 1, 1)
|
||||
grid.addWidget(QLabel(_("Expires") + ':'), 2, 0)
|
||||
grid.addWidget(QLabel(format_time(pr.get_expiration_date())), 2, 1)
|
||||
grid.addWidget(QLabel(_("Memo") + ':'), 3, 0)
|
||||
grid.addWidget(QLabel(pr.get_memo()), 3, 1)
|
||||
grid.addWidget(QLabel(_("Signature") + ':'), 4, 0)
|
||||
grid.addWidget(QLabel(pr.get_verify_status()), 4, 1)
|
||||
vbox.addLayout(grid)
|
||||
vbox.addLayout(Buttons(CloseButton(d)))
|
||||
d.exec_()
|
||||
return
|
||||
|
||||
|
||||
def do_pay_invoice(self, key):
|
||||
pr = self.invoices.get(key)
|
||||
|
||||
Reference in New Issue
Block a user