Esempio n. 1
0
    def signup_check(self):
        print("signup button is clicked")

        self.signupWindow = QtWidgets.QDialog()
        self.ui = Ui_Signup()
        self.ui.setupUi(self.signupWindow)
        self.signupWindow.show()
Esempio n. 2
0
 def signUpShow(self):
     self.signUpWindow = QtWidgets.QDialog()
     self.ui = Ui_Signup()
     self.ui.setupUi(self.signUpWindow)
     self.signUpWindow.show()
Esempio n. 3
0
 def InterfaceShow(self):
     self.Interface = QtWidgets.QMainWindow()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self.Interface)
     self.Interface.show()
Esempio n. 4
0
class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(589, 373)
        Dialog.setStyleSheet("")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setMinimumSize(QtCore.QSize(149, 79))
        self.label.setMaximumSize(QtCore.QSize(149, 79))
        font = QtGui.QFont()
        font.setPointSize(18)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")
        self.horizontalLayout.addWidget(self.label)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        spacerItem2 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_5.addItem(spacerItem2)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        spacerItem3 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem3)
        self.u_name_label = QtWidgets.QLabel(Dialog)
        self.u_name_label.setMinimumSize(QtCore.QSize(94, 24))
        self.u_name_label.setMaximumSize(QtCore.QSize(94, 24))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(False)
        font.setWeight(50)
        self.u_name_label.setFont(font)
        self.u_name_label.setAlignment(QtCore.Qt.AlignCenter)
        self.u_name_label.setObjectName("u_name_label")
        self.horizontalLayout_2.addWidget(self.u_name_label)
        spacerItem4 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem4)
        self.uname_lineEdit = QtWidgets.QLineEdit(Dialog)
        self.uname_lineEdit.setMinimumSize(QtCore.QSize(128, 24))
        self.uname_lineEdit.setMaximumSize(QtCore.QSize(128, 24))
        self.uname_lineEdit.setObjectName("uname_lineEdit")
        self.horizontalLayout_2.addWidget(self.uname_lineEdit)
        spacerItem5 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem5)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        spacerItem6 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_4.addItem(spacerItem6)
        self.pass_label = QtWidgets.QLabel(Dialog)
        self.pass_label.setMinimumSize(QtCore.QSize(94, 24))
        self.pass_label.setMaximumSize(QtCore.QSize(94, 24))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.pass_label.setFont(font)
        self.pass_label.setAlignment(QtCore.Qt.AlignCenter)
        self.pass_label.setObjectName("pass_label")
        self.horizontalLayout_4.addWidget(self.pass_label)
        spacerItem7 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_4.addItem(spacerItem7)
        self.pass_lineEdit = QtWidgets.QLineEdit(Dialog)
        self.pass_lineEdit.setMinimumSize(QtCore.QSize(128, 24))
        self.pass_lineEdit.setMaximumSize(QtCore.QSize(128, 24))
        self.pass_lineEdit.setEchoMode(QtWidgets.QLineEdit.Password)
        self.pass_lineEdit.setObjectName("pass_lineEdit")
        self.horizontalLayout_4.addWidget(self.pass_lineEdit)
        spacerItem8 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_4.addItem(spacerItem8)
        self.verticalLayout.addLayout(self.horizontalLayout_4)
        self.horizontalLayout_5.addLayout(self.verticalLayout)
        spacerItem9 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_5.addItem(spacerItem9)
        self.verticalLayout_2.addLayout(self.horizontalLayout_5)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        spacerItem10 = QtWidgets.QSpacerItem(40, 20,
                                             QtWidgets.QSizePolicy.Expanding,
                                             QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem10)
        self.splitter_3 = QtWidgets.QSplitter(Dialog)
        self.splitter_3.setOrientation(QtCore.Qt.Horizontal)
        self.splitter_3.setObjectName("splitter_3")
        self.login_btn = QtWidgets.QPushButton(self.splitter_3)
        self.login_btn.setMinimumSize(QtCore.QSize(90, 28))
        self.login_btn.setMaximumSize(QtCore.QSize(90, 28))
        self.login_btn.setObjectName("login_btn")
        self.signup_btn = QtWidgets.QPushButton(self.splitter_3)
        self.signup_btn.setMinimumSize(QtCore.QSize(90, 28))
        self.signup_btn.setMaximumSize(QtCore.QSize(90, 28))
        self.signup_btn.setObjectName("signup_btn")
        self.horizontalLayout_3.addWidget(self.splitter_3)
        spacerItem11 = QtWidgets.QSpacerItem(40, 20,
                                             QtWidgets.QSizePolicy.Expanding,
                                             QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem11)
        self.verticalLayout_2.addLayout(self.horizontalLayout_3)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        #Login and Signup
        self.login_btn.clicked.connect(lambda: self.Login_btn(0))
        self.signup_btn.clicked.connect(lambda: self.Login_btn(1))

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
        self.label.setText(_translate("Dialog", "Login Form"))
        self.u_name_label.setText(_translate("Dialog", "USERNAME "))
        self.pass_label.setText(_translate("Dialog", "PASSWORD"))
        self.login_btn.setText(_translate("Dialog", "Login"))
        self.signup_btn.setText(_translate("Dialog", "Sign Up"))

    def warningBox(self, title, message):
        msg = QMessageBox()
        msg.setWindowTitle(title)
        msg.setText(message)
        msg.setIcon(QMessageBox.Warning)
        msg.setStandardButtons(QMessageBox.Ok)
        msg.exec_()

    def Login_btn(self, x):
        username = self.uname_lineEdit.text()
        password = self.pass_lineEdit.text()
        if not username:
            self.warningBox("Warning", 'Username Missing!')
        elif not password:
            self.warningBox("Warning", 'Password Missing!')
        else:
            connection = sqlite3.connect("login.db")
            result = connection.execute(
                "SELECT * FROM USERS WHERE USERNAME = ? AND PASSWORD = ?",
                (username, password))
            if (len(result.fetchall()) > 0):
                if x == 0:
                    Dialog.close()
                    self.InterfaceShow()
                elif x == 1:
                    self.signUpShow()
            else:
                self.warningBox('Warning', 'Invalid Username And/Or Password')
            connection.close()

    def InterfaceShow(self):
        self.Interface = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.Interface)
        self.Interface.show()

    def signUpShow(self):
        self.signUpWindow = QtWidgets.QDialog()
        self.ui = Ui_Signup()
        self.ui.setupUi(self.signUpWindow)
        self.signUpWindow.show()
 def sign(self):
     Signup = QtWidgets.QDialog()
     ui = Ui_Signup()
     ui.setupUi(Signup)
     Signup.show()
     Signup.exec_()
Esempio n. 6
0
 def signupButton(self):
     self.signDialog = QtWidgets.QDialog()
     self.ui = Ui_Signup()
     self.ui.setupUi(self.signDialog)
     self.signDialog.show()
Esempio n. 7
0
 def welcomePage(self):
     self.homWindow = QtWidgets.QMainWindow()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self.homWindow)
     self.homWindow.show()
Esempio n. 8
0
class Ui_Login(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.setFixedSize(600, 300)

        self.label_name = QtWidgets.QLabel(Dialog)
        self.label_name.setGeometry(QtCore.QRect(130, 160, 131, 21))
        self.label_name.setObjectName("label_name")

        self.label_password = QtWidgets.QLabel(Dialog)
        self.label_password.setGeometry(QtCore.QRect(130, 200, 151, 21))
        self.label_password.setObjectName("label_password")

        self.txtUsername = QtWidgets.QLineEdit(Dialog)
        self.txtUsername.setGeometry(QtCore.QRect(300, 160, 191, 27))
        self.txtUsername.setObjectName("txtUsername")

        self.txtPassword = QtWidgets.QLineEdit(Dialog)
        ################## make the password invisible ############
        self.txtPassword.setEchoMode(QtWidgets.QLineEdit.Password)
        ###########################################################
        self.txtPassword.setGeometry(QtCore.QRect(300, 200, 191, 27))
        self.txtPassword.setObjectName("txtPassword")

        self.btnLogin = QtWidgets.QPushButton(Dialog)
        self.btnLogin.setGeometry(QtCore.QRect(210, 250, 71, 41))
        self.btnLogin.setObjectName("btnLogin")

        #################### Login Button funtion #######################
        self.btnLogin.clicked.connect(self.loginCheck)
        #################################################################

        self.btnSignup = QtWidgets.QPushButton(Dialog)
        self.btnSignup.setGeometry(QtCore.QRect(290, 250, 81, 41))
        self.btnSignup.setObjectName("btnSignup")

        #################### SignUp Button #############################
        self.btnSignup.clicked.connect(self.signupButton)
        ################################################################

        self.label_Heading = QtWidgets.QLabel(Dialog)
        self.label_Heading.setGeometry(QtCore.QRect(150, 90, 381, 51))
        self.label_Heading.setObjectName("label_Heading")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)


    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "XXX系统"))
        self.label_name.setText(_translate("Dialog", "用户名:"))
        self.label_password.setText(_translate("Dialog", "密码:"))
        self.btnLogin.setText(_translate("Dialog", "登录"))
        self.btnSignup.setText(_translate("Dialog", "注册"))
        self.label_Heading.setText(_translate("Dialog", "登录页"))

    def welcomePage(self):
        self.homWindow = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.homWindow)
        self.homWindow.show()

    def loginCheck(self):
        username = self.txtUsername.text()
        password = self.txtPassword.text()
        getDb = Db()
        result = getDb.loginCheck(username,password)
        if(result):
            self.welcomePage()
            self.clearField()
            print(result)
        else:
            print("password wrong")
            self.showMessage("Warning","Invalid Username and Password")

    def showMessage(self,title,msg):
        msgBox = QtWidgets.QMessageBox()
        msgBox.setIcon(QtWidgets.QMessageBox.Warning)
        #msgBox.setTitle(title)
        msgBox.setText(msg)
        msgBox.setStandardButtons(QtWidgets.QMessageBox.Ok)
        msgBox.exec_()

    def signupButton(self):
        self.signDialog = QtWidgets.QDialog()
        self.ui = Ui_Signup()
        self.ui.setupUi(self.signDialog)
        self.signDialog.show()

    def clearField(self):
        self.txtUsername.setText(None)
        self.txtPassword.setText(None)
Esempio n. 9
0
class Ui_Dialog(object):

    # event handler for signup button
    def signup_check(self):
        print("signup button is clicked")

        self.signupWindow = QtWidgets.QDialog()
        self.ui = Ui_Signup()
        self.ui.setupUi(self.signupWindow)
        self.signupWindow.show()

    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(637, 477)
        Dialog.setStyleSheet(
            "QDialog{\n"
            "    background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0     rgba(255, 170, 0, 255), stop:1 rgba(255, 255, 255, 255))\n"
            "}\n"
            "QPushButton{\n"
            "    background-color:rgb(255, 255, 255)\n"
            "    border: none;\n"
            "}")
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(160, 170, 91, 21))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(Dialog)
        self.label_3.setGeometry(QtCore.QRect(160, 220, 91, 21))
        self.label_3.setObjectName("label_3")
        self.email_field = QtWidgets.QLineEdit(Dialog)
        self.email_field.setGeometry(QtCore.QRect(240, 170, 201, 22))
        self.email_field.setText("")
        self.email_field.setObjectName("email_field")
        self.password_field = QtWidgets.QLineEdit(Dialog)
        self.password_field.setGeometry(QtCore.QRect(240, 220, 201, 22))
        self.password_field.setEchoMode(QtWidgets.QLineEdit.PasswordEchoOnEdit)
        self.password_field.setObjectName("password_field")
        self.login_button = QtWidgets.QPushButton(Dialog)
        self.login_button.setGeometry(QtCore.QRect(290, 280, 93, 28))
        self.login_button.setObjectName("login_button")
        self.signup_button = QtWidgets.QPushButton(Dialog)
        self.signup_button.setGeometry(QtCore.QRect(290, 320, 93, 28))
        self.signup_button.setObjectName("signup_button")
        #########################3 Signup button event ########################
        self.signup_button.clicked.connect(self.signup_check)
        #######################################################################
        self.login_page_label = QtWidgets.QLabel(Dialog)
        self.login_page_label.setGeometry(QtCore.QRect(220, 70, 211, 91))
        self.login_page_label.setMinimumSize(QtCore.QSize(5, 0))
        self.login_page_label.setBaseSize(QtCore.QSize(40, 16))
        font = QtGui.QFont()
        font.setPointSize(41)
        font.setBold(False)
        font.setItalic(False)
        font.setUnderline(False)
        font.setWeight(50)
        font.setStrikeOut(False)
        font.setStyleStrategy(QtGui.QFont.PreferAntialias)
        self.login_page_label.setFont(font)
        self.login_page_label.setFocusPolicy(QtCore.Qt.NoFocus)
        self.login_page_label.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
        self.login_page_label.setTextFormat(QtCore.Qt.AutoText)
        self.login_page_label.setAlignment(QtCore.Qt.AlignCenter)
        self.login_page_label.setObjectName("login_page_label")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
        self.label_2.setText(_translate("Dialog", "Email:"))
        self.label_3.setText(_translate("Dialog", "Password: "******"Dialog", "Login"))
        self.signup_button.setText(_translate("Dialog", "Sign Up"))
        self.login_page_label.setText(_translate("Dialog", "Login Page"))
Esempio n. 10
0
 def on_signup_click(self):
     ui_signup = Ui_Signup()
     ui_signup.exec_()
Esempio n. 11
0
 def SignupWindowShow(self):
     self.ww2 = QtWidgets.QDialog()
     self.ui2 = Ui_Signup()
     self.ui2.setupUi2(self.ww2)
     self.ww2.show()   
Esempio n. 12
0
class Ui_Dialoglogin(object):


    
    def showMessagebox(self,title,message):
        msgbox = QMessageBox()
        msgbox.setIcon(QMessageBox.Warning)
        msgbox.setWindowTitle(title)
        msgbox.setText(message)
        msgbox.setStandardButtons(QMessageBox.Ok| QMessageBox.Cancel)
        msgbox.exec_()
#####define the  function to oepn the Mainwindow  if login is sucessfull############
    def LoginWindowShow(self):
        self.ww1 = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.ww1)
        self.ww1.show()
#####define the  function to oepn the Sign upwindow############
    def SignupWindowShow(self):
        self.ww2 = QtWidgets.QDialog()
        self.ui2 = Ui_Signup()
        self.ui2.setupUi2(self.ww2)
        self.ww2.show()   
#####define the logincheck function############
    def logincheck(self):

        uname = self.uname_lineedit.text()
        password = self.password_lineedit.text()
        #print("Login Button is Clicked")
    


#################database connection###############
        connection = sqlite3.connect("login.db")
        result = connection.execute ("SELECT * FROM USERS WHERE USERNAME= ? AND PASSWORD = ?",(uname,password))
        if ( len (result.fetchall()) > 0):
           print("User Found!")
           self.LoginWindowShow()
            
            
        else :
            print("User Not Found!")
            self.showMessagebox('Warning!',' Invalid UserName or Password')

        connection.close()  
######################################################
#####define the signupcheck function##################

    def signupcheck(self):
        print("Signup Button is Clicked")
        self.SignupWindowShow()
########################################################
    def on_click(self):
        self.ex1 = Ui_Dialoglogin()

    def setupUi(self, Dialoglogin):
        Dialoglogin.setObjectName("Dialoglogin")
        Dialoglogin.resize(460, 350)
        Dialoglogin.setLayoutDirection(QtCore.Qt.LeftToRight)
        Dialoglogin.setStyleSheet("QDialog {\n"
"background-color: beige;\n"
"}\n"
"QPushButton {\n"
"    background-color: palegoldenrod;\n"
"    border-width: 2px;\n"
"    border-color: darkkhaki;\n"
"    border-style: solid;\n"
"    border-radius: 2;\n"
"    padding: 3px;\n"
"    min-width: 9ex;\n"
"    min-height: 2.5ex;\n"
"color:rgb(0, 0, 0)\n"
"\n"
"}")
        self.username_label = QtWidgets.QLabel(Dialoglogin)
        self.username_label.setGeometry(QtCore.QRect(80, 100, 101, 31))
        font = QtGui.QFont()
        font.setFamily("Bell MT")
       
        self.username_label.setFont(font)
        self.username_label.setObjectName("username_label")
        self.password_label = QtWidgets.QLabel(Dialoglogin)
        self.password_label.setGeometry(QtCore.QRect(80, 130, 101, 51))
        font = QtGui.QFont()
        font.setFamily("Bell MT")
        
        self.password_label.setFont(font)
        self.password_label.setObjectName("password_label")
        self.uname_lineedit = QtWidgets.QLineEdit(Dialoglogin)
        self.uname_lineedit.setGeometry(QtCore.QRect(220, 110, 113, 20))
        self.uname_lineedit.setObjectName("uname_lineedit")
        self.password_lineedit = QtWidgets.QLineEdit(Dialoglogin)
        self.password_lineedit.setGeometry(QtCore.QRect(220, 150, 113, 20))
        self.password_lineedit.setObjectName("password_lineedit")
        self.password_lineedit.setEchoMode(QtWidgets.QLineEdit.Password)
        
        self.pushButton = QtWidgets.QPushButton(Dialoglogin)
        self.pushButton.setGeometry(QtCore.QRect(220, 210, 51, 30))

####################################################

        self.pushButton.clicked.connect(self.logincheck)


##################################################
        font = QtGui.QFont()
        font.setFamily("Bell MT")
        
        self.pushButton.setFont(font)
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtWidgets.QPushButton(Dialoglogin)
        self.pushButton_2.setGeometry(QtCore.QRect(280, 210, 51, 30))

#####################################################
        self.pushButton_2.clicked.connect(self.signupcheck)


##################################################

        font = QtGui.QFont()
        font.setFamily("Bell MT")
        
        self.pushButton_2.setFont(font)
        self.pushButton_2.setObjectName("pushButton_2")
        self.label = QtWidgets.QLabel(Dialoglogin)
        self.label.setGeometry(QtCore.QRect(90, 40, 251, 41))
        font = QtGui.QFont()
        font.setFamily("Bell MT")
        font.setPointSize(24)
        font.setBold(False)
        font.setWeight(50)
        self.label.setFont(font)
        self.label.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.label.setWordWrap(True)
        self.label.setObjectName("label")

        self.retranslateUi(Dialoglogin)
        QtCore.QMetaObject.connectSlotsByName(Dialoglogin)

    def retranslateUi(self, Dialoglogin):
        _translate = QtCore.QCoreApplication.translate
        Dialoglogin.setWindowTitle(_translate("Dialoglogin", "Dialog"))
        self.username_label.setText(_translate("Dialoglogin", "USERNAME:"******"Dialoglogin", "PASSWORD:"******"Dialoglogin", "Login"))
        self.pushButton_2.setText(_translate("Dialoglogin", "Sign Up"))
        self.label.setText(_translate("Dialoglogin", "Login Form"))