estos son mis scripts:
import firebase_admin
from firebase_admin import db
from firebase_admin import credentials
import threading
def login():
cred = credentials.Certificate("C:/Users/Angel/Desktop/N_Proyect/fire/New_Firebase.json")
firebase_admin.initialize_app(cred,{
'databaseURL':'https://new1-3b819.firebaseio.com/'
})
t = threading.Thread(target=login)
t.start()
t.join()
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5 import uic, QtCore
from Firebase_load import login
class Inicio(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
uic.loadUi("C:/Users/Angel/Desktop/N_Proyect/Interfaces/Inicio.ui",self)
self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.setAttribute(QtCore.Qt.WA_TranslucentBackground,True)
self.setAttribute(QtCore.Qt.WA_NoSystemBackground,False)
self.closed.clicked.connect(lambda:self.close())
self.minim.clicked.connect(lambda:self.showMinimized())
self.Maxim.clicked.connect(self.tamano_Principal)
self.timer = QtCore.QTimer(self)
self.timer.setInterval(1000)
self.timer.timeout.connect(self.mostrar_hora)
self.timer.start()
def tamano_Principal(self):
if self.isMaximized():
self.showNormal()
else:
self.showMaximized()
def mostrar_hora(self):
self.hora.setText(QtCore.QDateTime.currentDateTime().toString("hh:mm:ss AP"))
#app = QApplication([])
#i = Inicio()
#i.show()
#app.exec_()
from PyQt5.QtWidgets import QMainWindow, QApplication
from PyQt5 import uic, QtCore, Qt
import threading
from Inicio import *
from Firebase_load import *
class Principal(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
uic.loadUi("C:/Users/Angel/Desktop/N_Proyect/Interfaces/Login.ui",self)
self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.setAttribute(QtCore.Qt.WA_TranslucentBackground,True)
self.setAttribute(QtCore.Qt.WA_NoSystemBackground,False)
self.closed.clicked.connect(lambda:self.close())
t = threading.Thread(target=self.mostrar_hora)
t.start()
self.timer = QtCore.QTimer(self)
self.timer.setInterval(1000)
self.timer.timeout.connect(self.mostrar_hora)
self.timer.start()
def mostrar_hora(self):
self.hora.setText(QtCore.QDateTime.currentDateTime().toString("hh:mm:ss AP"))
class Dato(Principal):
def __init__(self):
Principal.__init__(self)
self.b_login.clicked.connect(self.validate_User)
def validate_User(self):
user = self.l_usuario.text()
if user == '':
self.l_status.setText('No se ingreso un usuario')
else:
ref = db.reference("/usuarios")
res = ref.get()
for key in res.items():
if key[1]['usuario'] == user:
ref_pass = key[0] #nombre
self.l_status.setText('')
self.validate_password(ref_pass)
break
else:
self.l_status.setText("El usuario "+ user +" no fue encontrado")
break
def validate_password(self,user):
password = self.l_password.text()
refp = db.reference("/usuarios/"+user)
res = refp.get()
for key in res.items():
if key[0] == 'password':
if key[1] == password:
self.other()
else:
self.l_password.setText('')
self.l_status.setText("Invalidate Password")
def other(self):
self.close()
self.inicio = Inicio()
self.inicio.user.setText(self.l_usuario.text())
self.inicio.show()
app = QApplication([])
p = Dato()
p.show()
app.exec_()
Archivos