electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 7aaac2ee307ea64b22cf3ad88305fe45e19ae439
parent 099315013e4f112adbceed3e2f104458d0866826
Author: SomberNight <somber.night@protonmail.com>
Date:   Tue, 14 May 2019 15:31:33 +0200

qt wizard: change wizard_dialog semantics to raise exceptions

Specifically GoBack and UserCancelled will not be suppressed anymore.
Previously, if 'run_next' raised GoBack, that would propagate out fully,
while if 'func' itself raised it would be suppressed. This was confusing.

somewhat related: #5334

Diffstat:
Melectrum/gui/qt/installwizard.py | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/electrum/gui/qt/installwizard.py b/electrum/gui/qt/installwizard.py @@ -87,20 +87,20 @@ class CosignWidget(QWidget): def wizard_dialog(func): def func_wrapper(*args, **kwargs): run_next = kwargs['run_next'] - wizard = args[0] + wizard = args[0] # type: InstallWizard wizard.back_button.setText(_('Back') if wizard.can_go_back() else _('Cancel')) try: out = func(*args, **kwargs) + if type(out) is not tuple: + out = (out,) + run_next(*out) except GoBack: - wizard.go_back() if wizard.can_go_back() else wizard.close() - return - except UserCancelled: - return - #if out is None: - # out = () - if type(out) is not tuple: - out = (out,) - run_next(*out) + if wizard.can_go_back(): + wizard.go_back() + return + else: + wizard.close() + raise return func_wrapper