From 6be62e44de87c12806bf2c4a7e851c2ffad51039 Mon Sep 17 00:00:00 2001 From: ecdsa Date: Thu, 2 May 2013 10:19:18 +0200 Subject: [PATCH] wallet.delete_contact method --- gui/gui_classic.py | 11 +++++------ lib/wallet.py | 7 ++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gui/gui_classic.py b/gui/gui_classic.py index 6b85142e3..d3bff56e5 100644 --- a/gui/gui_classic.py +++ b/gui/gui_classic.py @@ -1016,12 +1016,11 @@ class ElectrumWindow(QMainWindow): def delete_contact(self, x): if self.question(_("Do you want to remove")+" %s "%x +_("from your list of contacts?")): - if x in self.wallet.addressbook: - self.wallet.addressbook.remove(x) - self.set_label(x, None) - self.update_history_tab() - self.update_contacts_tab() - self.update_completions() + self.wallet.delete_contact(x) + self.set_label(x, None) + self.update_history_tab() + self.update_contacts_tab() + self.update_completions() def create_contact_menu(self, position): diff --git a/lib/wallet.py b/lib/wallet.py index 771437759..e90213b55 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -417,7 +417,12 @@ class Wallet: self.config.set_key('addressbook', self.addressbook, True) if label: self.labels[address] = label - self.config.set_key('labels',self.labels) + self.config.set_key('labels', self.labels) + + def delete_contact(self, addr): + if addr in self.addressbook: + self.addressbook.remove(addr) + self.config.set_key('addressbook', self.addressbook, True) def fill_addressbook(self):