File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414from datashuttle import DataShuttle
1515from datashuttle .configs import load_configs
1616from datashuttle .utils import aws , rclone , ssh , utils
17+ from datashuttle .utils .rclone import get_local_and_central_file_differences
1718
1819
1920class Interface :
@@ -365,6 +366,20 @@ def transfer_custom_selection(
365366 except Exception as e :
366367 return False , str (e )
367368
369+ def get_transfer_diffs (
370+ self , top_level_folders_to_check : List [TopLevelFolder ]
371+ ) -> InterfaceOutput :
372+ """Get a dict of differences between the local and central project."""
373+ try :
374+ transfer_diffs = get_local_and_central_file_differences (
375+ self .get_configs (),
376+ top_level_folders_to_check = top_level_folders_to_check ,
377+ )
378+ return True , transfer_diffs
379+
380+ except Exception as e :
381+ return False , str (e )
382+
368383 # Name templates
369384 # ----------------------------------------------------------------------------------
370385
Original file line number Diff line number Diff line change 1919from datashuttle .tui .custom_widgets import (
2020 CustomDirectoryTree ,
2121)
22- from datashuttle .utils .rclone import get_local_and_central_file_differences
2322
2423
2524class TransferStatusTree (CustomDirectoryTree ):
@@ -78,8 +77,16 @@ def update_transfer_tree(self, init: bool = False) -> None:
7877 self .update_local_transfer_paths ()
7978
8079 if self .mainwindow .load_global_settings ()["show_transfer_tree_status" ]:
81- self .update_transfer_diffs ()
82-
80+ success , output = self .interface .get_transfer_diffs (
81+ top_level_folders_to_check = ["rawdata" , "derivatives" ]
82+ )
83+ if success :
84+ self .transfer_diffs = output
85+ else :
86+ self .mainwindow .show_modal_error_dialog (
87+ f"Could not update transfer tree status. See the below error:\n { output } "
88+ )
89+ return
8390 if not init :
8491 self .reload ()
8592
@@ -97,13 +104,6 @@ def update_local_transfer_paths(self) -> None:
97104 )
98105 self .transfer_paths = paths_list
99106
100- def update_transfer_diffs (self ) -> None :
101- """Update the transfer diffs used to style the DirectoryTree."""
102- self .transfer_diffs = get_local_and_central_file_differences (
103- self .interface .get_configs (),
104- top_level_folders_to_check = ["rawdata" , "derivatives" ],
105- )
106-
107107 # Overridden Methods
108108 # ----------------------------------------------------------------------------------
109109
Original file line number Diff line number Diff line change @@ -203,7 +203,8 @@ def run_function_that_requires_encrypted_rclone_config_access(
203203
204204 if check_config_exists and not rclone_config_filepath .is_file ():
205205 raise RuntimeError (
206- f"The way RClone configs are managed has changed since version v0.7.1\n "
206+ f"The Rclone config file cannot be found. You may be seeing this as the way "
207+ f"Rclone configs are managed was changed in v0.7.1\n "
207208 f"Please set up the { cfg ['connection_method' ]} connection again."
208209 )
209210
You can’t perform that action at this time.
0 commit comments