-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui.py
More file actions
203 lines (165 loc) · 6.03 KB
/
gui.py
File metadata and controls
203 lines (165 loc) · 6.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
from tkinter import *
from tkinter import messagebox
from tkinter.simpledialog import askstring
from tkinter.filedialog import askopenfile
import os
import subprocess
import threading
top = Tk()
top.title("adb GUI")
top.iconbitmap('adb.ico')
my_list = []
top.geometry("1200x500")
top.configure(bg='blue')
def update_listbox():
listbox.delete(0, END)
for element in my_list:
listbox.insert(END, element)
listbox = Listbox(top, height=15, width=100)
listbox.pack()
listbox.place(x=50, y=0)
listb2 = Listbox(top, height=13, width=100)
listb2.pack()
listb2.place(x=50, y=280)
def onbuttonclick():
filename = askopenfile()
if filename:
name = filename.name
my_list.append(name)
update_listbox()
def delete_last():
if my_list:
my_list.pop()
update_listbox()
else:
messagebox.showinfo("Error", "Nothing to delete")
def install():
if len(my_list) == 0:
messagebox.showinfo("Error", "Nothing to install")
else:
for element in my_list:
t = threading.Thread(target=install_apk, args=(element,))
t.start()
def install_apk(element):
command = ("adb", "install", element)
try:
result = subprocess.check_output(command, shell=True, text=True)
lines = result.split('\n')
for line in lines:
listb2.insert(END, line)
except subprocess.CalledProcessError as e:
listb2.insert(END, f"Error: {e.output}")
def reboot_recovery():
t = threading.Thread(target=reboot_recovery_thread)
t.start()
def reboot_recovery_thread():
try:
result = subprocess.check_output(["adb", "reboot", "recovery"], shell=True, text=True)
listb2.insert(END, result)
except subprocess.CalledProcessError as e:
listb2.insert(END, f"Error: {e.output}")
def reboot_fastboot():
t = threading.Thread(target=reboot_fastboot_thread)
t.start()
def reboot_fastboot_thread():
try:
result = subprocess.check_output(["adb", "reboot", "bootloader"], shell=True, text=True)
listb2.insert(END, result)
except subprocess.CalledProcessError as e:
listb2.insert(END, f"Error: {e.output}")
def reboot_download():
t = threading.Thread(target=reboot_download_thread)
t.start()
def reboot_download_thread():
try:
result = subprocess.check_output(["adb", "reboot", "download"], shell=True, text=True)
listb2.insert(END, result)
except subprocess.CalledProcessError as e:
listb2.insert(END, f"Error: {e.output}")
def send_adb_command():
command = command_entry_adb.get()
t = threading.Thread(target=send_adb_command_thread, args=(command,))
t.start()
def send_adb_command_thread(command):
try:
result = subprocess.check_output(["adb", "shell", command], shell=True, text=True)
listb2.insert(END, result)
except subprocess.CalledProcessError as e:
listb2.insert(END, f"Error: {e.output}")
def send_fastboot_command():
command = command_entry_fastboot.get()
t = threading.Thread(target=send_fastboot_command_thread, args=(command,))
t.start()
def send_fastboot_command_thread(command):
try:
result = subprocess.check_output(["fastboot", command], shell=True, text=True)
listb2.insert(END, result)
except subprocess.CalledProcessError as e:
listb2.insert(END, f"Error: {e.output}")
def send_adb_shell_command():
command = command_entry_adb_shell.get()
t = threading.Thread(target=send_adb_shell_command_thread, args=(command,))
t.start()
def send_adb_shell_command_thread(command):
try:
result = subprocess.check_output(["adb", command], shell=True, text=True)
listb2.insert(END, result)
except subprocess.CalledProcessError as e:
listb2.insert(END, f"Error: {e.output}")
B = Button(top, text="Choose File", command=onbuttonclick)
B.place(x=315, y=250)
B.configure(bg='yellow')
D = delete_button = Button(top, text="Delete Last", command=delete_last)
delete_button.pack()
D.configure(bg = 'red')
D.place(x=200, y=250)
I = install_button = Button(top, text="Install", command=install)
install_button.pack()
I.configure(bg='green')
I.place(x=270, y=250)
R = reboot_button = Button(top, text="Reboot Recovery", command=reboot_recovery)
reboot_button.pack()
R.configure(bg='orange')
R.place(x=400, y=250)
F = fastboot_button = Button(top, text="Reboot Fastboot", command=reboot_fastboot)
fastboot_button.pack()
F.configure(bg='purple')
F.place(x=520, y=250)
D = download_button = Button(top, text="Reboot Download", command=reboot_download)
download_button.pack()
D.configure(bg='blue')
D.place(x=80, y=250)
command_label_adb = Label(top, text="Enter adb shell command:")
command_label_adb.pack()
command_label_adb.place(x=800, y=230)
command_label_adb.configure(bg='blue')
command_entry_adb = Entry(top, width=50)
command_entry_adb.pack()
command_entry_adb.place(x=790, y=250)
send_button_adb = Button(top, text="Send Command", command=send_adb_command)
send_button_adb.pack()
send_button_adb.configure(bg='gray')
send_button_adb.place(x=680, y=245)
command_label_fastboot = Label(top, text="Enter fastboot command:")
command_label_fastboot.pack()
command_label_fastboot.place(x=800, y=330)
command_label_fastboot.configure(bg='blue')
command_entry_fastboot = Entry(top, width=50)
command_entry_fastboot.pack()
command_entry_fastboot.place(x=790, y=350)
send_button_fastboot = Button(top, text="Send Command", command=send_fastboot_command)
send_button_fastboot.pack()
send_button_fastboot.configure(bg='gray')
send_button_fastboot.place(x=680, y=345)
command_label_adb_shell = Label(top, text="Enter adb command:")
command_label_adb_shell.pack()
command_label_adb_shell.place(x=800, y=430)
command_label_adb_shell.configure(bg='blue')
command_entry_adb_shell = Entry(top, width=50)
command_entry_adb_shell.pack()
command_entry_adb_shell.place(x=790, y=450)
send_button_adb_shell = Button(top, text="Send Command", command=send_adb_shell_command)
send_button_adb_shell.pack()
send_button_adb_shell.configure(bg='gray')
send_button_adb_shell.place(x=680, y=445)
top.mainloop()