Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5.QtWidgets import QMainWindow, QApplication
- from PyQt5 import QtCore
- from PyQt5 import uic
- from PyQt5.Qt import QMovie
- from FirebaseLogin import *
- from contraInicio import ContraInicioC
- from Principal import PrincipalC
- from MostrarDatosTabla import mostararDatos
- from CrearFirebase import crear_tabla
- from sucursalInicio import sucursal
- import sqlite3
- import threading
- class LoginC(QMainWindow):
- def __init__(self):
- QMainWindow.__init__(self)
- uic.loadUi("Interfaz/Login.ui",self)
- self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
- self.l_permiso.setAttribute(QtCore.Qt.WA_NoMousePropagation)
- self.l_sucursal.setAttribute(QtCore.Qt.WA_NoMousePropagation)
- self.l_close.clicked.connect(self.close)
- self.contraseña = ContraInicioC()
- self.principal = PrincipalC()
- self.l_entrar.clicked.connect(self.setDataPrincipal)
- self.l_permiso.currentIndexChanged.connect(lambda:self.cambioPermiso(self.l_permiso.currentText()))
- self.l_permiso.setCurrentText("Caja")
- self.suc = sucursal
- self.l_sucursal.setCurrentText(self.suc)
- #self.principal.pc_fecha.setDate(QtCore.QDate.currentDate())
- @QtCore.pyqtSlot(str)
- def cambioPermiso(self,permiso):
- if permiso == "Administrador":
- self.l_sucursal.setEnabled(True)
- else:
- self.l_sucursal.setEnabled(False)
- def setDataPrincipal(self):
- t = threading.Thread(target=self.anima)
- t.start()
- self.estado = 0
- fechaActual = QtCore.QDate.currentDate().toPyDate()
- ref = db.reference("/"+str(fechaActual))
- ret = ref.get()
- if ret == None:
- print("creada")
- crear_tabla(str(fechaActual))
- self.estado = 0
- if self.l_permiso.currentIndex()==1:
- self.principal.pc_sucursal.setEnabled(False)
- self.principal.pc_fecha.setDate(QtCore.QDate.currentDate())
- self.principal.pc_sucursal.setCurrentText(self.l_sucursal.currentText())
- self.principal.show()
- else:
- print("value")
- #self.contraseña.datos(self.l_permiso.currentText(), "Matutino", self.l_sucursal.currentText(),self.estado,self.principal.p_referencia)
- self.contraseña.permiso = self.l_permiso.currentText()
- self.contraseña.turno = "Matutino"
- self.contraseña.sucursal = self.l_sucursal.currentText()
- self.contraseña.estado = self.estado
- self.contraseña.referencia = self.principal.p_referencia
- self.contraseña.show()
- else:
- self.estado =1
- print("actualizada")
- #mostararDatos(str(fechaActual),self.l_sucursal.currentText(),"Matutino",self.principal.saldo,self.principal.tablaM,self.principal.inventario,self.principal.p_referencia)
- if self.l_permiso.currentIndex()==1:
- self.principal.pc_sucursal.setEnabled(False)
- self.principal.pc_fecha.setDate(QtCore.QDate.currentDate())
- self.principal.pc_sucursal.setCurrentText(self.l_sucursal.currentText())
- self.principal.show()
- else:
- #self.contraseña.datos(self.l_permiso.currentText(), "Matutino", self.l_sucursal.currentText(),self.estado,self.principal.p_referencia)
- self.contraseña.permiso = self.l_permiso.currentText()
- self.contraseña.turno = "Matutino"
- self.contraseña.sucursal = self.l_sucursal.currentText()
- self.contraseña.estado = self.estado
- self.contraseña.referencia = self.principal.p_referencia
- self.contraseña.show()
- self.principal.o_sucursal.setText(self.l_sucursal.currentText())
- self.principal.o_turno.setText("Matutino")
- self.principal.o_permiso.setText(self.l_permiso.currentText())
- #self.principal.pc_sucursal.setCurrentText(self.l_sucursal.currentText())
- #self.principal.pc_fecha.setDate(QtCore.QDate.currentDate())
- self.close()
- def mousePressEvent(self,event):
- if event.button() == QtCore.Qt.LeftButton:
- self.dragPosition = event.globalPos() - self.frameGeometry().topLeft()
- event.accept()
- def mouseMoveEvent(self,event):
- if event.buttons() == QtCore.Qt.LeftButton:
- self.move(event.globalPos() - self.dragPosition)
- event.accept()
- def anima(self):
- self.movie = QMovie("uno.gif")
- self.label.setMovie(self.movie)
- self.movie.start()
- app = QApplication([])
- l = LoginC()
- l.show()
- app.exec_()
- <?xml version="1.0" encoding="UTF-8"?>
- <ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>650</width>
- <height>370</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>MainWindow</string>
- </property>
- <widget class="QWidget" name="centralwidget">
- <widget class="QLabel" name="label">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>650</width>
- <height>370</height>
- </rect>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- <widget class="QPushButton" name="l_close">
- <property name="geometry">
- <rect>
- <x>620</x>
- <y>0</y>
- <width>31</width>
- <height>23</height>
- </rect>
- </property>
- <property name="font">
- <font>
- <pointsize>9</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="styleSheet">
- <string notr="true">QPushButton#l_close{
- background:none;
- border:0px;
- color:grey;
- }
- QPushButton#l_close:hover{
- color:red;
- }</string>
- </property>
- <property name="text">
- <string>X</string>
- </property>
- </widget>
- <widget class="QLabel" name="lsucursal">
- <property name="geometry">
- <rect>
- <x>380</x>
- <y>330</y>
- <width>51</width>
- <height>22</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">color:grey;
- background:none;</string>
- </property>
- <property name="text">
- <string>Sucursal:</string>
- </property>
- </widget>
- <widget class="QLabel" name="la">
- <property name="geometry">
- <rect>
- <x>220</x>
- <y>330</y>
- <width>51</width>
- <height>22</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">color:grey;
- background:none;</string>
- </property>
- <property name="text">
- <string>Permisos</string>
- </property>
- </widget>
- <widget class="QComboBox" name="l_permiso">
- <property name="geometry">
- <rect>
- <x>268</x>
- <y>330</y>
- <width>91</width>
- <height>22</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">QComboBox#l_permiso{
- background:none;
- border:0px;
- border-bottom: 1px solid lightblue;
- color:#05839C;
- }
- QComboBox QAbstractItemView
- {
- border:0px;
- background:white;
- color: grey;
- }
- QComboBox#l_permiso::drop-down
- {
- subcontrol-origin: padding;
- subcontrol-position: top right;
- width: 15px;
- color: white;
- border-left-width: 0px;
- border-left-color: darkgray;
- border-left-style: solid; /* just a single line */
- border-top-right-radius: 3px; /* same radius as the QComboBox */
- border-bottom-right-radius: 3px;
- padding-left: 10px;
- }</string>
- </property>
- <item>
- <property name="text">
- <string>Administrador</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Caja</string>
- </property>
- </item>
- </widget>
- <widget class="QComboBox" name="l_sucursal">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="geometry">
- <rect>
- <x>440</x>
- <y>330</y>
- <width>69</width>
- <height>22</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">QComboBox#l_sucursal{
- background:none;
- border:0px;
- border-bottom: 1px solid lightblue;
- color:#05839C;
- }
- QComboBox QAbstractItemView
- {
- border:0px;
- background:white;
- color: grey;
- }
- QComboBox#l_sucursal::drop-down
- {
- subcontrol-origin: padding;
- subcontrol-position: top right;
- width: 15px;
- color: white;
- border-left-width: 0px;
- border-left-color: darkgray;
- border-left-style: solid; /* just a single line */
- border-top-right-radius: 3px; /* same radius as the QComboBox */
- border-bottom-right-radius: 3px;
- padding-left: 10px;
- }</string>
- </property>
- <item>
- <property name="text">
- <string>Exxe 1</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Exxe 3</string>
- </property>
- </item>
- </widget>
- <widget class="QPushButton" name="l_entrar">
- <property name="geometry">
- <rect>
- <x>550</x>
- <y>330</y>
- <width>75</width>
- <height>22</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">QPushButton#l_entrar{
- background:#41CD52;
- border:0px;
- color:white;
- }
- QPushButton#l_entrar:pressed{
- border-bottom:2px solid green;
- }
- </string>
- </property>
- <property name="text">
- <string>Entrar</string>
- </property>
- </widget>
- </widget>
- </widget>
- <resources/>
- <connections/>
- </ui>
- t = threading.Thread(target=self.anima)
- t.start()
- self.anima()
- from PyQt5.QtWidgets import QMainWindow, QApplication
- from PyQt5 import QtCore
- from PyQt5 import uic
- from PyQt5.Qt import QMovie
- class LoginC(QMainWindow):
- def __init__(self):
- QMainWindow.__init__(self)
- self.ui = uic.loadUi("main.ui",self) //Cambia esto por tu ubicacion del .ui
- self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
- self.ui.l_permiso.setAttribute(QtCore.Qt.WA_NoMousePropagation)
- self.ui.l_sucursal.setAttribute(QtCore.Qt.WA_NoMousePropagation)
- self.ui.l_entrar.clicked.connect(self.anima)
- self.ui.l_close.clicked.connect(self.close)
- def anima(self):
- self.movie = QMovie("uno.gif")
- self.label.setMovie(self.movie)
- self.movie.start()
- app = QApplication([])
- l = LoginC()
- l.show()
- app.exec_()
Add Comment
Please, Sign In to add comment