This commit is contained in:
2025-08-25 11:18:48 -05:00
committed by Jason Ross
parent aefafeb380
commit 775a622509
2 changed files with 8 additions and 21 deletions
+3 -4
View File
@@ -238,7 +238,6 @@ class AndroidFileHandlerGUI(tk.Tk):
def _start_transfer_animation(self):
"""Start the 'Transferring...' animation."""
print("[DEBUG] Starting transfer animation")
self.transfer_dots = 0
self.transfer_animation_job = True # Mark as active before starting
self._animate_transfer_text()
@@ -249,7 +248,6 @@ class AndroidFileHandlerGUI(tk.Tk):
dots = "." * (self.transfer_dots + 1)
status_text = f"Transferring{dots}"
self.status_label.config(text=status_text)
print(f"[DEBUG] Animation update: {status_text}") # Debug output
self.update_idletasks() # Force immediate UI update
self.transfer_dots = (self.transfer_dots + 1) % 5 # Cycle 0-4 dots
# Schedule next update in 500ms
@@ -257,7 +255,6 @@ class AndroidFileHandlerGUI(tk.Tk):
def _stop_transfer_animation(self):
"""Stop the transfer animation."""
print("[DEBUG] Stopping transfer animation")
if self.transfer_animation_job is not None:
if isinstance(self.transfer_animation_job, str): # It's an after job ID
self.after_cancel(self.transfer_animation_job)
@@ -294,6 +291,7 @@ class AndroidFileHandlerGUI(tk.Tk):
self.device_connected = False
self.disable_controls()
self._disable_browse_buttons()
self._clear_paths_and_disable_button()
self._update_status(
"No Android devices detected. Please check the USB connection at both ends is securely inserted, USB debugging is enabled, and that File Transfer mode is turned on."
)
@@ -436,7 +434,6 @@ class AndroidFileHandlerGUI(tk.Tk):
def cancel_transfer(self):
"""Cancel the current transfer."""
print("[DEBUG] Cancel transfer requested")
# Cancel the actual ADB process
cancelled = self.adb_manager.cancel_transfer()
@@ -550,6 +547,7 @@ class AndroidFileHandlerGUI(tk.Tk):
# Device is no longer connected, update status and reset to recheck mode
self.device_connected = False
self._disable_browse_buttons()
self._clear_paths_and_disable_button()
self._update_status(
"No Android devices detected. Please check the USB connection at both ends is securely inserted, USB debugging is enabled, and that File Transfer mode is turned on."
)
@@ -745,6 +743,7 @@ class AndroidFileHandlerGUI(tk.Tk):
"""Handle device disconnection during transfers."""
self.device_connected = False
self._disable_browse_buttons()
self._clear_paths_and_disable_button()
self._update_status(
"No Android devices detected. Please check the USB connection at both ends is securely inserted, USB debugging is enabled, and that File Transfer mode is turned on."
)
+5 -17
View File
@@ -41,12 +41,6 @@ class ProgressHandler:
# Ensure percentage is within valid range
percentage = max(0.0, min(100.0, percentage))
# Debug output for large transfer troubleshooting
if bytes_total is not None:
print(f"[DEBUG] Progress update called: {percentage:.1f}% ({bytes_transferred_or_percentage}/{bytes_total} bytes)")
else:
print(f"[DEBUG] Progress update called: {percentage:.1f}%")
# Schedule UI update on main thread using a proper closure
def update_ui() -> None:
self._update_progress_ui(percentage)
@@ -59,12 +53,10 @@ class ProgressHandler:
Args:
percentage: Progress percentage (0.0 to 100.0) - used for logging only in indeterminate mode
"""
# Debug output for large transfer troubleshooting
print(f"[DEBUG] Progress update: {percentage:.1f}% (indeterminate mode, transfer_active: {self._transfer_active})")
# Only log significant progress jumps (10% or more)
if abs(percentage - self._last_percentage) >= 10.0:
print(f"[DEBUG] Major progress jump: {self._last_percentage:.1f}% -> {percentage:.1f}%")
pass # Could add non-debug logging here if needed
self._last_percentage = percentage
@@ -72,15 +64,13 @@ class ProgressHandler:
# Only start animation if we're in an active transfer and progress > 0
if self._transfer_active and percentage > 0 and percentage < 100:
self.progress_bar.start(10) # 10ms interval for smooth animation
print(f"[DEBUG] Progress bar animation started")
elif percentage >= 100:
self.progress_bar.stop() # Stop animation when complete
self._transfer_active = False # Transfer is done
print(f"[DEBUG] Progress bar animation stopped (transfer complete)")
self.parent.update_idletasks()
except Exception as exception_error:
print(f"[DEBUG] Error updating progress bar: {exception_error}")
pass # Silent error handling
def reset_progress(self) -> None:
"""Reset progress bar to 0 (thread-safe)."""
@@ -89,17 +79,15 @@ class ProgressHandler:
self.progress_bar.stop() # Stop any animation
self._last_percentage = 0.0
self._transfer_active = False # Not in a transfer
print(f"[DEBUG] Progress bar reset (stopped animation)")
self.parent.update_idletasks()
except Exception as exception_error:
print(f"[DEBUG] Error resetting progress bar: {exception_error}")
pass # Silent error handling for reset operation
self.parent.after(0, update_ui)
def start_transfer(self) -> None:
"""Mark that a transfer is starting (enables progress animation)."""
self._transfer_active = True
print(f"[DEBUG] Transfer marked as active")
def set_status(self, message: str) -> None:
"""Set the status label text (thread-safe).
@@ -123,4 +111,4 @@ class ProgressHandler:
self.status_label.config(text=message)
self.parent.update_idletasks()
except Exception as exception_error:
print(f"[DEBUG] Error updating status label: {exception_error}")
pass # Silent error handling