electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 9723a5e9ec35f7dba36f45cbbd0dea11a176280c
parent 217900bbfa3d0a957ccc0e780ceebb5d661581ad
Author: ThomasV <thomasv@gitorious>
Date:   Fri, 25 Apr 2014 11:56:17 +0200

gui: don't show account names if there is only one account

Diffstat:
Mgui/qt/main_window.py | 33+++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -1198,22 +1198,31 @@ class ElectrumWindow(QMainWindow): else: account_items = [] + pending_accounts = self.wallet.get_pending_accounts() + for k, account in account_items: - name = self.wallet.get_account_name(k) - c,u = self.wallet.get_account_balance(k) - account_item = QTreeWidgetItem( [ name, '', self.format_amount(c+u), ''] ) - l.addTopLevelItem(account_item) - account_item.setExpanded(self.accounts_expanded.get(k, True)) - account_item.setData(0, 32, k) - if not self.wallet.is_seeded(k): - icon = QIcon(":icons/key.png") - account_item.setIcon(0, icon) + if len(account_items) + len(pending_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), ''] ) + l.addTopLevelItem(account_item) + account_item.setExpanded(self.accounts_expanded.get(k, True)) + account_item.setData(0, 32, k) + if not self.wallet.is_seeded(k): + icon = QIcon(":icons/key.png") + account_item.setIcon(0, icon) + else: + account_item = None for is_change in ([0,1]): name = _("Receiving") if not is_change else _("Change") seq_item = QTreeWidgetItem( [ name, '', '', '', ''] ) - account_item.addChild(seq_item) + if account_item: + account_item.addChild(seq_item) + else: + l.addTopLevelItem(seq_item) + used_item = QTreeWidgetItem( [ _("Used"), '', '', '', ''] ) used_flag = False if not is_change: seq_item.setExpanded(True) @@ -1246,7 +1255,7 @@ class ElectrumWindow(QMainWindow): seq_item.addChild(item) - for k, addr in self.wallet.get_pending_accounts(): + for k, addr in pending_accounts: name = self.wallet.labels.get(k,'') account_item = QTreeWidgetItem( [ name + " [ "+_('pending account')+" ]", '', '', ''] ) self.update_receive_item(item) @@ -1451,7 +1460,7 @@ class ElectrumWindow(QMainWindow): name = str(e.text()) if not name: return - self.wallet.create_pending_account('1of1', name, password) + self.wallet.create_pending_account(name, password) self.update_receive_tab() self.tabs.setCurrentIndex(2)