|
|
@ -1168,25 +1168,23 @@ class ElectrumWindow(QMainWindow): |
|
|
|
|
|
|
|
def update_receive_tab(self): |
|
|
|
l = self.receive_list |
|
|
|
# extend the syntax for consistency |
|
|
|
l.addChild = l.addTopLevelItem |
|
|
|
|
|
|
|
l.clear() |
|
|
|
l.setColumnHidden(2, False) |
|
|
|
l.setColumnHidden(3, False) |
|
|
|
for i,width in enumerate(self.column_widths['receive']): |
|
|
|
l.setColumnWidth(i, width) |
|
|
|
|
|
|
|
accounts = self.wallet.get_accounts() |
|
|
|
if self.current_account is None: |
|
|
|
account_items = sorted(self.wallet.accounts.items()) |
|
|
|
elif self.current_account != -1: |
|
|
|
account_items = [(self.current_account, self.wallet.accounts.get(self.current_account))] |
|
|
|
account_items = sorted(accounts.items()) |
|
|
|
else: |
|
|
|
account_items = [] |
|
|
|
account_items = [(self.current_account, accounts.get(self.current_account))] |
|
|
|
|
|
|
|
pending_accounts = self.wallet.get_pending_accounts() |
|
|
|
|
|
|
|
for k, account in account_items: |
|
|
|
|
|
|
|
if len(account_items) + len(pending_accounts) > 1: |
|
|
|
if len(accounts) > 1: |
|
|
|
name = self.wallet.get_account_name(k) |
|
|
|
c,u = self.wallet.get_account_balance(k) |
|
|
|
account_item = QTreeWidgetItem( [ name, '', self.format_amount(c+u), ''] ) |
|
|
@ -1194,19 +1192,21 @@ class ElectrumWindow(QMainWindow): |
|
|
|
account_item.setExpanded(self.accounts_expanded.get(k, True)) |
|
|
|
account_item.setData(0, 32, k) |
|
|
|
else: |
|
|
|
account_item = None |
|
|
|
account_item = l |
|
|
|
|
|
|
|
for is_change in ([0,1]): |
|
|
|
name = _("Receiving") if not is_change else _("Change") |
|
|
|
seq_item = QTreeWidgetItem( [ name, '', '', '', ''] ) |
|
|
|
if account_item: |
|
|
|
sequences = [0,1] if account.has_change() else [0] |
|
|
|
for is_change in sequences: |
|
|
|
if len(sequences) > 1: |
|
|
|
name = _("Receiving") if not is_change else _("Change") |
|
|
|
seq_item = QTreeWidgetItem( [ name, '', '', '', ''] ) |
|
|
|
account_item.addChild(seq_item) |
|
|
|
if not is_change: |
|
|
|
seq_item.setExpanded(True) |
|
|
|
else: |
|
|
|
l.addTopLevelItem(seq_item) |
|
|
|
seq_item = account_item |
|
|
|
|
|
|
|
used_item = QTreeWidgetItem( [ _("Used"), '', '', '', ''] ) |
|
|
|
used_flag = False |
|
|
|
if not is_change: seq_item.setExpanded(True) |
|
|
|
|
|
|
|
is_red = False |
|
|
|
gap = 0 |
|
|
@ -1223,6 +1223,7 @@ class ElectrumWindow(QMainWindow): |
|
|
|
|
|
|
|
c, u = self.wallet.get_addr_balance(address) |
|
|
|
num_tx = '*' if h == ['*'] else "%d"%len(h) |
|
|
|
|
|
|
|
item = QTreeWidgetItem( [ address, '', '', num_tx] ) |
|
|
|
self.update_receive_item(item) |
|
|
|
if is_red: |
|
|
@ -1235,30 +1236,6 @@ class ElectrumWindow(QMainWindow): |
|
|
|
else: |
|
|
|
seq_item.addChild(item) |
|
|
|
|
|
|
|
|
|
|
|
for k, addr in pending_accounts: |
|
|
|
name = self.wallet.labels.get(k,'') |
|
|
|
account_item = QTreeWidgetItem( [ name + " [ "+_('pending account')+" ]", '', '', ''] ) |
|
|
|
self.update_receive_item(item) |
|
|
|
l.addTopLevelItem(account_item) |
|
|
|
account_item.setExpanded(True) |
|
|
|
account_item.setData(0, 32, k) |
|
|
|
item = QTreeWidgetItem( [ addr, '', '', '', ''] ) |
|
|
|
account_item.addChild(item) |
|
|
|
self.update_receive_item(item) |
|
|
|
|
|
|
|
|
|
|
|
if self.wallet.imported_keys and (self.current_account is None or self.current_account == -1): |
|
|
|
c,u = self.wallet.get_imported_balance() |
|
|
|
account_item = QTreeWidgetItem( [ _('Imported'), '', self.format_amount(c+u), ''] ) |
|
|
|
l.addTopLevelItem(account_item) |
|
|
|
account_item.setExpanded(True) |
|
|
|
for address in self.wallet.imported_keys.keys(): |
|
|
|
item = QTreeWidgetItem( [ address, '', '', ''] ) |
|
|
|
self.update_receive_item(item) |
|
|
|
account_item.addChild(item) |
|
|
|
|
|
|
|
|
|
|
|
# we use column 1 because column 0 may be hidden |
|
|
|
l.setCurrentItem(l.topLevelItem(0),1) |
|
|
|
|
|
|
|