-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
123 lines (93 loc) · 3.62 KB
/
main.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
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
# This is a sample Python script.
# Press Mayús+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import tkinter as tk
from tkinter import ttk
from Login import Login
from MenuTester import MenuTester
from MenuAdmin import MenuAdmin
from Resultado import Resultado
from GestionEspecies import GestionEspecies
from GestionUsuarios import GestionUsuarios
from AgregarUsuario import AgregarUsuario
from AgregarEspecie import AgregarEspecie
from ReportesTesting import ReportesTesting
from ConexionBD import *
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
class Main(tk.Tk):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.title("SpiderWeb v2.0")
master = tk.Frame(self)
master.pack()
self.everyFrame = dict()
self.tester = ""
for F in (Resultado, Login, MenuTester, MenuAdmin, ReportesTesting,
GestionEspecies, GestionUsuarios, AgregarUsuario, AgregarEspecie):
print("*")
frame = F(master, self)
self.everyFrame[F] = frame
frame.grid(row = 0, column = 0, sticky = "nsew")
self.showFrame(Login)
def showAgregarUser(self):
print("Mostrando ventana de agregar usuario")
self.showFrame(AgregarUsuario)
def showResultado(self, path):
pathImg = self.everyFrame[MenuTester].file_name
frame = self.everyFrame[Resultado]
frame.setPath(pathImg)
frame.tkraise()
def showMenuTester(self):
print("Mostrando ventana de tester")
self.showFrame(MenuTester)
def showMenuAdmin(self):
print("Mostrando ventana de admin")
self.showFrame(MenuAdmin)
def showFUsers(self):
print("Mostrando ventana de gestión de usuarios")
self.showFrame(GestionUsuarios)
def showFSpiders(self):
print("Mostrando ventana de gestión de especies")
self.showFrame(GestionEspecies)
def showTestings(self):
print("Mostrando ventana de reportes de testing")
self.showFrame(ReportesTesting)
def showMenuTestings(self):
print("Mostrando ventana de reportes de testing")
#self.showFrame(ReportesTesting)
def showAddEspecie(self):
print("Mostrando ventana de reportes de testing")
self.showFrame(AgregarEspecie)
def showInicio(self):
print("Mostrado ventana de inicio")
self.showFrame(Login)
def showFrame(self, contenedorLlamado):
print("Mostrando Frames")
frame = self.everyFrame[contenedorLlamado]
frame.tkraise()
def iniciarSesion(self, usuario, password):
print(usuario)
print(password)
tipo = consultar_usuario(usuario, password)
if (tipo == 2):
print("Consulta correcta: " + str(2) )
self.showFrame( MenuAdmin )
elif (tipo == 1):
print("Consulta correcta: " + str(1) )
self.showFrame( MenuTester)
self.everyFrame.get(MenuTester).setUsuario(usuario)
self.setTester(usuario)
else:
print("Consulta incorecta" + str(tipo) )
mb.showerror("Error de ingreso", "Usuario o contraseña incorrecta")
def setTester(self, nombreTester):
self.tester = nombreTester
def getTester(self):
return self.tester
if __name__ == '__main__':
print_hi('PyCharm')
root = Main()
root.mainloop()