|
|
@ -1745,7 +1745,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): |
|
|
|
self.payment_request = None |
|
|
|
self.do_clear() |
|
|
|
|
|
|
|
def on_pr(self, request): |
|
|
|
def on_pr(self, request: 'paymentrequest.PaymentRequest'): |
|
|
|
self.set_onchain(True) |
|
|
|
self.payment_request = request |
|
|
|
if self.payment_request.verify(self.contacts): |
|
|
|
self.payment_request_ok_signal.emit() |
|
|
@ -1922,7 +1923,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): |
|
|
|
pr.verify(self.contacts) |
|
|
|
self.show_bip70_details(pr) |
|
|
|
|
|
|
|
def show_bip70_details(self, pr): |
|
|
|
def show_bip70_details(self, pr: 'paymentrequest.PaymentRequest'): |
|
|
|
key = pr.get_id() |
|
|
|
d = WindowModalDialog(self, _("BIP70 Invoice")) |
|
|
|
vbox = QVBoxLayout(d) |
|
|
@ -1930,7 +1931,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): |
|
|
|
grid.addWidget(QLabel(_("Requestor") + ':'), 0, 0) |
|
|
|
grid.addWidget(QLabel(pr.get_requestor()), 0, 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())) |
|
|
|
outputs_str = '\n'.join(map(lambda x: self.format_amount(x.value)+ self.base_unit() + ' @ ' + x.address, pr.get_outputs())) |
|
|
|
grid.addWidget(QLabel(outputs_str), 1, 1) |
|
|
|
expires = pr.get_expiration_date() |
|
|
|
grid.addWidget(QLabel(_("Memo") + ':'), 2, 0) |
|
|
@ -1950,26 +1951,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): |
|
|
|
data = f.write(pr.raw) |
|
|
|
self.show_message(_('Invoice saved as' + ' ' + fn)) |
|
|
|
exportButton = EnterButton(_('Save'), do_export) |
|
|
|
def do_delete(): |
|
|
|
if self.question(_('Delete invoice?')): |
|
|
|
self.wallet.delete_invoices(key) |
|
|
|
self.history_list.update() |
|
|
|
self.invoice_list.update() |
|
|
|
d.close() |
|
|
|
deleteButton = EnterButton(_('Delete'), do_delete) |
|
|
|
vbox.addLayout(Buttons(exportButton, deleteButton, CloseButton(d))) |
|
|
|
# note: "delete" disabled as invoice is saved with a different key in wallet.invoices that we do not have here |
|
|
|
# def do_delete(): |
|
|
|
# if self.question(_('Delete invoice?')): |
|
|
|
# self.wallet.delete_invoice(key) |
|
|
|
# self.history_list.update() |
|
|
|
# self.invoice_list.update() |
|
|
|
# d.close() |
|
|
|
# deleteButton = EnterButton(_('Delete'), do_delete) |
|
|
|
vbox.addLayout(Buttons(exportButton, CloseButton(d))) |
|
|
|
d.exec_() |
|
|
|
|
|
|
|
def pay_bip70_invoice(self, key): |
|
|
|
pr = self.wallet.get_invoice(key) |
|
|
|
self.payment_request = pr |
|
|
|
self.prepare_for_payment_request() |
|
|
|
pr.error = None # this forces verify() to re-run |
|
|
|
if pr.verify(self.contacts): |
|
|
|
self.payment_request_ok() |
|
|
|
else: |
|
|
|
self.payment_request_error() |
|
|
|
|
|
|
|
def create_console_tab(self): |
|
|
|
from .console import Console |
|
|
|
self.console = console = Console() |
|
|
|