From e5295701d2fdef5b480abeb39fdec15f53a66dd4 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 6 Apr 2021 18:44:16 +0200 Subject: [PATCH] wizard: let UserCancelled propagate out in hw wallet flow Note that clicking "x" to close the wizard or pressing ESC also raises a UserCancelled: raising ChooseHwDeviceAgain was not letting the wizard close. E | gui.qt.installwizard.InstallWizard | Traceback (most recent call last): File "/home/user/wspace/electrum/electrum/base_wizard.py", line 371, in on_device client = self.plugin.setup_device(device_info, self, purpose) File "/home/user/wspace/electrum/electrum/plugins/trezor/trezor.py", line 305, in setup_device self.initialize_device(device_id, wizard, client.handler) File "/home/user/wspace/electrum/electrum/plugins/trezor/trezor.py", line 231, in initialize_device wizard.choice_dialog(title=_('Initialize Device'), message=msg, choices=choices, run_next=f) File "/home/user/wspace/electrum/electrum/gui/qt/installwizard.py", line 106, in func_wrapper out = func(*args, **kwargs) File "/home/user/wspace/electrum/electrum/gui/qt/installwizard.py", line 614, in choice_dialog self.exec_layout(vbox, title) File "/home/user/wspace/electrum/electrum/gui/qt/installwizard.py", line 434, in exec_layout raise UserCancelled() electrum.util.UserCancelled During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/user/wspace/electrum/electrum/base_wizard.py", line 277, in choose_hw_device self._choose_hw_device(purpose=purpose, storage=storage) File "/home/user/wspace/electrum/electrum/base_wizard.py", line 363, in _choose_hw_device self.choice_dialog(title=title, message=msg, choices=choices, File "/home/user/wspace/electrum/electrum/gui/qt/installwizard.py", line 120, in func_wrapper run_next(*out) File "/home/user/wspace/electrum/electrum/base_wizard.py", line 364, in run_next=lambda *args: self.on_device(*args, purpose=purpose, storage=storage)) File "/home/user/wspace/electrum/electrum/base_wizard.py", line 386, in on_device raise ChooseHwDeviceAgain() electrum.base_wizard.ChooseHwDeviceAgain E | gui.qt.installwizard.InstallWizard | choose_hw_device(). while iter starts. I | plugin.DeviceMgr | scanning devices... --- electrum/base_wizard.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/electrum/base_wizard.py b/electrum/base_wizard.py index 3a22a0c80..ac400249a 100644 --- a/electrum/base_wizard.py +++ b/electrum/base_wizard.py @@ -377,8 +377,10 @@ class BaseWizard(Logger): # will need to re-pair devmgr.unpair_id(device_info.device.id_) raise ChooseHwDeviceAgain() - except (UserCancelled, GoBack): + except GoBack: raise ChooseHwDeviceAgain() + except (UserCancelled, ReRunDialog): + raise except UserFacingException as e: self.show_error(str(e)) raise ChooseHwDeviceAgain()