From f2376f90ade983dc6178d1af420675fe4e3439a8 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 13 Aug 2021 12:20:06 -0400 Subject: [PATCH] Support "next to be focussed" args to async form handlers --- piker/ui/_forms.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/piker/ui/_forms.py b/piker/ui/_forms.py index 9f9c0267..ce4273e7 100644 --- a/piker/ui/_forms.py +++ b/piker/ui/_forms.py @@ -334,6 +334,7 @@ async def handle_field_input( recv_chan: trio.abc.ReceiveChannel, form: FieldsForm, model: pydantic.BaseModel, # noqa + focus_next: QWidget, ) -> None: @@ -356,7 +357,8 @@ async def handle_field_input( }: widget.clearFocus() - form.godwidget.focus() + # normally the godwidget + focus_next.focus() continue # process field input @@ -414,7 +416,8 @@ def mk_form( @asynccontextmanager async def open_form_input_handling( - form: FieldsForm + form: FieldsForm, + focus_next: QWidget, ) -> FieldsForm: @@ -431,6 +434,7 @@ async def open_form_input_handling( handle_field_input, form=form, model=form.model, + focus_next=focus_next, ), # block key repeats?