@@ -403,26 +403,38 @@ def delete_doc(self, path: Path, mode: DelAction = None) -> None:
403403 f"{ doc_pair .remote_parent_path } /{ doc_pair .remote_ref } "
404404 )
405405
406- def _save_remote_parent_infos (
407- self , remote_path : str , remote_ref : str , duplicate_behavior : str
406+ def _save_last_dt_session_infos (
407+ self ,
408+ remote_path : str ,
409+ remote_ref : str ,
410+ duplicate_behavior : str ,
411+ last_local_selected_location : Optional [Path ],
408412 ) -> None :
409- """Store remote infos into the database for later runs."""
413+ """Store last dt session infos into the database for later runs."""
410414 self .dao .update_config ("dt_last_remote_location" , remote_path )
411415 self .dao .update_config ("dt_last_remote_location_ref" , remote_ref )
412416 self .dao .update_config ("dt_last_duplicates_behavior" , duplicate_behavior )
417+ if last_local_selected_location :
418+ self .dao .update_config (
419+ "dt_last_local_selected_location" , last_local_selected_location
420+ )
413421
414422 def _direct_transfer (
415423 self ,
416424 local_paths : Dict [Path , int ],
417425 remote_parent_path : str ,
418426 remote_parent_ref : str ,
419- duplicate_behavior : str ,
427+ duplicate_behavior : str = "create" ,
428+ last_local_selected_location : Optional [Path ] = None ,
420429 ) -> None :
421430 """Plan the Direct Transfer."""
422431
423- # Save the remote location for next times
424- self ._save_remote_parent_infos (
425- remote_parent_path , remote_parent_ref , duplicate_behavior
432+ # Save last dt session infos for next times
433+ self ._save_last_dt_session_infos (
434+ remote_parent_path ,
435+ remote_parent_ref ,
436+ duplicate_behavior ,
437+ last_local_selected_location ,
426438 )
427439
428440 all_paths = local_paths .keys ()
@@ -474,13 +486,15 @@ def direct_transfer(
474486 remote_parent_path : str ,
475487 remote_parent_ref : str ,
476488 duplicate_behavior : str = "create" ,
489+ last_local_selected_location : Optional [Path ] = None ,
477490 ) -> None :
478491 """Plan the Direct Transfer."""
479492 self ._direct_transfer (
480493 local_paths ,
481494 remote_parent_path ,
482495 remote_parent_ref ,
483496 duplicate_behavior = duplicate_behavior ,
497+ last_local_selected_location = last_local_selected_location ,
484498 )
485499
486500 def direct_transfer_async (
@@ -489,6 +503,7 @@ def direct_transfer_async(
489503 remote_parent_path : str ,
490504 remote_parent_ref : str ,
491505 duplicate_behavior : str = "create" ,
506+ last_local_selected_location : Optional [Path ] = None ,
492507 ) -> None :
493508 """Plan the Direct Transfer. Async to not freeze the GUI."""
494509 from .workers import Runner
@@ -499,6 +514,7 @@ def direct_transfer_async(
499514 remote_parent_path ,
500515 remote_parent_ref ,
501516 duplicate_behavior = duplicate_behavior ,
517+ last_local_selected_location = last_local_selected_location ,
502518 )
503519 self ._threadpool .start (runner )
504520
0 commit comments