diff --git a/src/main_window.py b/src/main_window.py index cfab2d0..d8d0ec3 100644 --- a/src/main_window.py +++ b/src/main_window.py @@ -527,6 +527,10 @@ class MainWindow(QMainWindow, Ui_MainWindow): item_widget.set_label_1(f"Deleted from {parent_dir}") item_widget.set_label_2(f"") + elif file_operation == "Moving": + item_widget.set_label_1(f"Trashed from {parent_dir}") + item_widget.set_label_2(f"") + elif transfer_complete and file_operation == "Uploading": shortened_path = shorten_path(relative_path_display, 32) item_widget.set_label_1(f"Uploaded from {shortened_path}") @@ -563,6 +567,10 @@ class MainWindow(QMainWindow, Ui_MainWindow): myQCustomQWidget.set_label_1(f"Deleted from {parent_dir}") myQCustomQWidget.set_label_2(f"") + elif file_operation == "Moving": + myQCustomQWidget.set_label_1(f"Trashed from {parent_dir}") + myQCustomQWidget.set_label_2(f"") + elif transfer_complete and file_operation == "Uploading": shortened_path = shorten_path(relative_path_display, 32) myQCustomQWidget.set_label_1(f"Uploaded from {shortened_path}") diff --git a/src/workers.py b/src/workers.py index 49ba496..76f32ea 100644 --- a/src/workers.py +++ b/src/workers.py @@ -81,7 +81,9 @@ class WorkerThread(QThread): "Uploading new file", "Uploading modified file", "Downloading modified file", - "Deleting item", + "Deleting item", # File deleted locally and then removed in the cloud + "Deleting local file", # File deleted in the cloud and then removed locally + "Moving this local file", # File deleted in the cloud and then moved to recycling bin locally ] self.profile_status = { @@ -193,17 +195,17 @@ class WorkerThread(QThread): elif any(_ in stdout for _ in self.tasks): # Capture information about file that is being uploaded/downloaded/deleted by OneDrive. - file_operation = re.search(r"\b([Uploading|Downloading|Deleting]+)*", stdout).group(1) + file_operation = re.search(r"\b([Uploading|Downloading|Deleting|Moving]+)*", stdout).group(1) - if file_operation == "Deleting": + if file_operation in {"Deleting", "Moving"}: self.file_name = re.search(r".*/(.+)$", stdout) - self.file_path = re.search(r"\b[item|OneDrive:]\s(.+)$", stdout) + self.file_path = re.search(r".+\:\s(.+)$", stdout) else: self.file_name = re.search(r".*/(.+)\s+\.+", stdout) self.file_path = re.search(r"\b[file:]+\s(.+)\s+\.\.\.", stdout) - transfer_complete = any(["done" in stdout, "Deleting" in stdout]) + transfer_complete = any(["done" in stdout, "Deleting" in stdout, "Moving" in stdout]) progress = "0" transfer_progress_new = {