electrum

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

commit df5acd1ea5f3dfc781d4ae91ef3860ff634d8a68
parent 6c2ef176cceb7a1cb1c08550a22d0ee4c1b27d6b
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 10 Mar 2020 17:30:08 +0100

kivy: add delete button for invoices/requests

Diffstat:
Aelectrum/gui/kivy/theming/light/delete.png | 0
Melectrum/gui/kivy/uix/screens.py | 16+++++++++++++++-
Melectrum/gui/kivy/uix/ui_screens/receive.kv | 2+-
Melectrum/gui/kivy/uix/ui_screens/send.kv | 6+++++-
Melectrum/wallet.py | 2++
5 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/electrum/gui/kivy/theming/light/delete.png b/electrum/gui/kivy/theming/light/delete.png Binary files differ. diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py @@ -393,6 +393,19 @@ class SendScreen(CScreen): else: self.app.tx_dialog(tx) + def clear_invoices_dialog(self): + invoices = self.app.wallet.get_invoices() + if not invoices: + return + def callback(c): + if c: + for req in invoices: + key = req['key'] + self.app.wallet.delete_invoice(key) + self.update() + n = len(invoices) + d = Question(_(f'Delete {n} invoices?'), callback) + d.open() class ReceiveScreen(CScreen): @@ -508,7 +521,8 @@ class ReceiveScreen(CScreen): key = req.get('rhash') or req['address'] self.app.wallet.delete_request(key) self.update() - d = Question(_('Delete all requests?'), callback) + n = len(requests) + d = Question(_(f'Delete {n} requests?'), callback) d.open() diff --git a/electrum/gui/kivy/uix/ui_screens/receive.kv b/electrum/gui/kivy/uix/ui_screens/receive.kv @@ -134,7 +134,7 @@ size_hint: 1, None height: '48dp' IconButton: - icon: 'atlas://electrum/gui/kivy/theming/light/list' + icon: 'atlas://electrum/gui/kivy/theming/light/delete' size_hint: 0.5, None height: '48dp' on_release: Clock.schedule_once(lambda dt: s.clear_requests_dialog()) diff --git a/electrum/gui/kivy/uix/ui_screens/send.kv b/electrum/gui/kivy/uix/ui_screens/send.kv @@ -149,6 +149,10 @@ size_hint: 1, None height: '48dp' IconButton: + icon: 'atlas://electrum/gui/kivy/theming/light/delete' + size_hint: 0.5, 1 + on_release: Clock.schedule_once(lambda dt: s.clear_invoices_dialog()) + IconButton: size_hint: 0.5, 1 on_release: s.do_save() icon: 'atlas://electrum/gui/kivy/theming/light/save' @@ -158,7 +162,7 @@ on_release: s.do_paste() IconButton: id: qr - size_hint: 1, 1 + size_hint: 0.5, 1 on_release: Clock.schedule_once(lambda dt: app.scan_qr(on_complete=app.on_qr)) icon: 'atlas://electrum/gui/kivy/theming/light/camera' Button: diff --git a/electrum/wallet.py b/electrum/wallet.py @@ -681,6 +681,8 @@ class Abstract_Wallet(AddressSynchronizer, ABC): item['status'] = self.lnworker.get_invoice_status(key) else: return + # unique handle + item['key'] = key return item def _get_relevant_invoice_keys_for_tx(self, tx: Transaction) -> Set[str]: