def on_pushButton_5_clicked(self): """ Slot documentation goes here. """ # TODO: not implemented yet from Login import role if role == "管理员": my_create = CreateUserDialog() my_create.exec_() else: message(u"错误", u"您不具有该权限")
class LoginDialog(QtGui.QDialog): def __init__(self, requestController, parent=None): #Initialize the HomeWindow object QtGui.QDialog.__init__(self, parent) #Assign the homeWindow object self.ui = Ui_LoginDialog() #Setup the window self.ui.setupUi(self) #Setup the RequestController self.rc = requestController #Set up the New User dialog and hide it self.createUserDialog = CreateUserDialog(requestController) self.createUserDialog.hide() #Handle events def accept(self): username = self.ui.UserNameTextBox.text() password = self.ui.PasswordTextBox.text() result = self.rc.login(username, password) if( result == None ): self.done(0) else: messageBox = QtGui.QMessageBox() messageBox.setText(LOGIN_FAILED_MESSAGE + "\n" + result) messageBox.exec_() def reject(self): self.done(1) def createUser(self): self.createUserDialog.show()
def __init__(self, requestController, parent=None): #Initialize the HomeWindow object QtGui.QDialog.__init__(self, parent) #Assign the homeWindow object self.ui = Ui_LoginDialog() #Setup the window self.ui.setupUi(self) #Setup the RequestController self.rc = requestController #Set up the New User dialog and hide it self.createUserDialog = CreateUserDialog(requestController) self.createUserDialog.hide()