mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 08:51:32 +00:00
kiv: add option to delete a wallet
This commit is contained in:
parent
a79b4e6de6
commit
e49fc05c49
1 changed files with 33 additions and 13 deletions
|
@ -28,31 +28,51 @@ Builder.load_string('''
|
||||||
Widget
|
Widget
|
||||||
size_hint_y: 0.1
|
size_hint_y: 0.1
|
||||||
GridLayout:
|
GridLayout:
|
||||||
cols: 2
|
cols: 3
|
||||||
size_hint_y: 0.1
|
size_hint_y: 0.1
|
||||||
Button:
|
|
||||||
size_hint: 0.1, None
|
|
||||||
height: '48dp'
|
|
||||||
text: _('Cancel')
|
|
||||||
on_release:
|
|
||||||
popup.dismiss()
|
|
||||||
Button:
|
Button:
|
||||||
id: open_button
|
id: open_button
|
||||||
size_hint: 0.1, None
|
size_hint: 0.1, None
|
||||||
height: '48dp'
|
height: '48dp'
|
||||||
text: _('Open') if wallet_selector.selection else _('New Wallet')
|
text: _('New')
|
||||||
on_release:
|
on_release:
|
||||||
popup.dismiss()
|
popup.dismiss()
|
||||||
root.new_wallet(app, wallet_selector.path)
|
root.new_wallet(app, wallet_selector.path)
|
||||||
|
Button:
|
||||||
|
id: open_button
|
||||||
|
size_hint: 0.1, None
|
||||||
|
height: '48dp'
|
||||||
|
text: _('Open')
|
||||||
|
disabled: not wallet_selector.selection
|
||||||
|
on_release:
|
||||||
|
popup.dismiss()
|
||||||
|
root.open_wallet(app)
|
||||||
|
Button:
|
||||||
|
id: open_button
|
||||||
|
size_hint: 0.1, None
|
||||||
|
height: '48dp'
|
||||||
|
text: _('Delete')
|
||||||
|
disabled: not wallet_selector.selection
|
||||||
|
on_release:
|
||||||
|
popup.dismiss()
|
||||||
|
root.delete_wallet(app)
|
||||||
''')
|
''')
|
||||||
|
|
||||||
class WalletDialog(Factory.Popup):
|
class WalletDialog(Factory.Popup):
|
||||||
|
|
||||||
def new_wallet(self, app, dirname):
|
def new_wallet(self, app, dirname):
|
||||||
def cb(text):
|
def cb(text):
|
||||||
if text:
|
if text:
|
||||||
app.load_wallet_by_name(os.path.join(dirname, text))
|
app.load_wallet_by_name(os.path.join(dirname, text))
|
||||||
if self.ids.wallet_selector.selection:
|
d = LabelDialog(_('Enter wallet name'), '', cb)
|
||||||
app.load_wallet_by_name(self.ids.wallet_selector.selection[0])
|
d.open()
|
||||||
else:
|
|
||||||
d = LabelDialog(_('Enter wallet name'), '', cb)
|
def open_wallet(self, app):
|
||||||
d.open()
|
app.load_wallet_by_name(self.ids.wallet_selector.selection[0])
|
||||||
|
|
||||||
|
def delete_wallet(self, app):
|
||||||
|
from question import Question
|
||||||
|
name = self.ids.wallet_selector.selection[0]
|
||||||
|
f = lambda: os.unlink(name)
|
||||||
|
d = Question(_('Delete wallet?') + '\n' + os.path.basename(name), f)
|
||||||
|
d.open()
|
||||||
|
|
Loading…
Add table
Reference in a new issue