electrum

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

commit 2c619ec41d49072e5be05cd45a5019b32b628774
parent 1821d9ebc67ae1aec679e5af759541c15ace1740
Author: ThomasV <thomasv@electrum.org>
Date:   Mon,  5 Feb 2018 09:06:16 +0100

Merge pull request #3841 from SomberNight/qt_addr_filter_all

address filter: add "all" filter option besides "receiving" and "change"
Diffstat:
Mgui/qt/address_list.py | 20++++++++++++--------
Mlib/wallet.py | 6+++---
2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/gui/qt/address_list.py b/gui/qt/address_list.py @@ -38,11 +38,11 @@ class AddressList(MyTreeWidget): MyTreeWidget.__init__(self, parent, self.create_menu, [], 1) self.refresh_headers() self.setSelectionMode(QAbstractItemView.ExtendedSelection) - self.show_change = False + self.show_change = 0 self.show_used = 0 self.change_button = QComboBox(self) self.change_button.currentIndexChanged.connect(self.toggle_change) - for t in [_('Receiving'), _('Change')]: + for t in [_('Receiving'), _('Change'), _('All')]: self.change_button.addItem(t) self.used_button = QComboBox(self) self.used_button.currentIndexChanged.connect(self.toggle_used) @@ -60,11 +60,10 @@ class AddressList(MyTreeWidget): headers.extend([_('Tx')]) self.update_headers(headers) - def toggle_change(self, show): - show = bool(show) - if show == self.show_change: + def toggle_change(self, state): + if state == self.show_change: return - self.show_change = show + self.show_change = state self.update() def toggle_used(self, state): @@ -77,7 +76,12 @@ class AddressList(MyTreeWidget): self.wallet = self.parent.wallet item = self.currentItem() current_address = item.data(0, Qt.UserRole) if item else None - addr_list = self.wallet.get_change_addresses() if self.show_change else self.wallet.get_receiving_addresses() + if self.show_change == 0: + addr_list = self.wallet.get_receiving_addresses() + elif self.show_change == 1: + addr_list = self.wallet.get_change_addresses() + else: + addr_list = self.wallet.get_addresses() self.clear() for address in addr_list: num = len(self.wallet.history.get(address,[])) @@ -106,7 +110,7 @@ class AddressList(MyTreeWidget): address_item.setData(0, Qt.UserRole+1, True) # label can be edited if self.wallet.is_frozen(address): address_item.setBackground(0, ColorScheme.BLUE.as_color(True)) - if self.wallet.is_beyond_limit(address, self.show_change): + if self.wallet.is_beyond_limit(address): address_item.setBackground(0, ColorScheme.RED.as_color(True)) self.addChild(address_item) if address == current_address: diff --git a/lib/wallet.py b/lib/wallet.py @@ -1535,7 +1535,7 @@ class Imported_Wallet(Simple_Wallet): def get_master_public_keys(self): return [] - def is_beyond_limit(self, address, is_change): + def is_beyond_limit(self, address): return False def is_mine(self, address): @@ -1775,9 +1775,9 @@ class Deterministic_Wallet(Abstract_Wallet): for addr in self.receiving_addresses: self.add_address(addr) - def is_beyond_limit(self, address, is_change): + def is_beyond_limit(self, address): + is_change, i = self.get_address_index(address) addr_list = self.get_change_addresses() if is_change else self.get_receiving_addresses() - i = self.get_address_index(address)[1] limit = self.gap_limit_for_change if is_change else self.gap_limit if i < limit: return False