本文整理汇总了Python中electrum_ltc.Wallet.wait_until_synchronized方法的典型用法代码示例。如果您正苦于以下问题:Python Wallet.wait_until_synchronized方法的具体用法?Python Wallet.wait_until_synchronized怎么用?Python Wallet.wait_until_synchronized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electrum_ltc.Wallet
的用法示例。
在下文中一共展示了Wallet.wait_until_synchronized方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from electrum_ltc import Wallet [as 别名]
# 或者: from electrum_ltc.Wallet import wait_until_synchronized [as 别名]
def __init__(self, _config, _network, daemon, plugins):
global wallet, network, contacts, config
network = _network
config = _config
network.register_callback(update_callback, ['updated'])
contacts = util.StoreDict(config, 'contacts')
storage = WalletStorage(config.get_wallet_path())
if not storage.file_exists:
action = self.restore_or_create()
if not action:
exit()
password = droid.dialogGetPassword('Choose a password').result
if password:
password2 = droid.dialogGetPassword('Confirm password').result
if password != password2:
modal_dialog('Error','passwords do not match')
exit()
else:
# set to None if it's an empty string
password = None
if action == 'create':
wallet = Wallet(storage)
seed = wallet.make_seed()
modal_dialog('Your seed is:', seed)
wallet.add_seed(seed, password)
wallet.create_master_keys(password)
wallet.create_main_account(password)
elif action == 'restore':
seed = self.seed_dialog()
if not seed:
exit()
if not Wallet.is_seed(seed):
exit()
wallet = Wallet.from_seed(seed, password, storage)
else:
exit()
msg = "Creating wallet" if action == 'create' else "Restoring wallet"
droid.dialogCreateSpinnerProgress("Electrum-LTC", msg)
droid.dialogShow()
wallet.start_threads(network)
if action == 'restore':
wallet.wait_until_synchronized()
else:
wallet.synchronize()
droid.dialogDismiss()
droid.vibrate()
else:
wallet = Wallet(storage)
wallet.start_threads(network)
示例2: run_wallet_type
# 需要导入模块: from electrum_ltc import Wallet [as 别名]
# 或者: from electrum_ltc.Wallet import wait_until_synchronized [as 别名]
def run_wallet_type(self, action, wallet_type):
if action in ['create', 'restore']:
if wallet_type == 'multisig':
wallet_type = self.multisig_choice()
if not wallet_type:
return
elif wallet_type == 'hardware':
hardware_wallets = []
for item in electrum.wallet.wallet_types:
t, name, description, loader = item
if t == 'hardware':
try:
p = loader()
except:
util.print_error("cannot load plugin for:", name)
continue
if p:
hardware_wallets.append((name, description))
wallet_type = self.choice(_("Hardware Wallet"), 'Select your hardware wallet', hardware_wallets)
if not wallet_type:
return
elif wallet_type == 'twofactor':
wallet_type = '2fa'
if action == 'create':
self.storage.put('wallet_type', wallet_type, False)
if action is None:
return
if action == 'restore':
wallet = self.restore(wallet_type)
if not wallet:
return
action = None
else:
wallet = Wallet(self.storage)
action = wallet.get_action()
# fixme: password is only needed for multiple accounts
password = None
# load wallet in plugins
always_hook('installwizard_load_wallet', wallet, self)
while action is not None:
util.print_error("installwizard:", wallet, action)
if action == 'create_seed':
lang = self.config.get('language')
seed = wallet.make_seed(lang)
if not self.show_seed(seed, None):
return
self.app.clipboard().clear()
if not self.verify_seed(seed, None):
return
password = self.password_dialog()
wallet.add_seed(seed, password)
wallet.create_master_keys(password)
elif action == 'add_cosigners':
n = int(re.match('(\d+)of(\d+)', wallet.wallet_type).group(2))
xpub1 = wallet.master_public_keys.get("x1/")
r = self.multi_mpk_dialog(xpub1, n - 1)
if not r:
return
for i, xpub in enumerate(r):
wallet.add_master_public_key("x%d/"%(i+2), xpub)
elif action == 'create_accounts':
wallet.create_main_account(password)
self.waiting_dialog(wallet.synchronize)
else:
f = always_hook('get_wizard_action', self, wallet, action)
if not f:
raise BaseException('unknown wizard action', action)
r = f(wallet, self)
if not r:
return
# next action
action = wallet.get_action()
if self.network:
# show network dialog if config does not exist
if self.config.get('server') is None:
self.network_dialog()
else:
QMessageBox.information(None, _('Warning'), _('You are offline'), _('OK'))
# start wallet threads
wallet.start_threads(self.network)
if action == 'restore':
self.waiting_dialog(lambda: wallet.wait_until_synchronized(self.waiting_label.setText))
if self.network:
msg = _("Recovery successful") if wallet.is_found() else _("No transactions found for this seed")
else:
#.........这里部分代码省略.........