Finally, with this code by Sergio Jovani, the problem is solved.<br>'''<br>Try with this:<br>
<br>
wndMain = Pro2MainWindow(self) # <--- set as parent QDialog<br>
wndMain.showMaximized()<br>
self.hide()<br>'''<br><br>Thanks!<br><br><div class="gmail_quote">2009/1/15 Sergio Jovani <span dir="ltr"><<a href="mailto:lesergi@gmail.com">lesergi@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
If you want to call a QMainWindow from a QDialog you have to set a<br>
parent. exec_() gets attribute error because I thought it was a<br>
QDialog :P<br>
<br>
Try with this:<br>
<br>
wndMain = Pro2MainWindow(self) # <--- set as parent QDialog<br>
wndMain.showMaximized()<br>
self.hide()<br>
<br>
2009/1/15 Sandro Dutra <<a href="mailto:hexodin@gmail.com">hexodin@gmail.com</a>>:<br>
<div><div></div><div class="Wj3C7c">> Sorry for the delay... it's the time, it's the time...<br>
><br>
> I used Eric4 and QtDesigner, so the Pro2MainWindow it's only the window<br>
> without the widgets (I only want to test the call), here's the code:<br>
><br>
> ---Pro2MainWindow Code---<br>
> # -*- coding: utf-8 -*-<br>
><br>
> """<br>
> Module implementing Pro2MainWindow.<br>
> """<br>
><br>
> from PyQt4.QtGui import QMainWindow<br>
> from PyQt4.QtCore import pyqtSignature<br>
><br>
> from Ui_Pro2MainWindow import Ui_Pro2MainWindow<br>
><br>
> class Pro2MainWindow(QMainWindow, Ui_Pro2MainWindow):<br>
> """<br>
> Class documentation goes here.<br>
> """<br>
> def __init__(self, parent = None):<br>
> """<br>
> Constructor<br>
> """<br>
> QMainWindow.__init__(self, parent)<br>
> self.setupUi(self)<br>
><br>
> The setupUi, only call the definitions of the ui generated by QtDesigner,<br>
> and here's the complete code for the login screen:<br>
> # -*- coding: utf-8 -*-<br>
><br>
> """<br>
> Module implementing DialogPro2Login.<br>
> """<br>
><br>
> from PyQt4.QtGui import QDialog, QMessageBox, QApplication<br>
> from PyQt4.QtCore import pyqtSignature<br>
><br>
> from Ui_Pro2Login import Ui_DialogPro2Login<br>
> from Pro2MainWindow import Pro2MainWindow<br>
> from db.database import Pro2db<br>
><br>
> import MySQLdb, sys<br>
><br>
> class DialogPro2Login(QDialog, Ui_DialogPro2Login):<br>
> """<br>
> Class documentation goes here.<br>
> """<br>
> def __init__(self, parent = None):<br>
> """<br>
> Constructor<br>
> """<br>
> QDialog.__init__(self, parent)<br>
> self.setupUi(self)<br>
><br>
> @pyqtSignature("")<br>
> def on_pushButton_enter_clicked(self):<br>
> user = self.lineEdit_user.text()<br>
> passw = self.lineEdit_passw.text()<br>
> if user == "" or passw == "":<br>
> QMessageBox.information(self, "ERRO", u"Por favor, entre com o<br>
> usuário e senha.", "OK")<br>
> else:<br>
> try:<br>
> p2db = Pro2db(str(user), str(passw)) ### Here is where I<br>
> want to call the mainwindow ####<br>
> wndMain = Pro2MainWindow()<br>
> wndMain.exec_()<br>
> wndMain.showMaximized()<br>
> self.hide()<br>
> ##############################<br>
> except MySQLdb.Error, error_code:<br>
> if error_code[0] == 1045:<br>
> message = u"Acesso negado para o usuário: %s" %user<br>
> elif error_code[0] == 2003:<br>
> message = u"Não foi possível realizar a conexão."<br>
> else:<br>
> message = u"Erro desconhecido.\nCódigo administrativo:<br>
> %s - %s." %(error_code[0], error_code[1])<br>
> QMessageBox.information(self, "Falha no acesso", u"O<br>
> servidor informa:\n%s" %message, "OK")<br>
><br>
> @pyqtSignature("")<br>
> def on_pushButton_exit_clicked(<br>
> self):<br>
> self.close()<br>
><br>
> If you need more info tell me,<br>
> Thanks for the attention to a so noob problem.<br>
> Sandro Dutra - Brazil.<br>
</div></div><div><div></div><div class="Wj3C7c">> _______________________________________________<br>
> PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
> <a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
><br>
</div></div></blockquote></div><br>