Exemplo n.º 1
0
class LoginForm(QtGui.QMainWindow):
	"""docstring for MyForm"""
	def login(self):
		#self.ui.passWordTx.setText("abc")
		userName = self.ui.userNameTx.text()
		passWord = self.ui.passWordTx.text()
		if self.db.loginCheck(userName, passWord):
			self.hide()
		else:
			message = QtGui.QMessageBox(self)
			message.setText(u"账号密码错误")
			message.resize(290,100)
			message.setIcon(QtGui.QMessageBox.Warning)
			message.exec_()
	def reset(self):
		self.ui.passWordTx.setText("")
		self.ui.userNameTx.setText("")

	def __init__(self, parent = None):
		QtGui.QWidget.__init__(self, parent)
		self.ui = Ui_Form()
		self.ui.setupUi(self)
		#删除最大化最小化按钮
		self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowMinMaxButtonsHint)
		#禁止最大最小化
		self.setFixedSize(290,160)
		QtCore.QObject.connect(self.ui.okBtn,QtCore.SIGNAL('clicked()'),self.login)
		QtCore.QObject.connect(self.ui.resetBtn,QtCore.SIGNAL('clicked()'),self.reset)
		#数据库
		self.db = DataBase()
Exemplo n.º 2
0
class LoginForm(QtGui.QMainWindow):
    """docstring for MyForm"""
    def login(self):
        #self.ui.passWordTx.setText("abc")
        userName = self.ui.userNameTx.text()
        passWord = self.ui.passWordTx.text()
        if self.db.loginCheck(userName, passWord):
            self.hide()
        else:
            message = QtGui.QMessageBox(self)
            message.setText(u"账号密码错误")
            message.resize(290, 100)
            message.setIcon(QtGui.QMessageBox.Warning)
            message.exec_()

    def reset(self):
        self.ui.passWordTx.setText("")
        self.ui.userNameTx.setText("")

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        #删除最大化最小化按钮
        self.setWindowFlags(self.windowFlags()
                            & ~QtCore.Qt.WindowMinMaxButtonsHint)
        #禁止最大最小化
        self.setFixedSize(290, 160)
        QtCore.QObject.connect(self.ui.okBtn, QtCore.SIGNAL('clicked()'),
                               self.login)
        QtCore.QObject.connect(self.ui.resetBtn, QtCore.SIGNAL('clicked()'),
                               self.reset)
        #数据库
        self.db = DataBase()
Exemplo n.º 3
0
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     self.ui = Ui_Form()
     self.ui.setupUi(self)
     #删除最大化最小化按钮
     self.setWindowFlags(self.windowFlags()
                         & ~QtCore.Qt.WindowMinMaxButtonsHint)
     #禁止最大最小化
     self.setFixedSize(290, 160)
     QtCore.QObject.connect(self.ui.okBtn, QtCore.SIGNAL('clicked()'),
                            self.login)
     QtCore.QObject.connect(self.ui.resetBtn, QtCore.SIGNAL('clicked()'),
                            self.reset)
     #数据库
     self.db = DataBase()
Exemplo n.º 4
0
class LoginWindow(QWidget):
    def __init__(self):
        super(QWidget, self).__init__()
        self.lform = QWidget()
        self.lform.setWindowFlag(Qt.FramelessWindowHint)
        self.uil = L_Form()
        self.uil.setupUi(self.lform)
        self.lform.show()
        self.uil.pushButton.clicked.connect(self.closing)
        self.uil.login_btn_2.clicked.connect(self.logincheck)
        self.uil.username.setFocus()
        self.uil.username.returnPressed.connect(self.uil.password.setFocus)
        self.uil.password.returnPressed.connect(self.uil.login_btn_2.setFocus)
        self.uil.forget_pass.clicked.connect(self.forget_password)

        user_name = ["SM Engineering"]
        self.uil.username.setCompleter(QCompleter(user_name))

    def forget_password(self):
        self.dispaly6 = PassChan()
        self.dispaly6.close()

    def closing(self):
        self.lform.close()

    def logincheck(self):
        conn = sqlite3.connect("sm.db")
        cur = conn.cursor()
        try:
            query = cur.execute(""" SELECT current_password FROM user """)
            password = query.fetchone()[0]
            if self.uil.username.text(
            ) == "SM Engineering" and self.uil.password.text() == password:
                self.display5 = MainWindow()
                self.display5.show()
                self.lform.close()

            else:
                ShowError()
        except:
            msg = QMessageBox()
            msg.setText("set your password first")
            msg.setIcon(QMessageBox().Information)
            msg.exec_()

        conn.commit()
        conn.close()
Exemplo n.º 5
0
	def __init__(self, parent = None):
		QtGui.QWidget.__init__(self, parent)
		self.ui = Ui_Form()
		self.ui.setupUi(self)
		#删除最大化最小化按钮
		self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowMinMaxButtonsHint)
		#禁止最大最小化
		self.setFixedSize(290,160)
		QtCore.QObject.connect(self.ui.okBtn,QtCore.SIGNAL('clicked()'),self.login)
		QtCore.QObject.connect(self.ui.resetBtn,QtCore.SIGNAL('clicked()'),self.reset)
		#数据库
		self.db = DataBase()
Exemplo n.º 6
0
    def __init__(self):
        super(QWidget, self).__init__()
        self.lform = QWidget()
        self.lform.setWindowFlag(Qt.FramelessWindowHint)
        self.uil = L_Form()
        self.uil.setupUi(self.lform)
        self.lform.show()
        self.uil.pushButton.clicked.connect(self.closing)
        self.uil.login_btn_2.clicked.connect(self.logincheck)
        self.uil.username.setFocus()
        self.uil.username.returnPressed.connect(self.uil.password.setFocus)
        self.uil.password.returnPressed.connect(self.uil.login_btn_2.setFocus)
        self.uil.forget_pass.clicked.connect(self.forget_password)

        user_name = ["SM Engineering"]
        self.uil.username.setCompleter(QCompleter(user_name))