wip
This commit is contained in:
@@ -11,7 +11,7 @@ import os
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from adb_manager import ADB_BINARY_PATH
|
||||
from src.adb_manager import ADB_BINARY_PATH
|
||||
|
||||
|
||||
def debug_large_transfer_output():
|
||||
@@ -117,7 +117,7 @@ def main():
|
||||
|
||||
def debug_original_adb_detection():
|
||||
"""Original ADB debugging functionality."""
|
||||
from adb_manager import ADBManager
|
||||
from src.adb_manager import ADBManager
|
||||
|
||||
print("=== ADB Device Detection Debug ===\n")
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@ Debug version of main window with console output
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, "src")
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from gui.main_window import AndroidFileHandlerGUI
|
||||
from src.main_window import AndroidFileHandlerGUI
|
||||
|
||||
|
||||
class DebugAndroidFileHandlerGUI(AndroidFileHandlerGUI):
|
||||
|
||||
@@ -5,8 +5,10 @@ Debug folder name parsing from ADB ls output
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
sys.path.insert(0, "src")
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from adb_manager import ADB_BINARY_PATH
|
||||
|
||||
|
||||
@@ -6,8 +6,10 @@ Test improved progress calculation for large transfers
|
||||
import sys
|
||||
import time
|
||||
import threading
|
||||
import os
|
||||
|
||||
sys.path.insert(0, "src")
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from gui.main_window import AndroidFileHandlerGUI
|
||||
|
||||
|
||||
@@ -6,8 +6,10 @@ Minimal test to verify progress updates work in modular GUI
|
||||
import sys
|
||||
import time
|
||||
import threading
|
||||
import os
|
||||
|
||||
sys.path.insert(0, "src")
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from gui.main_window import AndroidFileHandlerGUI
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ Debug test for progress callback in modular GUI
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, "src")
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from gui.main_window import AndroidFileHandlerGUI
|
||||
|
||||
|
||||
@@ -6,8 +6,10 @@ Test successive transfers with modular GUI
|
||||
import sys
|
||||
import time
|
||||
import threading
|
||||
import os
|
||||
|
||||
sys.path.insert(0, "src")
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from gui.main_window import AndroidFileHandlerGUI
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ import os
|
||||
import time
|
||||
import threading
|
||||
|
||||
sys.path.insert(0, "src")
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from gui.main_window import AndroidFileHandlerGUI
|
||||
|
||||
|
||||
+14
-10
@@ -4,41 +4,45 @@ Test script to debug folder parsing
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, 'src')
|
||||
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from adb_manager import ADBManager
|
||||
|
||||
|
||||
def main():
|
||||
adb = ADBManager()
|
||||
print("Testing folder parsing...")
|
||||
|
||||
result = adb.run_adb_command(['shell', 'ls', '-la', '/sdcard/'])
|
||||
|
||||
result = adb.run_adb_command(["shell", "ls", "-la", "/sdcard/"])
|
||||
print(f"Return code: {result[2]}")
|
||||
|
||||
lines = result[0].strip().split('\n')
|
||||
|
||||
lines = result[0].strip().split("\n")
|
||||
print(f"Total lines: {len(lines)}")
|
||||
print("\nFirst 10 lines:")
|
||||
for i, line in enumerate(lines[:10]):
|
||||
print(f" {i}: {repr(line)}")
|
||||
|
||||
|
||||
print("\nParsing directories:")
|
||||
folders = []
|
||||
for i, line in enumerate(lines):
|
||||
if line.startswith('d'):
|
||||
if line.startswith("d"):
|
||||
parts = line.split()
|
||||
print(f" Line {i}: {len(parts)} parts")
|
||||
if len(parts) >= 8: # Changed from 9 to 8
|
||||
folder_name = ' '.join(parts[7:]) # Changed from 8 to 7
|
||||
folder_name = " ".join(parts[7:]) # Changed from 8 to 7
|
||||
print(f" Folder name: {repr(folder_name)}")
|
||||
if folder_name not in ['.', '..']:
|
||||
if folder_name not in [".", ".."]:
|
||||
folders.append(folder_name)
|
||||
print(f" ✅ Added: {repr(folder_name)}")
|
||||
else:
|
||||
print(f" ❌ Skipped: {repr(folder_name)}")
|
||||
|
||||
|
||||
print(f"\nFinal folders list ({len(folders)} items):")
|
||||
for folder in sorted(folders):
|
||||
print(f" - {repr(folder)}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -5,7 +5,8 @@ Test script to verify progress callback is working
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, "src")
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from adb_manager import ADBManager
|
||||
import time
|
||||
|
||||
@@ -8,7 +8,8 @@ import os
|
||||
import time
|
||||
import threading
|
||||
|
||||
sys.path.insert(0, "src")
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from gui.main_window import AndroidFileHandlerGUI
|
||||
|
||||
|
||||
@@ -6,7 +6,13 @@ import sys
|
||||
import os
|
||||
import time
|
||||
|
||||
sys.path.insert(0, "src")
|
||||
import sys
|
||||
import time
|
||||
import threading
|
||||
import os
|
||||
|
||||
# Add the src directory to Python path for imports
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "src"))
|
||||
|
||||
from adb_manager import ADBManager
|
||||
|
||||
|
||||
+44
-16
@@ -26,9 +26,16 @@ except ImportError:
|
||||
is_adb_available,
|
||||
)
|
||||
|
||||
from .progress_handler import ProgressHandler
|
||||
from .windows_browser import WindowsAndroidBrowser
|
||||
from .linux_browser import LinuxAndroidBrowser
|
||||
try:
|
||||
# Try relative imports first
|
||||
from .progress_handler import ProgressHandler
|
||||
from .windows_browser import WindowsAndroidBrowser
|
||||
from .linux_browser import LinuxAndroidBrowser
|
||||
except ImportError:
|
||||
# Fall back to direct imports
|
||||
from progress_handler import ProgressHandler
|
||||
from windows_browser import WindowsAndroidBrowser
|
||||
from linux_browser import LinuxAndroidBrowser
|
||||
|
||||
|
||||
class AndroidFileHandlerGUI(tk.Tk):
|
||||
@@ -253,17 +260,25 @@ class AndroidFileHandlerGUI(tk.Tk):
|
||||
self.check_device_connection()
|
||||
|
||||
def show_enable_debugging_instructions(self):
|
||||
"""Show instructions for enabling USB debugging."""
|
||||
"""Show instructions to connect device, enable file transfer, and to enable USB debugging."""
|
||||
msg = (
|
||||
"Additionally, ensure your device is set to 'File Transfer' mode:\n"
|
||||
"1. When you connect your device, swipe down to check the notification panel.\n"
|
||||
"2. Look for a 'USB' notification that will tell you what mode the device is in (usually 'Charging over USB') and tap it.\n"
|
||||
"3. Select 'File Transfer' or 'MTP' mode.\n\n"
|
||||
"Please ensure your Android device is securely connected to the computer at both ends.\n\n"
|
||||
"To enable USB debugging:\n"
|
||||
"1. Open Settings → About phone.\n"
|
||||
"2. Tap 'Build number' seven times to unlock Developer Options.\n"
|
||||
"3. Go back to Settings → Developer Options.\n"
|
||||
"4. Enable 'USB debugging'.\n"
|
||||
"5. Connect your phone via USB and accept the prompt to allow debugging.\n\n"
|
||||
"After enabling, click 'Recheck for connected Android device' to try again."
|
||||
"1. Connect your device to the computer via USB.\n"
|
||||
"2. Open Settings → About phone.\n"
|
||||
"3. Tap 'Build number' seven times to unlock Developer Options.\n"
|
||||
"4. Go back to Settings → Developer Options.\n"
|
||||
"5. Enable 'USB debugging'.\n"
|
||||
"6. Connect your phone via USB and accept the prompt to allow debugging.\n\n"
|
||||
"After enabling USB debugging, please click the 'Recheck for connected Android device' button to try again."
|
||||
)
|
||||
result = messagebox.showinfo(
|
||||
"Check device connection and enable USB Debugging", msg
|
||||
)
|
||||
result = messagebox.showinfo("Enable USB Debugging", msg)
|
||||
# After user clicks OK, ensure recheck button is enabled
|
||||
self.after(0, self._enable_recheck_after_dialog)
|
||||
|
||||
@@ -280,8 +295,8 @@ class AndroidFileHandlerGUI(tk.Tk):
|
||||
def _show_debugging_reminder_ui(self):
|
||||
"""Internal method to show debugging reminder on main thread."""
|
||||
msg = (
|
||||
"Transfer completed.\n\n"
|
||||
"For security, disable USB debugging when done:\n"
|
||||
"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)
|
||||
@@ -290,10 +305,23 @@ class AndroidFileHandlerGUI(tk.Tk):
|
||||
"""Start the file transfer operation."""
|
||||
# Double-check device is still connected before starting transfer
|
||||
if not self.device_connected:
|
||||
messagebox.showerror(
|
||||
"No Device",
|
||||
"No Android device is connected. Please connect your device and enable USB debugging.",
|
||||
msg = (
|
||||
"Android device appears to have been disconnected and/or USB debugging is disabled.\n"
|
||||
"Please ensure your Android device is securely connected to the computer at both ends.\n\n"
|
||||
"Additionally, ensure your device is set to 'File Transfer' mode:\n"
|
||||
"1. When you connect your device, swipe down to check the notification panel.\n"
|
||||
"2. Look for a 'USB' notification that will tell you what mode the device is in (usually 'Charging over USB') and tap it.\n"
|
||||
"3. Select 'File Transfer' or 'MTP' mode.\n\n"
|
||||
"To enable USB debugging:\n"
|
||||
"1. Connect your device to the computer via USB.\n"
|
||||
"2. Open Settings → About phone.\n"
|
||||
"3. Tap 'Build number' seven times to unlock Developer Options.\n"
|
||||
"4. Go back to Settings → Developer Options.\n"
|
||||
"5. Enable 'USB debugging'.\n"
|
||||
"6. Connect your phone via USB and accept the prompt to allow debugging.\n\n"
|
||||
"After enabling USB debugging, please click the 'Recheck for connected Android device' button to try again."
|
||||
)
|
||||
messagebox.showerror("No Android Device Detected", msg)
|
||||
self._switch_to_recheck_mode()
|
||||
return
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ Provides Android filesystem browsing capabilities for Windows using ADB.
|
||||
|
||||
import threading
|
||||
import tkinter as tk
|
||||
from tkinter import messagebox, ttk, simpledialog
|
||||
from tkinter import messagebox, ttk
|
||||
|
||||
|
||||
class WindowsAndroidBrowser:
|
||||
@@ -404,23 +404,9 @@ class WindowsAndroidBrowser:
|
||||
else:
|
||||
messagebox.showwarning("No Selection", "Please select a valid folder.")
|
||||
|
||||
def enter_custom_path():
|
||||
"""Allow user to enter a custom path."""
|
||||
browser_window.destroy()
|
||||
custom_path = simpledialog.askstring(
|
||||
"Custom Path",
|
||||
"Enter custom Android folder path:",
|
||||
initialvalue="/sdcard/",
|
||||
)
|
||||
if custom_path:
|
||||
self.remote_path_var.set(custom_path.strip())
|
||||
|
||||
tk.Button(
|
||||
button_frame, text="Select This Folder", command=select_current_folder
|
||||
).pack(side="left", padx=5)
|
||||
tk.Button(
|
||||
button_frame, text="Enter Custom Path", command=enter_custom_path
|
||||
).pack(side="left", padx=5)
|
||||
tk.Button(button_frame, text="Cancel", command=browser_window.destroy).pack(
|
||||
side="left", padx=5
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user