Browse Source

kivy: add delete button for invoices/requests

hard-fail-on-bad-server-string
ThomasV 5 years ago
parent
commit
df5acd1ea5
  1. BIN
      electrum/gui/kivy/theming/light/delete.png
  2. 16
      electrum/gui/kivy/uix/screens.py
  3. 2
      electrum/gui/kivy/uix/ui_screens/receive.kv
  4. 6
      electrum/gui/kivy/uix/ui_screens/send.kv
  5. 2
      electrum/wallet.py

BIN
electrum/gui/kivy/theming/light/delete.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

16
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()

2
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())

6
electrum/gui/kivy/uix/ui_screens/send.kv

@ -148,6 +148,10 @@
BoxLayout:
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()
@ -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:

2
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]:

Loading…
Cancel
Save