Improve cancellation logic and sync performance.

- Implement explicit threading.Event propagation for robust GUI cancellation.
- Optimize file synchronization by skipping hash validation for up-to-date files (matching size and timestamp).
- Update Windows long path support to correctly handle UNC network shares.
- Refactor configuration management to eliminate global state and improve modularity.
- Remove requests.get monkey-patch in GUI.
- Delete CLAUDE.md as it is no longer required.
This commit is contained in:
Martin Tranberg
2026-04-12 12:44:43 +02:00
parent 8899afabbc
commit 8e8bb3baa1
3 changed files with 72 additions and 101 deletions

View File

@@ -9,16 +9,6 @@ import requests
# --- Global Stop Flag ---
stop_event = threading.Event()
# For at stoppe uden at ændre download_sharepoint.py, "patcher" vi requests.get
# så den tjekker stop_event før hver anmodning.
original_get = requests.get
def patched_get(*args, **kwargs):
if stop_event.is_set():
raise InterruptedError("Synkronisering afbrudt af brugeren.")
return original_get(*args, **kwargs)
requests.get = patched_get
# --- Logging Handler for GUI ---
class TextboxHandler(logging.Handler):
def __init__(self, textbox):
@@ -149,7 +139,8 @@ class SharepointApp(ctk.CTk):
def run_sync(self):
try:
download_sharepoint.main()
config = download_sharepoint.load_config("connection_info.txt")
download_sharepoint.main(config=config, stop_event=stop_event)
if stop_event.is_set():
self.status_label.configure(text="Status: Afbrudt", text_color="red")
else: