commit 5bcadd6651537f93fcbe49fb77921d7bf2e3dc35
parent 49ac8924fec3985d245ab4cab17407949dfba663
Author: ThomasV <thomasv@electrum.org>
Date: Mon, 27 Jun 2016 10:12:29 +0200
qt: fix account_expanded
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/gui/qt/address_list.py b/gui/qt/address_list.py
@@ -41,6 +41,7 @@ class AddressList(MyTreeWidget):
def on_update(self):
self.wallet = self.parent.wallet
+ self.accounts_expanded = self.wallet.storage.get('accounts_expanded', {})
item = self.currentItem()
current_address = item.data(0, Qt.UserRole).toString() if item else None
self.clear()
@@ -54,9 +55,9 @@ class AddressList(MyTreeWidget):
name = self.wallet.get_account_name(k)
c, u, x = self.wallet.get_account_balance(k)
account_item = QTreeWidgetItem([ name, '', self.parent.format_amount(c + u + x), ''])
- account_item.setExpanded(self.accounts_expanded.get(k, True))
account_item.setData(0, Qt.UserRole, k)
self.addTopLevelItem(account_item)
+ account_item.setExpanded(self.accounts_expanded.get(k, True))
else:
account_item = self
sequences = [0,1] if account.has_change() else [0]
@@ -172,3 +173,6 @@ class AddressList(MyTreeWidget):
def set_account_expanded(self, item, k, b):
item.setExpanded(b)
self.accounts_expanded[k] = b
+
+ def on_close(self):
+ self.wallet.storage.put('accounts_expanded', self.accounts_expanded)
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -262,7 +262,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
def close_wallet(self):
if self.wallet:
self.print_error('close_wallet', self.wallet.storage.path)
- self.wallet.storage.put('accounts_expanded', self.accounts_expanded)
+ self.address_list.on_close()
run_hook('close_wallet', self.wallet)
def load_wallet(self, wallet):
@@ -270,7 +270,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.wallet = wallet
self.update_recently_visited(wallet.storage.path)
# address used to create a dummy transaction and estimate transaction fee
- self.accounts_expanded = self.wallet.storage.get('accounts_expanded',{})
self.current_account = self.wallet.storage.get("current_account", None)
self.history_list.update()
self.need_update.set()