本文整理汇总了Python中wallet.Wallet.categories方法的典型用法代码示例。如果您正苦于以下问题:Python Wallet.categories方法的具体用法?Python Wallet.categories怎么用?Python Wallet.categories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wallet.Wallet
的用法示例。
在下文中一共展示了Wallet.categories方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_or_restore
# 需要导入模块: from wallet import Wallet [as 别名]
# 或者: from wallet.Wallet import categories [as 别名]
def create_or_restore(self, storage):
'''After querying the user what they wish to do, create or restore
a wallet and return it.'''
self.remove_from_recently_open(storage.path)
# Filter out any unregistered wallet kinds
registered_kinds = Wallet.categories()
kinds, descriptions = zip(*[pair for pair in WizardBase.wallet_kinds
if pair[0] in registered_kinds])
action, kind_index = self.query_create_or_restore(descriptions)
assert action in WizardBase.user_actions
kind = kinds[kind_index]
if kind == 'multisig':
wallet_type = self.query_multisig(action)
elif kind == 'hardware':
# The create/restore distinction is not obvious for hardware
# wallets; so we ask for the action again and default based
# on the prior choice :)
hw_wallet_types, choices = self.plugins.hardware_wallets(action)
msg = _('Select the type of hardware wallet: ')
action, choice = self.query_hw_wallet_choice(msg, action, choices)
wallet_type = hw_wallet_types[choice]
elif kind == 'twofactor':
wallet_type = '2fa'
else:
wallet_type = 'standard'
if action == 'create':
wallet = self.create_wallet(storage, wallet_type, kind)
else:
wallet = self.restore_wallet(storage, wallet_type, kind)
return action, wallet
示例2: new
# 需要导入模块: from wallet import Wallet [as 别名]
# 或者: from wallet.Wallet import categories [as 别名]
def new(self):
name = os.path.basename(self.storage.path)
title = _("Welcome to the Electrum installation wizard.")
message = '\n'.join([
_("The wallet '%s' does not exist.") % name,
_("What kind of wallet do you want to create?")
])
wallet_kinds = [
('standard', _("Standard wallet")),
('twofactor', _("Wallet with two-factor authentication")),
('multisig', _("Multi-signature wallet")),
]
registered_kinds = Wallet.categories()
choices = wallet_kinds#[pair for pair in wallet_kinds if pair[0] in registered_kinds]
self.choice_dialog(title=title, message=message, choices=choices, run_next=self.on_wallet_type)
示例3: create_or_restore
# 需要导入模块: from wallet import Wallet [as 别名]
# 或者: from wallet.Wallet import categories [as 别名]
def create_or_restore(self, storage):
'''After querying the user what they wish to do, create or restore
a wallet and return it.'''
self.remove_from_recently_open(storage.path)
# Filter out any unregistered wallet kinds
registered_kinds = Wallet.categories()
kinds, descriptions = zip(*[pair for pair in WizardBase.wallet_kinds
if pair[0] in registered_kinds])
action, kind_index = self.query_create_or_restore(descriptions)
assert action in WizardBase.user_actions
kind = kinds[kind_index]
if kind == 'multisig':
wallet_type = self.query_multisig(action)
elif kind == 'hardware':
hw_wallet_types, choices = self.plugins.hardware_wallets(action)
if choices:
msg = _('Select the type of hardware wallet: ')
else:
msg = ' '.join([
_('No hardware wallet support found on your system.'),
_('Please install the relevant libraries (eg python-trezor for Trezor).'),
])
choice = self.query_hw_wallet_choice(msg, choices)
wallet_type = hw_wallet_types[choice]
elif kind == 'twofactor':
wallet_type = '2fa'
else:
wallet_type = 'standard'
if action == 'create':
wallet = self.create_wallet(storage, wallet_type, kind)
else:
wallet = self.restore_wallet(storage, wallet_type, kind)
return action, wallet