Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions datashuttle/tui/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from datashuttle import DataShuttle
from datashuttle.configs import load_configs
from datashuttle.utils import aws, rclone, ssh, utils
from datashuttle.utils.rclone import get_local_and_central_file_differences


class Interface:
Expand Down Expand Up @@ -365,6 +366,20 @@ def transfer_custom_selection(
except Exception as e:
return False, str(e)

def get_transfer_diffs(
self, top_level_folders_to_check: List[TopLevelFolder]
) -> InterfaceOutput:
"""Get a dict of differences between the local and central project."""
try:
transfer_diffs = get_local_and_central_file_differences(
self.get_configs(),
top_level_folders_to_check=top_level_folders_to_check,
)
return True, transfer_diffs

except Exception as e:
return False, str(e)

# Name templates
# ----------------------------------------------------------------------------------

Expand Down
20 changes: 10 additions & 10 deletions datashuttle/tui/tabs/transfer_status_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from datashuttle.tui.custom_widgets import (
CustomDirectoryTree,
)
from datashuttle.utils.rclone import get_local_and_central_file_differences


class TransferStatusTree(CustomDirectoryTree):
Expand Down Expand Up @@ -78,8 +77,16 @@ def update_transfer_tree(self, init: bool = False) -> None:
self.update_local_transfer_paths()

if self.mainwindow.load_global_settings()["show_transfer_tree_status"]:
self.update_transfer_diffs()

success, output = self.interface.get_transfer_diffs(
top_level_folders_to_check=["rawdata", "derivatives"]
)
if success:
self.transfer_diffs = output
else:
self.mainwindow.show_modal_error_dialog(
f"Could not update transfer tree status. See the below error:\n{output}"
)
return
if not init:
self.reload()

Expand All @@ -97,13 +104,6 @@ def update_local_transfer_paths(self) -> None:
)
self.transfer_paths = paths_list

def update_transfer_diffs(self) -> None:
"""Update the transfer diffs used to style the DirectoryTree."""
self.transfer_diffs = get_local_and_central_file_differences(
self.interface.get_configs(),
top_level_folders_to_check=["rawdata", "derivatives"],
)

# Overridden Methods
# ----------------------------------------------------------------------------------

Expand Down
3 changes: 2 additions & 1 deletion datashuttle/utils/rclone.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ def run_function_that_requires_encrypted_rclone_config_access(

if check_config_exists and not rclone_config_filepath.is_file():
raise RuntimeError(
f"The way RClone configs are managed has changed since version v0.7.1\n"
f"The Rclone config file cannot be found. You may be seeing this as the way "
f"Rclone configs are managed was changed in v0.7.1\n"
f"Please set up the {cfg['connection_method']} connection again."
)

Expand Down
Loading