electrum

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

commit f77311328a6155e8f88fd7fa02778f3ed577b933
parent 4d7b68658b8b50203de4c7a6722ac88af999d134
Author: ThomasV <thomasv@gitorious>
Date:   Tue, 31 Mar 2015 12:01:42 +0200

add get_completions to wallet

Diffstat:
Mgui/qt/main_window.py | 7+------
Mlib/wallet.py | 11+++++++++++
2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -1105,12 +1105,7 @@ class ElectrumWindow(QMainWindow): self.from_list.addTopLevelItem(QTreeWidgetItem( [format(item), self.format_amount(item['value']) ])) def update_completions(self): - l = [] - for addr,label in self.wallet.labels.items(): - if addr in self.wallet.addressbook: - l.append( label + ' <' + addr + '>') - - run_hook('update_completions', l) + l = self.wallet.get_completions() self.completions.setStringList(l) diff --git a/lib/wallet.py b/lib/wallet.py @@ -391,6 +391,17 @@ class Abstract_Wallet(object): self.addressbook.remove(addr) self.storage.put('contacts', list(self.addressbook), True) + def get_completions(self): + l = [] + for x in self.addressbook: + if bitcoin.is_address(x): + label = self.labels.get(x) + if label: + l.append( label + ' <' + x + '>') + else: + l.append(x) + return l + def get_num_tx(self, address): """ return number of transactions where address is involved """ return len(self.history.get(address, []))