def LoginClicked(self): self.allwidget['userent'].setStyleSheet(StyleSheets.EntryStyleSheet()) self.allwidget['passwent'].setStyleSheet(StyleSheets.EntryStyleSheet()) username = self.allwidget["userent"].displayText() ## get the username enter by user password = self.allwidget["passwent"].text() ## get the password enter bu user if self.UserData["username"] == username: ## check if the user name is correct or not if self.UserData["password"] == password: ## check if the password is correct or not self.openCalc() ## if password and usename is correct open the calculator else: ## if password is wronge set red background self.allwidget["passwent"].setStyleSheet(StyleSheets.WrongEntryStyleSheet()) else: ## if username is wronge set red background self.allwidget["userent"].setStyleSheet(StyleSheets.WrongEntryStyleSheet())
def passwordEntry(self): passw = QLineEdit("") ## create instance of entry field passw.setPlaceholderText("Password") ## set placeholder to field passw.setEchoMode(QLineEdit.Password) ## set the text should displayed in password formate passw.setStyleSheet(StyleSheets.EntryStyleSheet()) ## set style to field self.allwidget["passwent"] = passw ## save the entry field to dictonary return passw ## return the instance from function
def userEntry(self): userent = QLineEdit("") ## create instance of entry field userent.setPlaceholderText("User name") ## set placeholder to field userent.setStyleSheet(StyleSheets.EntryStyleSheet()) ## set style to field self.allwidget["userent"] = userent ## save the entry field to dictonary return userent ## return the instance from function