/
gui.py
75 lines (62 loc) · 1.73 KB
/
gui.py
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
import os
import subprocess
from Tkinter import *
from tkMessageBox import *
import webbrowser
import setup
import server
#+=========GUI===========GUI============GUI===========+
#---Window---#
#make window
window = Tk()
#change title
window.title("Voyage Exceute")
#change size
window.geometry("200x200")
#---Commands---#
#Install API command
def install_api():
'''
()-->None
allow using python connect to CMD and run the sh script to install all api
using pip
'''
setup.install()
showinfo("congratulation", "All Api sucessfully install")
def run():
'''
()-->None
allow using python connect to CMD and run the sh script to open the django
server
'''
config = server.configuration()['server']
server.run_server(config['ip_address'], config['port'])
showinfo("Notice", "Server on!")
def close():
'''
()-->None
allow using python connect to CMD and run the sh script to close the django
server
'''
config = server.configuration()['server']
server.stop_server(config['port'])
showinfo("Notice", "Server off!")
def open_web():
'''
()-->None
open the django web UI
'''
config = server.configuration()['server']
webbrowser.open(format('http://%s:%i/admin' % (config['ip_address'],
config['port'])))
def quit_app():
window.destroy()
#---Widgets---#
#buttons
Button(window, text="Install", command=install_api).pack()
Button(window, text="Run Server", command=run).pack()
Button(window, text="Close Server", command=close).pack()
Button(window, text="Open Web", command=open_web).pack()
Button(text='Quit', command=quit_app).pack()
#+===================GUI END=====================+
window.mainloop()