electrum

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

commit f66763c37e7240014662f72ae021a8ca617cca54
parent d200b236ae8505f9cfbfec03628943f5109ce790
Author: ThomasV <thomasv@electrum.org>
Date:   Mon, 18 Jan 2016 10:08:21 +0100

kivy: improve Wallets dialog

Diffstat:
Mgui/kivy/uix/dialogs/wallets.py | 31+++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/gui/kivy/uix/dialogs/wallets.py b/gui/kivy/uix/dialogs/wallets.py @@ -14,9 +14,7 @@ Builder.load_string(''' <WalletDialog@Popup>: title: _('Wallets') id: popup - path: app.wallet.storage.path - on_path: - button.text = _('Open') if os.path.exists(popup.path) else _('Create') + path: '' BoxLayout: orientation: 'vertical' BoxLayout: @@ -24,20 +22,22 @@ Builder.load_string(''' size_hint_y: None orientation: 'horizontal' Label: - text: _('Wallet') + ': ' + text: _('Current Wallet') + ': ' height: '48dp' size_hint_y: None - Button: + Label: id: wallet_name height: '48dp' size_hint_y: None text: os.path.basename(app.wallet.storage.path) - on_release: - root.name_dialog() on_text: popup.path = os.path.join(wallet_selector.path, self.text) Widget size_hint_y: None + Label: + height: '48dp' + size_hint_y: None + text: _('Wallets') FileChooserListView: id: wallet_selector dirselect: False @@ -60,20 +60,23 @@ Builder.load_string(''' on_release: popup.dismiss() Button: - id: button + id: open_button size_hint: 0.5, None height: '48dp' - text: _('Open') if os.path.exists(popup.path) else _('Create') + text: _('Open') if popup.path else _('New Wallet') on_release: popup.dismiss() - app.load_wallet_by_name(popup.path) + root.new_wallet(app) ''') class WalletDialog(Factory.Popup): - def name_dialog(self): + def new_wallet(self, app): def cb(text): if text: - self.ids.wallet_name.text = text - d = LabelDialog(_('Enter wallet name'), '', cb) - d.open() + app.load_wallet_by_name(text) + if self.path: + app.load_wallet_by_name(self.path) + else: + d = LabelDialog(_('Enter wallet name'), '', cb) + d.open()