wizard: small tweaks, fix show_restore
This commit is contained in:
@@ -131,22 +131,24 @@ class InstallWizard(WindowModalDialog, WizardBase):
|
|||||||
return self.pw_dialog(msg or MSG_ENTER_PASSWORD, PasswordDialog.PW_NEW)
|
return self.pw_dialog(msg or MSG_ENTER_PASSWORD, PasswordDialog.PW_NEW)
|
||||||
|
|
||||||
def choose_server(self, network):
|
def choose_server(self, network):
|
||||||
# Show network dialog if config does not exist
|
self.network_dialog(network)
|
||||||
if self.config.get('server') is None:
|
|
||||||
self.network_dialog(network)
|
|
||||||
|
|
||||||
def show_restore(self, wallet, network, action):
|
def show_restore(self, wallet, network):
|
||||||
def on_finished(b):
|
if network:
|
||||||
if action == 'restore':
|
def task():
|
||||||
if network:
|
wallet.wait_until_synchronized()
|
||||||
if wallet.is_found():
|
if wallet.is_found():
|
||||||
msg = _("Recovery successful")
|
msg = _("Recovery successful")
|
||||||
else:
|
|
||||||
msg = _("No transactions found for this seed")
|
|
||||||
else:
|
else:
|
||||||
msg = _("This wallet was restored offline. It may "
|
msg = _("No transactions found for this seed")
|
||||||
"contain more addresses than displayed.")
|
self.emit(QtCore.SIGNAL('synchronized'), msg)
|
||||||
self.show_message(msg)
|
self.connect(self, QtCore.SIGNAL('synchronized'), self.show_message)
|
||||||
|
t = threading.Thread(target = task)
|
||||||
|
t.start()
|
||||||
|
else:
|
||||||
|
msg = _("This wallet was restored offline. It may "
|
||||||
|
"contain more addresses than displayed.")
|
||||||
|
self.show_message(msg)
|
||||||
|
|
||||||
def create_addresses(self, wallet):
|
def create_addresses(self, wallet):
|
||||||
def task():
|
def task():
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class WizardBase(PrintError):
|
|||||||
"""Choose a server if one is not set in the config anyway."""
|
"""Choose a server if one is not set in the config anyway."""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def show_restore(self, wallet, network, action):
|
def show_restore(self, wallet, network):
|
||||||
"""Show restore result"""
|
"""Show restore result"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -124,17 +124,19 @@ class WizardBase(PrintError):
|
|||||||
filename. If the file doesn't exist launch the GUI-specific
|
filename. If the file doesn't exist launch the GUI-specific
|
||||||
install wizard proper.'''
|
install wizard proper.'''
|
||||||
storage = WalletStorage(filename)
|
storage = WalletStorage(filename)
|
||||||
|
need_sync = False
|
||||||
|
is_restore = False
|
||||||
|
|
||||||
if storage.file_exists:
|
if storage.file_exists:
|
||||||
wallet = Wallet(storage)
|
wallet = Wallet(storage)
|
||||||
self.update_wallet_format(wallet)
|
self.update_wallet_format(wallet)
|
||||||
task = None
|
|
||||||
else:
|
else:
|
||||||
cr, wallet = self.create_or_restore(storage)
|
cr, wallet = self.create_or_restore(storage)
|
||||||
if not wallet:
|
if not wallet:
|
||||||
return
|
return
|
||||||
task = lambda: self.show_restore(wallet, network, cr)
|
need_sync = True
|
||||||
|
is_restore = (cr == 'restore')
|
||||||
|
|
||||||
need_sync = False
|
|
||||||
while True:
|
while True:
|
||||||
action = wallet.get_action()
|
action = wallet.get_action()
|
||||||
if not action:
|
if not action:
|
||||||
@@ -145,7 +147,9 @@ class WizardBase(PrintError):
|
|||||||
wallet.storage.write()
|
wallet.storage.write()
|
||||||
|
|
||||||
if network:
|
if network:
|
||||||
self.choose_server(network)
|
# Show network dialog if config does not exist
|
||||||
|
if self.config.get('server') is None:
|
||||||
|
self.choose_server(network)
|
||||||
else:
|
else:
|
||||||
self.show_warning(_('You are offline'))
|
self.show_warning(_('You are offline'))
|
||||||
|
|
||||||
@@ -156,8 +160,8 @@ class WizardBase(PrintError):
|
|||||||
if network:
|
if network:
|
||||||
wallet.start_threads(network)
|
wallet.start_threads(network)
|
||||||
|
|
||||||
if task:
|
if is_restore:
|
||||||
task()
|
self.show_restore(wallet, network)
|
||||||
|
|
||||||
return wallet
|
return wallet
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user