show the balance of each account
This commit is contained in:
parent
a6db76cc0e
commit
d2aefb387b
|
@ -1232,10 +1232,12 @@ class ElectrumWindow(QMainWindow):
|
||||||
|
|
||||||
for k, account in self.wallet.accounts.items():
|
for k, account in self.wallet.accounts.items():
|
||||||
name = account.get('name',str(k))
|
name = account.get('name',str(k))
|
||||||
account_item = QTreeWidgetItem( [ name, '', '', '', ''] )
|
c,u = self.wallet.get_account_balance(k)
|
||||||
|
account_item = QTreeWidgetItem( [ name, '', '', format_satoshis(c+u), ''] )
|
||||||
l.addTopLevelItem(account_item)
|
l.addTopLevelItem(account_item)
|
||||||
account_item.setExpanded(True)
|
account_item.setExpanded(True)
|
||||||
|
|
||||||
|
|
||||||
for is_change in [0,1]:
|
for is_change in [0,1]:
|
||||||
name = "Receiving" if not is_change else "Change"
|
name = "Receiving" if not is_change else "Change"
|
||||||
seq_item = QTreeWidgetItem( [ name, '', '', '', ''] )
|
seq_item = QTreeWidgetItem( [ name, '', '', '', ''] )
|
||||||
|
@ -1260,12 +1262,13 @@ class ElectrumWindow(QMainWindow):
|
||||||
item.setFont(0, QFont(MONOSPACE_FONT))
|
item.setFont(0, QFont(MONOSPACE_FONT))
|
||||||
item.setFont(2, QFont(MONOSPACE_FONT))
|
item.setFont(2, QFont(MONOSPACE_FONT))
|
||||||
self.update_receive_item(item)
|
self.update_receive_item(item)
|
||||||
if is_red and not is_change:
|
if is_red:
|
||||||
item.setBackgroundColor(1, QColor('red'))
|
item.setBackgroundColor(1, QColor('red'))
|
||||||
seq_item.addChild(item)
|
seq_item.addChild(item)
|
||||||
|
|
||||||
if self.wallet.imported_keys:
|
if self.wallet.imported_keys:
|
||||||
account_item = QTreeWidgetItem( [ "Imported", '', '', '', ''] )
|
c,u = self.wallet.get_imported_balance()
|
||||||
|
account_item = QTreeWidgetItem( [ _('Imported'), '', '', format_satoshis(c+u), ''] )
|
||||||
l.addTopLevelItem(account_item)
|
l.addTopLevelItem(account_item)
|
||||||
account_item.setExpanded(True)
|
account_item.setExpanded(True)
|
||||||
for address in self.wallet.imported_keys.keys():
|
for address in self.wallet.imported_keys.keys():
|
||||||
|
@ -1273,8 +1276,6 @@ class ElectrumWindow(QMainWindow):
|
||||||
item.setFont(0, QFont(MONOSPACE_FONT))
|
item.setFont(0, QFont(MONOSPACE_FONT))
|
||||||
item.setFont(2, QFont(MONOSPACE_FONT))
|
item.setFont(2, QFont(MONOSPACE_FONT))
|
||||||
self.update_receive_item(item)
|
self.update_receive_item(item)
|
||||||
if is_red and not is_change:
|
|
||||||
item.setBackgroundColor(1, QColor('red'))
|
|
||||||
account_item.addChild(item)
|
account_item.addChild(item)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -531,6 +531,13 @@ class Wallet:
|
||||||
ac = self.accounts[a]
|
ac = self.accounts[a]
|
||||||
return ac[0] + ac[1]
|
return ac[0] + ac[1]
|
||||||
|
|
||||||
|
def get_imported_balance(self):
|
||||||
|
cc = uu = 0
|
||||||
|
for addr in self.imported_keys.keys():
|
||||||
|
c, u = self.get_addr_balance(addr)
|
||||||
|
cc += c
|
||||||
|
uu += u
|
||||||
|
return cc, uu
|
||||||
|
|
||||||
def get_account_balance(self, account):
|
def get_account_balance(self, account):
|
||||||
conf = unconf = 0
|
conf = unconf = 0
|
||||||
|
@ -546,6 +553,9 @@ class Wallet:
|
||||||
c, u = self.get_account_balance(a)
|
c, u = self.get_account_balance(a)
|
||||||
cc += c
|
cc += c
|
||||||
uu += u
|
uu += u
|
||||||
|
c, u = self.get_imported_balance()
|
||||||
|
cc += c
|
||||||
|
uu += u
|
||||||
return cc, uu
|
return cc, uu
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue