0% found this document useful (0 votes)
3 views3 pages

Mod

The document outlines a user interface for managing iDevice activation, including components like status labels, info frames, and buttons for copying device information and activating the device. It features functions to retrieve device info, auto-detect connected devices, and handle UI updates based on device connection status. Additionally, it includes an activation process with progress tracking and error handling for unregistered devices.

Uploaded by

daoudiabaas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Mod

The document outlines a user interface for managing iDevice activation, including components like status labels, info frames, and buttons for copying device information and activating the device. It features functions to retrieve device info, auto-detect connected devices, and handle UI updates based on device connection status. Additionally, it includes an activation process with progress tracking and error handling for unregistered devices.

Uploaded by

daoudiabaas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

="🔌 Plug your iDevice", font=("Poppins", 14, "bold"), text_color="gray")

status_label.pack(pady=15)

# Info frame (Hidden initially)


info_frame = ctk.CTkFrame(root)
info_frame.pack(pady=5, padx=15, fill="x")
info_frame.pack_forget() # Hide initially

labels = {}
copy_buttons = {}

label = ctk.CTkLabel(row_frame, text=f"{field}: Unknown", anchor="w",


font=("Poppins", 13))
label.pack(side="left", fill="x", expand=True)

copy_button = ctk.CTkButton(row_frame, text="Copy", width=50, height=20,


fg_color="#007bff",
hover_color="#0056b3", command=lambda f=field:
copy_text(f))
copy_button.pack(side="right", padx=5)

labels[field] = label
copy_buttons[field] = copy_button

# Activation button (Hidden initially)


activate_button = ctk.CTkButton(root, text="Activate iDevice", font=("Poppins", 14,
"bold"), height=40, width=250,
fg_color="#007bff", hover_color="#0056b3",
state="disabled")
activate_button.pack(pady=10)
activate_button.pack_forget() # Hide initially

# Progress bar (Hidden initially)


progress_bar = ctk.CTkProgressBar(root, width=280)
progress_bar.set(0)
progress_bar.pack(pady=5)
progress_bar.pack_forget() # Hide initially

progress_text = ctk.CTkLabel(root, text="", font=("Poppins", 12))


progress_text.pack(pady=5)
progress_text.pack_forget() # Hide initially

# Function to get device info


def get_device_info(key):
try:
return subprocess.check_output(f"ideviceinfo -k {key}",
shell=True).decode().strip()
except subprocess.CalledProcessError:
return "Unknown"

# Auto-detect device connection


def update_device_info():
try:
connected_devices = subprocess.check_output("idevice_id -l",
shell=True).decode().strip()
if connected_devices:
status_label.pack_forget()
info_frame.pack(pady=5, padx=15, fill="x")
activate_button.pack(pady=8)
progress_bar.pack(pady=5)
progress_text.pack(pady=5)

# Update device info


labels["Serial Number"].configure(text=f"Serial Number:
{get_device_info('SerialNumber')}")
labels["Product Type"].configure(text=f"Product Type:
{get_device_info('ProductType')}")
labels["IMEI"].configure(text=f"IMEI:
{get_device_info('InternationalMobileEquipmentIdentity')}")
labels["UDID"].configure(text=f"UDID:
{get_device_info('UniqueDeviceID')}")
labels["Activation State"].configure(text=f"Activation State:
{get_device_info('ActivationState')}")

activate_button.configure(state="normal")
else:
reset_ui()
except:
reset_ui()

root.after(1000, update_device_info)

# Reset UI when device is disconnected


def reset_ui():
info_frame.pack_forget()
activate_button.pack_forget()
progress_bar.pack_forget()
progress_text.pack_forget()
status_label.configure(text="🔌 Plug your iDevice", text_color="gray")
status_label.pack(pady=20)

# Activation Process
def activate_device():
activate_button.configure(state="disabled", text="Processing...")
progress_bar.set(0.1)
progress_text.configure(text="Checking Server ...")
root.update()

root.after(2000, lambda: update_progress(0.5, "Checking Registration ..."))


root.after(4000, check_registration)

def update_progress(value, text):


progress_bar.set(value)
progress_text.configure(text=text)

def check_registration():
serial_number = get_device_info("SerialNumber")

# Simulating an unregistered device (Replace with real verification logic)


is_registered = False

if not is_registered:
messagebox.showerror("Error", "This iDevice is not registered!!!")
status_label.configure(text=f"SN: {serial_number}\nNot Registered",
text_color="red")
activate_button.configure(state="normal", text="Activate iDevice")
progress_bar.set(0)
progress_text.configure(text="")
return

root.after(3000, final_activation)

def final_activation():
subprocess.run("idevicediagnostics restart", shell=True)
activate_button.configure(state="normal", text="Activate iDevice")
progress_bar.set(0)
progress_text.configure(text="")

# Start updating device info in the background


threading.Thread(target=update_device_info, daemon=True).start()

root.mainloop()

You might also like