Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # Form implementation generated from reading ui file 'login.ui'
- #
- # Created by: PyQt4 UI code generator 4.11.4
- #
- # WARNING! All changes made in this file will be lost!
- from PyQt4 import QtCore, QtGui
- import sqlite3
- try:
- _fromUtf8 = QtCore.QString.fromUtf8
- except AttributeError:
- def _fromUtf8(s):
- return s
- try:
- _encoding = QtGui.QApplication.UnicodeUTF8
- def _translate(context, text, disambig):
- return QtGui.QApplication.translate(context, text, disambig, _encoding)
- except AttributeError:
- def _translate(context, text, disambig):
- return QtGui.QApplication.translate(context, text, disambig)
- class Ui_Dialog(object):
- def login(self):
- username = self.username_input.text()
- password = self.pass_input.text()
- ###### Probemli yer ######
- connect = sqlite3.connect("login.db")
- result = connect.execute("SELECT * FROM users WHERE username = ? AND password = ?",[username,password])
- ###### Son ################
- if(len(result.fetchall()) > 0):
- print("Tapıldı ! ")
- self.welcomeWindowShow()
- else:
- print("Tapılmadı !")
- self.showMessageBox('İstifadəçi adı və ya şifrə yanlışdır!')
- connection.close()
- def register(self):
- print "SASd"
- def setupUi(self, Dialog):
- Dialog.setObjectName(_fromUtf8("Dialog"))
- Dialog.resize(545, 360)
- self.username_label = QtGui.QLabel(Dialog)
- self.username_label.setGeometry(QtCore.QRect(0, 130, 171, 51))
- font = QtGui.QFont()
- font.setPointSize(15)
- self.username_label.setFont(font)
- self.username_label.setAlignment(QtCore.Qt.AlignCenter)
- self.username_label.setObjectName(_fromUtf8("username_label"))
- self.login_button = QtGui.QPushButton(Dialog)
- self.login_button.setGeometry(QtCore.QRect(180, 260, 91, 31))
- self.login_button.setObjectName(_fromUtf8("login_button"))
- #
- self.login_button.clicked.connect(self.login)
- self.username_input = QtGui.QLineEdit(Dialog)
- self.username_input.setGeometry(QtCore.QRect(180, 140, 221, 31))
- self.username_input.setInputMethodHints(QtCore.Qt.ImhNone)
- self.username_input.setObjectName(_fromUtf8("username_input"))
- self.pass_label = QtGui.QLabel(Dialog)
- self.pass_label.setGeometry(QtCore.QRect(40, 190, 111, 51))
- font = QtGui.QFont()
- font.setPointSize(15)
- self.pass_label.setFont(font)
- self.pass_label.setAlignment(QtCore.Qt.AlignCenter)
- self.pass_label.setObjectName(_fromUtf8("pass_label"))
- self.pass_input = QtGui.QLineEdit(Dialog)
- self.pass_input.setGeometry(QtCore.QRect(180, 200, 221, 31))
- self.pass_input.setObjectName(_fromUtf8("pass_input"))
- self.title = QtGui.QLabel(Dialog)
- self.title.setGeometry(QtCore.QRect(80, 10, 341, 81))
- font = QtGui.QFont()
- font.setPointSize(40)
- self.title.setFont(font)
- self.title.setStyleSheet(_fromUtf8(""))
- self.title.setAlignment(QtCore.Qt.AlignCenter)
- self.title.setObjectName(_fromUtf8("title"))
- self.register_button = QtGui.QPushButton(Dialog)
- self.register_button.setGeometry(QtCore.QRect(290, 260, 121, 31))
- self.register_button.setObjectName(_fromUtf8("register_button"))
- #
- self.register_button.clicked.connect(self.register)
- self.retranslateUi(Dialog)
- QtCore.QMetaObject.connectSlotsByName(Dialog)
- def retranslateUi(self, Dialog):
- Dialog.setWindowTitle(_translate("Dialog", "Daxil Ol", None))
- self.username_label.setText(_translate("Dialog", "İstifadəçi adı", None))
- self.login_button.setText(_translate("Dialog", "Daxil Ol", None))
- self.pass_label.setText(_translate("Dialog", "Şifrə", None))
- self.title.setText(_translate("Dialog", "Daxil ol", None))
- self.register_button.setText(_translate("Dialog", "Qeydiyyatdan keç", None))
- if __name__ == "__main__":
- import sys
- app = QtGui.QApplication(sys.argv)
- Dialog = QtGui.QDialog()
- ui = Ui_Dialog()
- ui.setupUi(Dialog)
- Dialog.show()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement