mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 18:25:21 +00:00
kivy: improve Wallets dialog
This commit is contained in:
parent
d200b236ae
commit
f66763c37e
1 changed files with 17 additions and 14 deletions
|
@ -14,9 +14,7 @@ Builder.load_string('''
|
||||||
<WalletDialog@Popup>:
|
<WalletDialog@Popup>:
|
||||||
title: _('Wallets')
|
title: _('Wallets')
|
||||||
id: popup
|
id: popup
|
||||||
path: app.wallet.storage.path
|
path: ''
|
||||||
on_path:
|
|
||||||
button.text = _('Open') if os.path.exists(popup.path) else _('Create')
|
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
|
@ -24,20 +22,22 @@ Builder.load_string('''
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
orientation: 'horizontal'
|
orientation: 'horizontal'
|
||||||
Label:
|
Label:
|
||||||
text: _('Wallet') + ': '
|
text: _('Current Wallet') + ': '
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
Button:
|
Label:
|
||||||
id: wallet_name
|
id: wallet_name
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
text: os.path.basename(app.wallet.storage.path)
|
text: os.path.basename(app.wallet.storage.path)
|
||||||
on_release:
|
|
||||||
root.name_dialog()
|
|
||||||
on_text:
|
on_text:
|
||||||
popup.path = os.path.join(wallet_selector.path, self.text)
|
popup.path = os.path.join(wallet_selector.path, self.text)
|
||||||
Widget
|
Widget
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
|
Label:
|
||||||
|
height: '48dp'
|
||||||
|
size_hint_y: None
|
||||||
|
text: _('Wallets')
|
||||||
FileChooserListView:
|
FileChooserListView:
|
||||||
id: wallet_selector
|
id: wallet_selector
|
||||||
dirselect: False
|
dirselect: False
|
||||||
|
@ -60,20 +60,23 @@ Builder.load_string('''
|
||||||
on_release:
|
on_release:
|
||||||
popup.dismiss()
|
popup.dismiss()
|
||||||
Button:
|
Button:
|
||||||
id: button
|
id: open_button
|
||||||
size_hint: 0.5, None
|
size_hint: 0.5, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
text: _('Open') if os.path.exists(popup.path) else _('Create')
|
text: _('Open') if popup.path else _('New Wallet')
|
||||||
on_release:
|
on_release:
|
||||||
popup.dismiss()
|
popup.dismiss()
|
||||||
app.load_wallet_by_name(popup.path)
|
root.new_wallet(app)
|
||||||
''')
|
''')
|
||||||
|
|
||||||
class WalletDialog(Factory.Popup):
|
class WalletDialog(Factory.Popup):
|
||||||
def name_dialog(self):
|
def new_wallet(self, app):
|
||||||
def cb(text):
|
def cb(text):
|
||||||
if text:
|
if text:
|
||||||
self.ids.wallet_name.text = text
|
app.load_wallet_by_name(text)
|
||||||
d = LabelDialog(_('Enter wallet name'), '', cb)
|
if self.path:
|
||||||
d.open()
|
app.load_wallet_by_name(self.path)
|
||||||
|
else:
|
||||||
|
d = LabelDialog(_('Enter wallet name'), '', cb)
|
||||||
|
d.open()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue