@@ -157,10 +157,11 @@ def on_clickable_input_clicked(
157157
158158 prefix : Prefix = "sub" if "subject" in input_id else "ses"
159159
160- async def _on_clickable_input_clicked ():
161- if event .ctrl :
162- self .fill_input_with_template (prefix , input_id )
163- else :
160+ if event .ctrl :
161+ self .fill_input_with_template (prefix , input_id )
162+ else :
163+
164+ async def _on_clickable_input_clicked ():
164165 input_box = self .query_one (f"#{ input_id } " )
165166 spinner = CustomSpinner (id = "input_suggestion_spinner" )
166167 input_box .mount (spinner )
@@ -169,14 +170,14 @@ async def _on_clickable_input_clicked():
169170 prefix ,
170171 input_id ,
171172 self .interface .get_tui_settings ()[
172- "suggest_next_sub_ses_local_only "
173+ "suggest_next_sub_ses_remote "
173174 ],
174175 )
175176 await worker .wait ()
176177 spinner .remove ()
177178 input_box .disabled = False
178179
179- asyncio .create_task (_on_clickable_input_clicked ())
180+ asyncio .create_task (_on_clickable_input_clicked ())
180181
181182 def on_custom_directory_tree_directory_tree_special_key_press (
182183 self , event : CustomDirectoryTree .DirectoryTreeSpecialKeyPress
@@ -293,7 +294,7 @@ def reload_directorytree(self) -> None:
293294 # ----------------------------------------------------------------------------------
294295 @work (exclusive = False , thread = True )
295296 def fill_input_with_next_sub_or_ses_template (
296- self , prefix : Prefix , input_id : str , local_only : bool
297+ self , prefix : Prefix , input_id : str , include_central : bool
297298 ) -> Worker :
298299 """
299300 This fills a sub / ses Input with a suggested name based on the
@@ -316,17 +317,14 @@ def fill_input_with_next_sub_or_ses_template(
316317 "top_level_folder_select"
317318 ]["create_tab" ]
318319
319- def show_error_dialog (output : str ) -> None :
320- self .mainwindow .call_from_thread (
321- self .mainwindow .show_modal_error_dialog , output
322- )
323-
324320 if prefix == "sub" :
325321 success , output = self .interface .get_next_sub (
326- top_level_folder , local_only = local_only
322+ top_level_folder , include_central = include_central
327323 )
328324 if not success :
329- show_error_dialog (output )
325+ self .mainwindow .show_modal_error_dialog_from_main_thread (
326+ output
327+ )
330328 return
331329 else :
332330 next_val = output
@@ -336,14 +334,14 @@ def show_error_dialog(output: str) -> None:
336334 ).as_names_list ()
337335
338336 if len (sub_names ) > 1 :
339- show_error_dialog (
337+ self . mainwindow . show_modal_error_dialog_from_main_thread (
340338 "Can only suggest next session number when a "
341339 "single subject is provided."
342340 )
343341 return
344342
345343 if sub_names == ["" ]:
346- show_error_dialog (
344+ self . mainwindow . show_modal_error_dialog_from_main_thread (
347345 "Must input a subject number before suggesting "
348346 "next session number."
349347 )
@@ -353,10 +351,12 @@ def show_error_dialog(output: str) -> None:
353351 sub = sub_names [0 ]
354352
355353 success , output = self .interface .get_next_ses (
356- top_level_folder , sub , local_only = local_only
354+ top_level_folder , sub , include_central = include_central
357355 )
358356 if not success :
359- show_error_dialog (output )
357+ self .mainwindow .show_modal_error_dialog_from_main_thread (
358+ output
359+ )
360360 return
361361 else :
362362 next_val = output
0 commit comments