Skip to content

Commit a8e4bb8

Browse files
author
shrey
committed
slight refactor
1 parent 63be264 commit a8e4bb8

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

datashuttle/tui/tabs/create_folders.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def __init__(self, mainwindow: TuiApp, interface: Interface) -> None:
5151
)
5252
self.mainwindow = mainwindow
5353
self.interface = interface
54-
self.searching_remote_popup: SearchingRemoteForNextSubSesPopup | None
54+
self.searching_remote_popup: (
55+
SearchingRemoteForNextSubSesPopup | None
56+
) = None
5557

5658
self.prev_click_time = 0.0
5759

@@ -145,7 +147,7 @@ async def refresh_after_datatypes_changed(self, ignore):
145147
self.on_mount()
146148

147149
@require_double_click
148-
async def on_clickable_input_clicked(
150+
def on_clickable_input_clicked(
149151
self, event: ClickableInput.Clicked
150152
) -> None:
151153
"""
@@ -167,7 +169,7 @@ async def on_clickable_input_clicked(
167169
"suggest_next_sub_ses_remote"
168170
]
169171

170-
await self.suggest_next_sub_ses_with_popup(
172+
self.suggest_next_sub_ses_with_popup(
171173
prefix, input_id, include_central
172174
)
173175

@@ -363,28 +365,30 @@ def fill_input_with_next_sub_or_ses_template(
363365
input = self.query_one(f"#{input_id}")
364366
input.value = fill_value
365367

366-
async def suggest_next_sub_ses_with_popup(
368+
async def fill_suggestion_and_dismiss_popup(
369+
self, prefix, input_id, include_central
370+
):
371+
worker = self.fill_input_with_next_sub_or_ses_template(
372+
prefix, input_id, include_central
373+
)
374+
await worker.wait()
375+
if self.searching_remote_popup:
376+
self.searching_remote_popup.dismiss()
377+
self.searching_remote_popup = None
378+
379+
def suggest_next_sub_ses_with_popup(
367380
self, prefix: Prefix, input_id: str, include_central: bool
368381
):
369382
if include_central:
370383
searching_remote_popup = SearchingRemoteForNextSubSesPopup(prefix)
371384
self.searching_remote_popup = searching_remote_popup
372385
self.mainwindow.push_screen(searching_remote_popup)
373386

374-
async def _fill_suggestion_and_dismiss_popup():
375-
worker = self.fill_input_with_next_sub_or_ses_template(
376-
prefix, input_id, include_central
377-
)
378-
await worker.wait()
379-
if self.searching_remote_popup:
380-
searching_remote_popup.dismiss()
381-
382-
asyncio.create_task(_fill_suggestion_and_dismiss_popup())
383-
else:
384-
worker = self.fill_input_with_next_sub_or_ses_template(
387+
asyncio.create_task(
388+
self.fill_suggestion_and_dismiss_popup(
385389
prefix, input_id, include_central
386390
)
387-
await worker.wait()
391+
)
388392

389393
def run_local_validation(self, prefix: Prefix):
390394
"""

0 commit comments

Comments
 (0)