main window refactor
This commit is contained in:
+11
-12
@@ -11,11 +11,13 @@ from tkinter import messagebox, ttk
|
||||
class AndroidFileBrowser:
|
||||
"""Android filesystem browser for Windows using ADB."""
|
||||
|
||||
def __init__(self, parent_window, adb_manager, remote_path_var, path_changed_callback=None):
|
||||
def __init__(self, parent_window, adb_manager, path_callback=None):
|
||||
self.parent = parent_window
|
||||
self.adb_manager = adb_manager
|
||||
self.remote_path_var = remote_path_var
|
||||
self.path_changed_callback = path_changed_callback
|
||||
self.path_callback = path_callback
|
||||
|
||||
# Show the browser immediately
|
||||
self.show_browser()
|
||||
|
||||
def show_browser(self, direction="pull"):
|
||||
"""Show a browsable Android folder tree.
|
||||
@@ -469,25 +471,22 @@ class AndroidFileBrowser:
|
||||
return
|
||||
else:
|
||||
# It's a file and we're in pull mode - select the file path directly
|
||||
self.remote_path_var.set(item_path)
|
||||
if self.path_changed_callback:
|
||||
self.path_changed_callback()
|
||||
if self.path_callback:
|
||||
self.path_callback(item_path)
|
||||
browser_window.destroy()
|
||||
return
|
||||
elif len(item_values) >= 2 and item_values[1] == "folder":
|
||||
# It's a folder - select the folder path directly
|
||||
self.remote_path_var.set(item_path)
|
||||
if self.path_changed_callback:
|
||||
self.path_changed_callback()
|
||||
if self.path_callback:
|
||||
self.path_callback(item_path)
|
||||
browser_window.destroy()
|
||||
return
|
||||
|
||||
# Fallback: use current path (for backwards compatibility or when no specific item is selected)
|
||||
current_path = current_path_var.get()
|
||||
if current_path and current_path.strip():
|
||||
self.remote_path_var.set(current_path)
|
||||
if self.path_changed_callback:
|
||||
self.path_changed_callback()
|
||||
if self.path_callback:
|
||||
self.path_callback(current_path)
|
||||
browser_window.destroy()
|
||||
else:
|
||||
selection_type = "folder" if direction == "push" else "file or folder"
|
||||
|
||||
Reference in New Issue
Block a user