electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 8c3af39a9b20318f653f2ca360f2d60fdc0571cc
parent dd6cb2caf7e1eff6a8af07a2e0363da371aa1b13
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 12 Nov 2019 18:37:35 +0100

add option to pay multiple invoices

Diffstat:
Melectrum/gui/qt/invoice_list.py | 10++++++++--
Melectrum/gui/qt/main_window.py | 6++++++
2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/electrum/gui/qt/invoice_list.py b/electrum/gui/qt/invoice_list.py @@ -146,8 +146,14 @@ class InvoiceList(MyTreeView): def create_menu(self, position): items = self.selected_in_column(0) - if len(items) > 1: - print(items) + if len(items)>1: + keys = [ item.data(ROLE_REQUEST_ID) for item in items] + invoices = [ self.parent.wallet.get_invoice(key) for key in keys] + invoices = [ invoice for invoice in invoices if invoice['status'] == PR_UNPAID and invoice['type'] == PR_TYPE_ONCHAIN] + if len(invoices) > 1: + menu = QMenu(self) + menu.addAction(_("Pay multiple invoices"), lambda: self.parent.pay_multiple_invoices(invoices)) + menu.exec_(self.viewport().mapToGlobal(position)) return idx = self.indexAt(position) item = self.model().itemFromIndex(idx) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py @@ -1435,6 +1435,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): self.do_clear() self.do_pay_invoice(invoice) + def pay_multiple_invoices(self, invoices): + outputs = [] + for invoice in invoices: + outputs += invoice['outputs'] + self.pay_onchain_dialog(self.get_coins, outputs) + def do_pay_invoice(self, invoice): if invoice['type'] == PR_TYPE_LN: self.pay_lightning_invoice(invoice['invoice'])