twizard: move GoBack from Qt wizard to base_wizard - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit ae24af9bc2905b4aeb8e6b46020cfc2795911bf7 DIR parent ba7d905dfbf30b0204fdf9aa461c59e699f63e16 HTML Author: SomberNight <somber.night@protonmail.com> Date: Tue, 1 May 2018 14:39:01 +0200 wizard: move GoBack from Qt wizard to base_wizard Diffstat: M gui/qt/__init__.py | 3 ++- M gui/qt/installwizard.py | 6 +----- M lib/base_wizard.py | 7 ++++++- 3 files changed, 9 insertions(+), 7 deletions(-) --- DIR diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py t@@ -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 t@@ -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: DIR diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py t@@ -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 t@@ -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'\ DIR diff --git a/lib/base_wizard.py b/lib/base_wizard.py t@@ -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): t@@ -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