mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 17:55:20 +00:00
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
This commit is contained in:
parent
099315013e
commit
7aaac2ee30
1 changed files with 10 additions and 10 deletions
|
@ -87,20 +87,20 @@ class CosignWidget(QWidget):
|
||||||
def wizard_dialog(func):
|
def wizard_dialog(func):
|
||||||
def func_wrapper(*args, **kwargs):
|
def func_wrapper(*args, **kwargs):
|
||||||
run_next = kwargs['run_next']
|
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'))
|
wizard.back_button.setText(_('Back') if wizard.can_go_back() else _('Cancel'))
|
||||||
try:
|
try:
|
||||||
out = func(*args, **kwargs)
|
out = func(*args, **kwargs)
|
||||||
|
if type(out) is not tuple:
|
||||||
|
out = (out,)
|
||||||
|
run_next(*out)
|
||||||
except GoBack:
|
except GoBack:
|
||||||
wizard.go_back() if wizard.can_go_back() else wizard.close()
|
if wizard.can_go_back():
|
||||||
return
|
wizard.go_back()
|
||||||
except UserCancelled:
|
return
|
||||||
return
|
else:
|
||||||
#if out is None:
|
wizard.close()
|
||||||
# out = ()
|
raise
|
||||||
if type(out) is not tuple:
|
|
||||||
out = (out,)
|
|
||||||
run_next(*out)
|
|
||||||
return func_wrapper
|
return func_wrapper
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue