Browse Source

qt: do not show paid requests

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 6 years ago
parent
commit
98a1c9268a
  1. 5
      electrum/gui/qt/invoice_list.py
  2. 4
      electrum/gui/qt/request_list.py

5
electrum/gui/qt/invoice_list.py

@ -45,6 +45,7 @@ REQUEST_TYPE_LN = 1
ROLE_REQUEST_TYPE = Qt.UserRole ROLE_REQUEST_TYPE = Qt.UserRole
ROLE_REQUEST_ID = Qt.UserRole + 1 ROLE_REQUEST_ID = Qt.UserRole + 1
from electrum.paymentrequest import PR_PAID
class InvoiceList(MyTreeView): class InvoiceList(MyTreeView):
@ -92,11 +93,13 @@ class InvoiceList(MyTreeView):
self.model().insertRow(idx, items) self.model().insertRow(idx, items)
lnworker = self.parent.wallet.lnworker lnworker = self.parent.wallet.lnworker
items = lnworker.invoices.items() if lnworker else [] items = list(lnworker.invoices.items()) if lnworker else []
for key, (invoice, direction, is_paid) in items: for key, (invoice, direction, is_paid) in items:
if direction == RECEIVED: if direction == RECEIVED:
continue continue
status = lnworker.get_invoice_status(key) status = lnworker.get_invoice_status(key)
if status == PR_PAID:
continue
lnaddr = lndecode(invoice, expected_hrp=constants.net.SEGWIT_HRP) lnaddr = lndecode(invoice, expected_hrp=constants.net.SEGWIT_HRP)
amount_sat = lnaddr.amount*COIN if lnaddr.amount else None amount_sat = lnaddr.amount*COIN if lnaddr.amount else None
amount_str = self.parent.format_amount(amount_sat) if amount_sat else '' amount_str = self.parent.format_amount(amount_sat) if amount_sat else ''

4
electrum/gui/qt/request_list.py

@ -107,12 +107,14 @@ class RequestList(MyTreeView):
self.model().clear() self.model().clear()
self.update_headers(self.__class__.headers) self.update_headers(self.__class__.headers)
for req in self.wallet.get_sorted_requests(self.config): for req in self.wallet.get_sorted_requests(self.config):
status = req.get('status')
if status == PR_PAID:
continue
request_type = REQUEST_TYPE_LN if req.get('lightning', False) else REQUEST_TYPE_BITCOIN request_type = REQUEST_TYPE_LN if req.get('lightning', False) else REQUEST_TYPE_BITCOIN
timestamp = req.get('time', 0) timestamp = req.get('time', 0)
amount = req.get('amount') amount = req.get('amount')
message = req['memo'] message = req['memo']
date = format_time(timestamp) date = format_time(timestamp)
status = req.get('status')
amount_str = self.parent.format_amount(amount) if amount else "" amount_str = self.parent.format_amount(amount) if amount else ""
labels = [date, message, amount_str, pr_tooltips.get(status,'')] labels = [date, message, amount_str, pr_tooltips.get(status,'')]
items = [QStandardItem(e) for e in labels] items = [QStandardItem(e) for e in labels]

Loading…
Cancel
Save