From a3930d4bdbedf10c07e387d31a310a65794af6e8 Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 4 Nov 2019 15:32:50 +0100 Subject: [PATCH] core: rename close_default to a more appropriate kill_default --- core/src/apps/common/mnemonic.py | 2 +- core/src/trezor/workflow.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/src/apps/common/mnemonic.py b/core/src/apps/common/mnemonic.py index d556e68ce5..30ca2763bf 100644 --- a/core/src/apps/common/mnemonic.py +++ b/core/src/apps/common/mnemonic.py @@ -59,7 +59,7 @@ def _start_progress() -> None: # Because we are drawing to the screen manually, without a layout, we # should make sure that no other layout is running. At this point, only # the homescreen should be on, so shut it down. - workflow.close_default() + workflow.kill_default() ui.backlight_fade(ui.BACKLIGHT_DIM) ui.display.clear() ui.header("Please wait") diff --git a/core/src/trezor/workflow.py b/core/src/trezor/workflow.py index 4cb28195f9..852f415f4b 100644 --- a/core/src/trezor/workflow.py +++ b/core/src/trezor/workflow.py @@ -79,9 +79,15 @@ def replace_default(constructor: Callable[[], loop.Task]) -> None: loop.finalize(default_task, None) # TODO: why not close_default() start_default(constructor) +def kill_default() -> None: + """Forcefully shut down default task. -def close_default() -> None: - """Explicitly close the default workflow task.""" + The purpose of the call is to prevent the default task from interfering with + a synchronous layout-less workflow (e.g., the progress bar in `mnemonic.get_seed`). + + This function should only be called from a workflow registered with `on_start`. + Otherwise the default will be restarted immediately. + """ if default_task: if __debug__: log.debug(__name__, "close default")