Browse Source

wizard: move GoBack from Qt wizard to base_wizard

3.2.x
SomberNight 7 years ago
parent
commit
ae24af9bc2
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 3
      gui/qt/__init__.py
  2. 6
      gui/qt/installwizard.py
  3. 7
      lib/base_wizard.py

3
gui/qt/__init__.py

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

6
gui/qt/installwizard.py

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

7
lib/base_wizard.py

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

Loading…
Cancel
Save