@ -19,7 +19,7 @@ from PyQt5.QtWidgets import (QWidget, QDialog, QLabel, QHBoxLayout, QMessageBox,
from electrum . wallet import Wallet , Abstract_Wallet
from electrum . wallet import Wallet , Abstract_Wallet
from electrum . storage import WalletStorage , StorageReadWriteError
from electrum . storage import WalletStorage , StorageReadWriteError
from electrum . util import UserCancelled , InvalidPassword , WalletFileException , get_new_wallet_name
from electrum . util import UserCancelled , InvalidPassword , WalletFileException , get_new_wallet_name
from electrum . base_wizard import BaseWizard , HWD_SETUP_DECRYPT_WALLET , GoBack
from electrum . base_wizard import BaseWizard , HWD_SETUP_DECRYPT_WALLET , GoBack , ReRunDialog
from electrum . i18n import _
from electrum . i18n import _
from . seed_dialog import SeedLayout , KeysLayout
from . seed_dialog import SeedLayout , KeysLayout
@ -97,6 +97,7 @@ def wizard_dialog(func):
run_next = kwargs [ ' run_next ' ]
run_next = kwargs [ ' run_next ' ]
wizard = args [ 0 ] # type: InstallWizard
wizard = args [ 0 ] # type: InstallWizard
while True :
while True :
#wizard.logger.debug(f"dialog stack. len: {len(wizard._stack)}. stack: {wizard._stack}")
wizard . back_button . setText ( _ ( ' Back ' ) if wizard . can_go_back ( ) else _ ( ' Cancel ' ) )
wizard . back_button . setText ( _ ( ' Back ' ) if wizard . can_go_back ( ) else _ ( ' Cancel ' ) )
# current dialog
# current dialog
try :
try :
@ -109,12 +110,25 @@ def wizard_dialog(func):
# to go back from the current dialog, we just let the caller unroll the stack:
# to go back from the current dialog, we just let the caller unroll the stack:
raise
raise
# next dialog
# next dialog
try :
while True :
try :
try :
run_next ( * out )
run_next ( * out )
except GoBack :
except ReRunDialog :
# restore state, and then let the loop re-run next
wizard . go_back ( rerun_previous = False )
else :
break
except GoBack as e :
# to go back from the next dialog, we ask the wizard to restore state
# to go back from the next dialog, we ask the wizard to restore state
wizard . go_back ( rerun_previous = False )
wizard . go_back ( rerun_previous = False )
# and we re-run the current dialog (by continuing)
# and we re-run the current dialog
if wizard . can_go_back ( ) :
# also rerun any calculations that might have populated the inputs to the current dialog,
# by going back to just after the *previous* dialog finished
raise ReRunDialog ( ) from e
else :
continue
else :
else :
break
break
return func_wrapper
return func_wrapper