本文整理汇总了Python中wallet.Wallet.get_action方法的典型用法代码示例。如果您正苦于以下问题:Python Wallet.get_action方法的具体用法?Python Wallet.get_action怎么用?Python Wallet.get_action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wallet.Wallet
的用法示例。
在下文中一共展示了Wallet.get_action方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_wallet
# 需要导入模块: from wallet import Wallet [as 别名]
# 或者: from wallet.Wallet import get_action [as 别名]
def load_wallet(self, path):
if path in self.wallets:
wallet = self.wallets[path]
return wallet
storage = WalletStorage(path)
if not storage.file_exists:
return
wallet = Wallet(storage)
action = wallet.get_action()
if action:
return
wallet.start_threads(self.network)
self.wallets[path] = wallet
return wallet
示例2: run
# 需要导入模块: from wallet import Wallet [as 别名]
# 或者: from wallet.Wallet import get_action [as 别名]
def run(self, network, storage):
'''The main entry point of the wizard. Open a wallet from the given
filename. If the file doesn't exist launch the GUI-specific
install wizard proper, created by calling create_wizard().'''
need_sync = False
is_restore = False
if storage.file_exists:
wallet = Wallet(storage)
if wallet.imported_keys:
self.update_wallet_format(wallet)
else:
cr, wallet = self.create_or_restore(storage)
if not wallet:
return
need_sync = True
is_restore = (cr == 'restore')
while True:
action = wallet.get_action()
if not action:
break
need_sync = True
self.run_wallet_action(wallet, action)
# Save the wallet after each action
wallet.storage.write()
if network:
# Show network dialog if config does not exist
if self.config.get('auto_connect') is None:
self.choose_server(network)
else:
self.show_warning(_('You are offline'))
if need_sync:
self.create_addresses(wallet)
# start wallet threads
if network:
wallet.start_threads(network)
if is_restore:
self.show_restore(wallet, network)
self.finished()
return wallet
示例3: load_wallet
# 需要导入模块: from wallet import Wallet [as 别名]
# 或者: from wallet.Wallet import get_action [as 别名]
def load_wallet(self, path, get_wizard=None):
if path in self.wallets:
wallet = self.wallets[path]
else:
storage = WalletStorage(path)
if storage.file_exists:
wallet = Wallet(storage)
action = wallet.get_action()
else:
action = 'new'
if action:
if get_wizard is None:
return None
wizard = get_wizard()
wallet = wizard.run(self.network, storage)
else:
wallet.start_threads(self.network)
if wallet:
self.wallets[path] = wallet
return wallet
示例4: open_wallet
# 需要导入模块: from wallet import Wallet [as 别名]
# 或者: from wallet.Wallet import get_action [as 别名]
def open_wallet(self, network, filename):
'''The main entry point of the wizard. Open a wallet from the given
filename. If the file doesn't exist launch the GUI-specific
install wizard proper.'''
storage = WalletStorage(filename)
if storage.file_exists:
wallet = Wallet(storage)
self.update_wallet_format(wallet)
task = None
else:
cr, wallet = self.create_or_restore(storage)
if not wallet:
return
task = lambda: self.show_restore(wallet, network, cr)
need_sync = False
while True:
action = wallet.get_action()
if not action:
break
need_sync = True
self.run_wallet_action(wallet, action)
# Save the wallet after each action
wallet.storage.write()
if network:
self.choose_server(network)
else:
self.show_warning(_('You are offline'))
if need_sync:
self.create_addresses(wallet)
# start wallet threads
if network:
wallet.start_threads(network)
if task:
task()
return wallet
示例5: run
# 需要导入模块: from wallet import Wallet [as 别名]
# 或者: from wallet.Wallet import get_action [as 别名]
def run(self, network, storage):
'''The main entry point of the wizard. Open a wallet from the given
filename. If the file doesn't exist launch the GUI-specific
install wizard proper, created by calling create_wizard().'''
need_sync = False
is_restore = False
if storage.file_exists:
wallet = Wallet(storage)
if wallet.imported_keys:
self.update_wallet_format(wallet)
action = wallet.get_action()
if action != 'new':
self.hide()
path = storage.path
msg = _("The file '%s' contains an incompletely created wallet.\n"
"Do you want to complete its creation now?") % path
if not self.question(msg):
if self.question(_("Do you want to delete '%s'?") % path):
import os
os.remove(path)
self.show_warning(_('The file was removed'))
return
return
self.show()
else:
cr, wallet = self.create_or_restore(storage)
if not wallet:
return
need_sync = True
is_restore = (cr == 'restore')
while True:
action = wallet.get_action()
if not action:
break
need_sync = True
self.run_wallet_action(wallet, action)
# Save the wallet after each action
wallet.storage.write()
if network:
# Show network dialog if config does not exist
if self.config.get('auto_connect') is None:
self.choose_server(network)
else:
self.show_warning(_('You are offline'))
if need_sync:
self.create_addresses(wallet)
# start wallet threads
if network:
wallet.start_threads(network)
if is_restore:
self.show_restore(wallet, network)
self.finished()
return wallet