qt: fix account_expanded
This commit is contained in:
parent
49ac8924fe
commit
5bcadd6651
|
@ -41,6 +41,7 @@ class AddressList(MyTreeWidget):
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
self.wallet = self.parent.wallet
|
self.wallet = self.parent.wallet
|
||||||
|
self.accounts_expanded = self.wallet.storage.get('accounts_expanded', {})
|
||||||
item = self.currentItem()
|
item = self.currentItem()
|
||||||
current_address = item.data(0, Qt.UserRole).toString() if item else None
|
current_address = item.data(0, Qt.UserRole).toString() if item else None
|
||||||
self.clear()
|
self.clear()
|
||||||
|
@ -54,9 +55,9 @@ class AddressList(MyTreeWidget):
|
||||||
name = self.wallet.get_account_name(k)
|
name = self.wallet.get_account_name(k)
|
||||||
c, u, x = self.wallet.get_account_balance(k)
|
c, u, x = self.wallet.get_account_balance(k)
|
||||||
account_item = QTreeWidgetItem([ name, '', self.parent.format_amount(c + u + x), ''])
|
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)
|
account_item.setData(0, Qt.UserRole, k)
|
||||||
self.addTopLevelItem(account_item)
|
self.addTopLevelItem(account_item)
|
||||||
|
account_item.setExpanded(self.accounts_expanded.get(k, True))
|
||||||
else:
|
else:
|
||||||
account_item = self
|
account_item = self
|
||||||
sequences = [0,1] if account.has_change() else [0]
|
sequences = [0,1] if account.has_change() else [0]
|
||||||
|
@ -172,3 +173,6 @@ class AddressList(MyTreeWidget):
|
||||||
def set_account_expanded(self, item, k, b):
|
def set_account_expanded(self, item, k, b):
|
||||||
item.setExpanded(b)
|
item.setExpanded(b)
|
||||||
self.accounts_expanded[k] = b
|
self.accounts_expanded[k] = b
|
||||||
|
|
||||||
|
def on_close(self):
|
||||||
|
self.wallet.storage.put('accounts_expanded', self.accounts_expanded)
|
||||||
|
|
|
@ -262,7 +262,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
def close_wallet(self):
|
def close_wallet(self):
|
||||||
if self.wallet:
|
if self.wallet:
|
||||||
self.print_error('close_wallet', self.wallet.storage.path)
|
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)
|
run_hook('close_wallet', self.wallet)
|
||||||
|
|
||||||
def load_wallet(self, wallet):
|
def load_wallet(self, wallet):
|
||||||
|
@ -270,7 +270,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
self.update_recently_visited(wallet.storage.path)
|
self.update_recently_visited(wallet.storage.path)
|
||||||
# address used to create a dummy transaction and estimate transaction fee
|
# 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.current_account = self.wallet.storage.get("current_account", None)
|
||||||
self.history_list.update()
|
self.history_list.update()
|
||||||
self.need_update.set()
|
self.need_update.set()
|
||||||
|
|
Loading…
Reference in New Issue