From 7c182047bbb7ce5e92481dd91525c2d77df7d108 Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Sat, 20 Jun 2026 21:22:49 -0500 Subject: [PATCH] Fix duplicate DialogManager methods and make tooling Python 3.14-aware DialogManager defined show_transfer_stats and show_disable_debugging_reminder twice; the later definitions silently shadowed the earlier ones. The live show_transfer_stats(self, stats, operation) accepted only two arguments, but TransferManager passed a third (deduplicator), raising TypeError inside the Tk after() callback so the transfer-stats window never appeared after folder transfers. The shadowed copies were also dead: they indexed stats keys (bytes_saved/total_files/...) that the *_with_dedup TODO stubs never produce, so they would have KeyError'd on the real {"message": ...} payload. - Remove the dead, shadowed copies of both methods - Drop the unused deduplicator argument at the caller (transfer_manager) - Annotate the surviving methods with -> None Also align linting/type config with the existing >=3.13,<3.15 support that CI already exercises: black now targets py313+py314, and CLAUDE.md documents 3.13/3.14. mypy stays pinned to the 3.13 floor (the oldest supported runtime). Co-Authored-By: Claude Opus 4.8 --- CLAUDE.md | 2 +- pyproject.toml | 2 +- src/gui/dialogs/dialog_manager.py | 56 ++----------------------------- src/managers/transfer_manager.py | 1 - 4 files changed, 4 insertions(+), 57 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 3553978..8f0b5a3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -158,6 +158,6 @@ The project uses GitHub Actions for multi-platform builds (`.github/workflows/re ## Notes - **ADB Binaries**: Stored in `src/platform-tools/` - do not modify or delete unless explictly instructed to -- **Python Version**: Requires Python 3.13 (< 3.14) +- **Python Version**: Requires Python 3.13 or 3.14 (>=3.13, <3.15) - **Package Mode**: Poetry is configured with `package-mode = false` - **License**: First-run license agreement required on Windows diff --git a/pyproject.toml b/pyproject.toml index 76c5bd3..fba3570 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ pyinstaller = "^6.1.0" [tool.black] line-length = 88 -target-version = ['py313'] +target-version = ['py313', 'py314'] [tool.mypy] python_version = "3.13" diff --git a/src/gui/dialogs/dialog_manager.py b/src/gui/dialogs/dialog_manager.py index ad0e2d0..f15b4b3 100644 --- a/src/gui/dialogs/dialog_manager.py +++ b/src/gui/dialogs/dialog_manager.py @@ -211,58 +211,6 @@ def on_close(): dialog.protocol("WM_DELETE_WINDOW", on_close) ok_button.config(command=on_close) - def show_disable_debugging_reminder(self) -> None: - """Show reminder to disable USB debugging after transfer.""" - msg = ( - "Transfer completed!\n\n" - "For security, please disable USB debugging when done:\n" - "Settings → Developer Options → disable 'USB debugging'." - ) - messagebox.showinfo("Disable USB Debugging", msg) - - def show_transfer_stats( - self, stats: dict, operation: str, deduplicator=None - ) -> None: - """Show transfer statistics dialog. - - Args: - stats: Dictionary containing transfer statistics - operation: Type of operation ("Pull" or "Push") - deduplicator: Optional deduplicator instance for byte formatting - """ - # Format bytes saved - bytes_saved_str = "" - if stats["bytes_saved"] > 0: - if deduplicator and hasattr(deduplicator, "format_bytes"): - bytes_saved_str = ( - f" ({deduplicator.format_bytes(stats['bytes_saved'])} saved)" - ) - else: - bytes_saved_str = f" ({stats['bytes_saved']} bytes saved)" - - # Build message - title = f"{operation} Transfer Complete" - - if stats["total_files"] == 0: - message = "No files were found to transfer." - else: - message_parts = [ - f"Transfer completed successfully!\n", - f"Files found: {stats['total_files']}", - f"Files transferred: {stats['transferred']}", - f"Duplicate files skipped: {stats['skipped']}{bytes_saved_str}", - ] - - if stats["skipped"] > 0: - message_parts.append( - f"\nDuplicate detection helped avoid unnecessary transfers!" - ) - - message = "\n".join(message_parts) - - # Show dialog - messagebox.showinfo(title, message) - def show_error(self, title: str, message: str) -> None: """Show an error dialog. @@ -386,7 +334,7 @@ def cancel_selection(): side="right" ) - def show_transfer_stats(self, stats: dict, operation: str): + def show_transfer_stats(self, stats: dict, operation: str) -> None: """Show transfer statistics in a dialog. Args: @@ -437,7 +385,7 @@ def show_transfer_stats(self, stats: dict, operation: str): # Close button tk.Button(main_frame, text="Close", command=stats_window.destroy).pack() - def show_disable_debugging_reminder(self): + def show_disable_debugging_reminder(self) -> None: """Show reminder about disabling USB debugging after transfer.""" messagebox.showinfo( "Security Reminder", diff --git a/src/managers/transfer_manager.py b/src/managers/transfer_manager.py index 71bbc8c..9d5ab58 100644 --- a/src/managers/transfer_manager.py +++ b/src/managers/transfer_manager.py @@ -255,7 +255,6 @@ def _transfer_thread( lambda: self.dialog_manager.show_transfer_stats( stats, direction.capitalize(), - self.device_manager.adb_manager.deduplicator, ), )