rename wizard.choose_device because plugin has method with same name
This commit is contained in:
parent
1e6caf8f03
commit
092bb43660
|
@ -39,6 +39,7 @@ class BaseWizard(object):
|
||||||
self.wallet = None
|
self.wallet = None
|
||||||
self.stack = []
|
self.stack = []
|
||||||
self.plugin = None
|
self.plugin = None
|
||||||
|
self.keystores = []
|
||||||
|
|
||||||
def run(self, *args):
|
def run(self, *args):
|
||||||
action = args[0]
|
action = args[0]
|
||||||
|
@ -103,26 +104,26 @@ class BaseWizard(object):
|
||||||
self.multisig_type = "%dof%d"%(m, n)
|
self.multisig_type = "%dof%d"%(m, n)
|
||||||
self.storage.put('wallet_type', self.multisig_type)
|
self.storage.put('wallet_type', self.multisig_type)
|
||||||
self.n = n
|
self.n = n
|
||||||
self.keystores = []
|
|
||||||
self.run('choose_keystore')
|
self.run('choose_keystore')
|
||||||
self.multisig_dialog(run_next=on_multisig)
|
self.multisig_dialog(run_next=on_multisig)
|
||||||
|
|
||||||
def choose_keystore(self):
|
def choose_keystore(self):
|
||||||
assert self.wallet_type in ['standard', 'multisig']
|
assert self.wallet_type in ['standard', 'multisig']
|
||||||
c = self.wallet_type == 'multisig' and len(self.keystores)>0
|
i = len(self.keystores)
|
||||||
title = _('Add cosigner') + ' %d'%len(self.keystores) if c else _('Keystore')
|
title = _('Add cosigner') + ' (%d of %d)'%(i+1, self.n) if self.wallet_type=='multisig' else _('Keystore')
|
||||||
message = _('Do you want to create a new seed, or to restore a wallet using an existing seed?')
|
if self.wallet_type =='standard' or i==0:
|
||||||
if not c:
|
message = _('Do you want to create a new seed, or to restore a wallet using an existing seed?')
|
||||||
choices = [
|
choices = [
|
||||||
('create_seed', _('Create a new seed')),
|
('create_seed', _('Create a new seed')),
|
||||||
('restore_seed', _('I already have a seed')),
|
('restore_seed', _('I already have a seed')),
|
||||||
('restore_from_key', _('Import keys')),
|
('restore_from_key', _('Import keys')),
|
||||||
('choose_device', _('Use hardware device')),
|
('choose_hw_device', _('Use hardware device')),
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
|
message = _('Add a cosigner to your multi-sig wallet')
|
||||||
choices = [
|
choices = [
|
||||||
('restore_from_key', _('Import cosigner key')),
|
('restore_from_key', _('Import cosigner key')),
|
||||||
('choose_device', _('Cosign with hardware device')),
|
('choose_hw_device', _('Cosign with hardware device')),
|
||||||
]
|
]
|
||||||
|
|
||||||
self.choice_dialog(title=title, message=message, choices=choices, run_next=self.run)
|
self.choice_dialog(title=title, message=message, choices=choices, run_next=self.run)
|
||||||
|
@ -165,7 +166,7 @@ class BaseWizard(object):
|
||||||
])
|
])
|
||||||
self.restore_keys_dialog(title=title, message=message, run_next=self.on_restore, is_valid=v)
|
self.restore_keys_dialog(title=title, message=message, run_next=self.on_restore, is_valid=v)
|
||||||
|
|
||||||
def choose_device(self):
|
def choose_hw_device(self):
|
||||||
title = _('Hardware Keystore')
|
title = _('Hardware Keystore')
|
||||||
# check available plugins
|
# check available plugins
|
||||||
support = self.plugins.get_hardware_support()
|
support = self.plugins.get_hardware_support()
|
||||||
|
@ -174,7 +175,7 @@ class BaseWizard(object):
|
||||||
_('No hardware wallet support found on your system.'),
|
_('No hardware wallet support found on your system.'),
|
||||||
_('Please install the relevant libraries (eg python-trezor for Trezor).'),
|
_('Please install the relevant libraries (eg python-trezor for Trezor).'),
|
||||||
])
|
])
|
||||||
self.confirm_dialog(title=title, message=msg, run_next= lambda x: self.choose_device())
|
self.confirm_dialog(title=title, message=msg, run_next= lambda x: self.choose_hw_device())
|
||||||
return
|
return
|
||||||
# scan devices
|
# scan devices
|
||||||
devices = []
|
devices = []
|
||||||
|
@ -192,7 +193,7 @@ class BaseWizard(object):
|
||||||
_('No hardware device detected.'),
|
_('No hardware device detected.'),
|
||||||
_('To trigger a rescan, press \'next\'.'),
|
_('To trigger a rescan, press \'next\'.'),
|
||||||
])
|
])
|
||||||
self.confirm_dialog(title=title, message=msg, run_next= lambda x: self.choose_device())
|
self.confirm_dialog(title=title, message=msg, run_next= lambda x: self.choose_hw_device())
|
||||||
return
|
return
|
||||||
# select device
|
# select device
|
||||||
self.devices = devices
|
self.devices = devices
|
||||||
|
|
Loading…
Reference in New Issue