commit a03449c1be97eda1c4f6e32195417c6658321171
parent 7b507905841df3f685b92b2381e9ea8838f4ac78
Author: ThomasV <thomasv@electrum.org>
Date: Sat, 7 Apr 2018 18:16:33 +0200
kivy: cleanup addresses dialog
Diffstat:
1 file changed, 10 insertions(+), 43 deletions(-)
diff --git a/gui/kivy/uix/dialogs/addresses.py b/gui/kivy/uix/dialogs/addresses.py
@@ -118,19 +118,13 @@ class AddressesDialog(Factory.Popup):
ci.screen = self
ci.address = addr
self.cards[addr] = ci
-
ci.memo = label
ci.amount = self.app.format_amount_and_units(balance)
- request = self.app.wallet.get_payment_request(addr, self.app.electrum_config)
- if is_used:
- ci.status = _('Used')
- else:
- ci.status = _('Funded') if balance > 0 else _('Unused')
+ ci.status = _('Used') if is_used else _('Funded') if balance > 0 else _('Unused')
return ci
-
def update(self):
- self.menu_actions = [(_('Use'), self.do_show), (_('Details'), self.do_view)]
+ self.menu_actions = [(_('Use'), self.do_use), (_('Details'), self.do_view)]
wallet = self.app.wallet
if self.show_change == 0:
_list = wallet.get_receiving_addresses()
@@ -161,46 +155,19 @@ class AddressesDialog(Factory.Popup):
msg = _('No address matching your search')
container.add_widget(EmptyLabel(text=msg))
- def do_show(self, obj):
+ def do_use(self, obj):
self.hide_menu()
self.dismiss()
self.app.show_request(obj.address)
def do_view(self, obj):
- req = self.app.wallet.get_payment_request(obj.address, self.app.electrum_config)
- if req:
- c, u, x = self.app.wallet.get_addr_balance(obj.address)
- balance = c + u + x
- if balance > 0:
- req['fund'] = balance
- status = req.get('status')
- amount = req.get('amount')
- address = req['address']
- if amount:
- status = req.get('status')
- status = request_text[status]
- else:
- received_amount = self.app.wallet.get_addr_received(address)
- status = self.app.format_amount_and_units(received_amount)
- self.app.show_pr_details(req, status, False)
-
- else:
- req = { 'address': obj.address, 'status' : obj.status }
- status = obj.status
- c, u, x = self.app.wallet.get_addr_balance(obj.address)
- balance = c + u + x
- if balance > 0:
- req['fund'] = balance
- self.app.show_addr_details(req, status)
-
- def do_delete(self, obj):
- from .dialogs.question import Question
- def cb(result):
- if result:
- self.app.wallet.remove_payment_request(obj.address, self.app.electrum_config)
- self.update()
- d = Question(_('Delete request?'), cb)
- d.open()
+ req = { 'address': obj.address, 'status' : obj.status }
+ status = obj.status
+ c, u, x = self.app.wallet.get_addr_balance(obj.address)
+ balance = c + u + x
+ if balance > 0:
+ req['fund'] = balance
+ self.app.show_addr_details(req, status)
def ext_search(self, card, search):
return card.memo.find(search) >= 0 or card.amount.find(search) >= 0