-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI.py
76 lines (62 loc) · 1.95 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
76
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
# @Time : 2018/2/2 下午2:24
# @Auther : GaoMei
# @FileName : GUI.py
# @Software : PyCharm
# @Email : [email protected]
from tkinter import *
from tkinter import ttk
from tkFileDialog import *
import tkMessageBox
from login import Login
from deployGui import Deploy
from modules.GuiApi import gui
import assetsManagement
import warnings
warnings.filterwarnings('ignore')
def main(user,password):
def onLine():
sql = Login(user, password)
if sql.permissionValue() <= 1:
Deploy()
else:
tkMessageBox.showinfo(title='Permission Error',message="You don't have access.")
sql.close()
def ass():
sql = Login(user, password)
if sql.permissionValue() < 1:
assetsManagement.asset()
else:
tkMessageBox.showinfo(title='Permission Error',message="You don't have access.")
sql.close()
G = gui('Center Manage')
G.Button('Deploy',onLine,0,0,width=15)
G.Button("Assets Messagement",ass,1,0,width=15)
G.loop()
#tk = Tk()
#tk.title("Contorl Center")
#Button(tk,text="Deploy",command=onLine).grid(row=0,column=0,columnspan=2)
#Button(tk,text="Assets Management",command=ass).grid(row=1,column=0,columnspan=2)
#tk.mainloop()
def login():
def verifUser():
l = Login(user.get(),password.get())
reselt = l.verificationUser()
if reselt == 1:
main(user.get(),password.get())
else:
tkMessageBox.showinfo(title="Error", message="User or password is wrong")
l.close()
def verifUserEvent(event):
verifUser()
G = gui('Login')
G.Lable('User',0,0)
user = G.Entry(0,1,columnspan=2)
G.Lable('Password',1,0)
password = G.Entry(1,1,show='*',columnspan=2,key='<Return>',fun=verifUserEvent)
G.Button('Exit',quit,2,0)
G.Button('Login',verifUser,2,1)
G.loop()
if __name__ == '__main__':
login()