1
0

wizard: move GoBack from Qt wizard to base_wizard

This commit is contained in:
SomberNight
2018-05-01 14:39:01 +02:00
parent ba7d905dfb
commit ae24af9bc2
3 changed files with 9 additions and 7 deletions

View File

@@ -41,6 +41,7 @@ import PyQt5.QtCore as QtCore
from electrum.i18n import _, set_language from electrum.i18n import _, set_language
from electrum.plugins import run_hook from electrum.plugins import run_hook
from electrum import WalletStorage from electrum import WalletStorage
from electrum.base_wizard import GoBack
# from electrum.synchronizer import Synchronizer # from electrum.synchronizer import Synchronizer
# from electrum.verifier import SPV # from electrum.verifier import SPV
# from electrum.util import DebugMem # from electrum.util import DebugMem
@@ -48,7 +49,7 @@ from electrum.util import (UserCancelled, print_error,
WalletFileException, BitcoinException) WalletFileException, BitcoinException)
# from electrum.wallet import Abstract_Wallet # from electrum.wallet import Abstract_Wallet
from .installwizard import InstallWizard, GoBack from .installwizard import InstallWizard
try: try:

View File

@@ -10,7 +10,7 @@ from PyQt5.QtWidgets import *
from electrum import Wallet, WalletStorage from electrum import Wallet, WalletStorage
from electrum.util import UserCancelled, InvalidPassword from electrum.util import UserCancelled, InvalidPassword
from electrum.base_wizard import BaseWizard, HWD_SETUP_DECRYPT_WALLET from electrum.base_wizard import BaseWizard, HWD_SETUP_DECRYPT_WALLET, GoBack
from electrum.i18n import _ from electrum.i18n import _
from .seed_dialog import SeedLayout, KeysLayout from .seed_dialog import SeedLayout, KeysLayout
@@ -19,10 +19,6 @@ from .util import *
from .password_dialog import PasswordLayout, PasswordLayoutForHW, PW_NEW from .password_dialog import PasswordLayout, PasswordLayoutForHW, PW_NEW
class GoBack(Exception):
pass
MSG_ENTER_PASSWORD = _("Choose a password to encrypt your wallet keys.") + '\n'\ MSG_ENTER_PASSWORD = _("Choose a password to encrypt your wallet keys.") + '\n'\
+ _("Leave this field empty if you want to disable encryption.") + _("Leave this field empty if you want to disable encryption.")
MSG_HW_STORAGE_ENCRYPTION = _("Set wallet file encryption.") + '\n'\ MSG_HW_STORAGE_ENCRYPTION = _("Set wallet file encryption.") + '\n'\

View File

@@ -38,9 +38,13 @@ from .util import UserCancelled, InvalidPassword
# hardware device setup purpose # hardware device setup purpose
HWD_SETUP_NEW_WALLET, HWD_SETUP_DECRYPT_WALLET = range(0, 2) HWD_SETUP_NEW_WALLET, HWD_SETUP_DECRYPT_WALLET = range(0, 2)
class ScriptTypeNotSupported(Exception): pass class ScriptTypeNotSupported(Exception): pass
class GoBack(Exception): pass
class BaseWizard(object): class BaseWizard(object):
def __init__(self, config, storage): def __init__(self, config, storage):
@@ -255,10 +259,11 @@ class BaseWizard(object):
devmgr.unpair_id(device_info.device.id_) devmgr.unpair_id(device_info.device.id_)
self.choose_hw_device(purpose) self.choose_hw_device(purpose)
return return
except UserCancelled: except (UserCancelled, GoBack):
self.choose_hw_device(purpose) self.choose_hw_device(purpose)
return return
except BaseException as e: except BaseException as e:
traceback.print_exc(file=sys.stderr)
self.show_error(str(e)) self.show_error(str(e))
self.choose_hw_device(purpose) self.choose_hw_device(purpose)
return return