[PyQt] Problem calling a window

Sandro Dutra hexodin at gmail.com
Tue Jan 13 16:08:11 GMT 2009


I'm writing a solution using Python, Qt and MySQL, I create the login screen
and set all the errors...

The problem is: When the user do the correct login in MySQL, I want the
login screen to close, and the whole application show.

The code when the button "Enter" is pressed:
---------------------------
    def on_pushButton_enter_clicked(self):
        user = self.lineEdit_user.text()
        passw = self.lineEdit_passw.text()
        if user == "" or passw == "":
            QMessageBox.information(self,  "ERRO",  u"Por favor, entre com o
usuário e senha.",  "OK")
        else:
            try: ############ If the login is made, the application is
launch and the login screen is closed.
                p2db = Pro2db(str(user),  str(passw))
                mainWnd = Pro2MainWindow()
                mainWnd.showMaximized()
                self.close()
                 ###########################################
            except MySQLdb.Error,  error_code:
                if error_code[0] == 1045:
                    message = u"Acesso negado para o usuário: %s" %user
                elif error_code[0] == 2003:
                    message = u"Não foi possível realizar a conexão."
                else:
                    message = u"Erro desconhecido.\nCódigo administrativo:
%s - %s." %(error_code[0],  error_code[1])
                QMessageBox.information(self, "Falha no acesso",  u"O
servidor informa:\n%s" %message,  "OK")
---------------------------

Anyone can help?

Thanks in advance,
Sandro Dutra,
Brazil.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090113/d75c58d6/attachment.html


More information about the PyQt mailing list