1
0

qt: fix account_expanded

This commit is contained in:
ThomasV
2016-06-27 10:12:29 +02:00
parent 49ac8924fe
commit 5bcadd6651
2 changed files with 6 additions and 3 deletions

View File

@@ -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)